
Map your codebase context before asking AI for refactoring help
You'll have a documented context map (file relationships, dependencies, recent changes) that you paste into refactoring prompts to prevent AI from missing cross-file impacts.
What you'll make
Codebase Context Map
- File Relationship Diagram: key dependencies and imports
- Impact Zones: what breaks if each component changes
- Recent Changes Log: modifications that affect current refactoring scope
The 3 parts
Each part ends with a check you can see.
Map Your File Dependencies
Document how your key files connect to each other and what they depend on.
Done when
You have a dependency map showing import chains and shared components for your current refactoring target, with at least 3 levels of connections documented.
Identify What Breaks
Test your assumptions about what would break if you change each component.
Done when
You have a tested list of impact zones with specific examples of what breaks when each component changes, validated against your actual codebase behavior.
Document Recent Changes
Capture recent modifications that affect your refactoring scope but might not be obvious from the current code.
Done when
You have a changes log covering the last 2-4 weeks that highlights modifications relevant to your refactoring target, with context about why each change was made.
Capstone: you put together your Codebase Context Map.
Where this helps
An elective: a single lesson that sits outside rtwo's job certificates and doesn't count toward one.
About this lesson
What you'll be able to do
- Map file dependencies and impact zones before refactoring prompts
- Document context that AI needs to avoid breaking cross-file connections
- Test AI refactoring suggestions against your actual codebase structure
Who it's for
- Developers who've had AI break their code during refactoring
- Teams working on codebases larger than what fits in a single prompt
- Anyone tired of AI missing obvious dependencies when suggesting code changes
What it won't cover
- Which AI coding tool to choose
- Advanced prompt engineering techniques
- How to set up development environments or tooling
Skills you'll practise
- Codebase dependency mapping
- Context documentation for AI tools
- Impact zone analysis
- AI output validation against real constraints