Manuals / AI Coding with Cursor / Chapter 10

C · Production · advanced · ~40 min · Chapter 10 of 11

Refactoring & codebase navigation with agents

Agents excel at mechanical refactors (rename, extract, migrate). Guide them with search results and explicit file lists.

Path progress
86%

Step 1 of 2

Scoped refactor brief

"Rename UserService to AccountService in src/services/ only. Update imports. Run tests."

Scoped refactor briefDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Scoped refactor brdrag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Do this now

Execute a rename refactor with agent. Verify with grep that no old name remains.

Was this step clear?
Chapter learning outcomes
  • Guided refactors
  • Codemods vs agents
  • Large-scale changes

Clear these before you leave

Side quest

Migration assist

Use agent to migrate one file from JS to TS. Review types manually.