GitLab Well Architected
Cookbook navigation
Prompts / Understand Code Before Making Changes

Understand Code Before Making Changes

Code UnderstandingAnalysisDeveloperOnboardingRisk-MitigationCreateBeginner

Analyze code dependencies and potential impacts before modifying unfamiliar code sections. Essential for preventing breaking changes during refactoring.

For GitLab Duo

prompt

I'm making changes to [FILE/COMPONENT NAME] and need to understand what else might be affected. Here's my change:

Current code:
[PASTE ORIGINAL CODE]

My proposed change:
[PASTE MODIFIED CODE OR DESCRIBE THE CHANGE]

Please help me understand:
1. What other files or components directly use this code?
2. What could break if I make this change?
3. Are there any tests I should update or add?
4. What specific things should I search for in the codebase to find impacted areas?

Use the prompt

Include both the current implementation and the proposed change. Representative callers and tests help connect the impact discussion to behavior other parts of the application depend on.