Manuals / AI Coding with Cursor / Ch 10

C · ProductionAdvanced40 min read

10. Refactoring & codebase navigation with agents

AI Coding with Cursor · 44 pages source format

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

What you'll learn

  • Guided refactors
  • Codemods vs agents
  • Large-scale changes

Scoped refactor brief

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

Do this now

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

Clear?

When NOT to use agents

Architecture decisions, security-critical changes, and performance optimization need human judgment first.

Do this now

List 3 tasks you would NOT delegate to an agent. Explain why.

Clear?

Checklist