Skip to main content

Claude/ChatGPT Prompt to Decompose a Big Refactor into Cursor Tasks

Break a large refactor into ordered, Cursor agent-friendly task chunks with scope, files, diff size, dependencies, and verification per task.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt asks the model to act as a senior engineer planning work for an AI coding agent and decompose a large refactor into Cursor-friendly tasks, each specified tightly enough to hand off without further questions. You set the [refactor] goal, the [codebase], the [max_diff] per task, and the [risk_tolerance], and it returns an ordered task list with scope, files, diff size, dependencies, and verification per task.

The structure works because the failure mode of agent-driven refactors is always the same: hand over the whole job and you get a sprawling, unreviewable diff. By forcing each task to stay under [max_diff], be independently shippable, and keep the app green, the prompt keeps every step reviewable. Explicit dependencies stop tasks running before prerequisites, and a first scaffolding task adds the new path alongside the old before removal. Specifying scope, exact files, and a one-line verification per task means you can hand each chunk to the agent without further questions, and check it landed correctly before moving on.

When to use it

  • You're driving a big refactor through Cursor's agent mode.
  • A single agent run produces sprawling, unreviewable diffs.
  • You need each task bounded under a max diff size.
  • You want explicit dependencies so nothing runs out of order.
  • You need the app to stay green after every task.
  • You want rollback notes calibrated to your risk tolerance.
  • You want a scaffolding-first sequence that adds the new path before removing the old.

Example output

Expect a numbered task list where each task carries scope, the exact files to touch, expected diff size, dependencies, and a one-line verification step. It includes a sequencing strategy for your [codebase] that keeps the app green after every task, rollback notes per task calibrated to [risk_tolerance], and a first "scaffolding" task that adds the new path alongside the old before anything is removed. The result reads as a checklist you can feed Cursor one item at a time, verifying each before the next, so the refactor lands in reviewable pieces instead of one overwhelming diff.

Pro tips

  • Keep [max_diff] to a few hundred lines; past that, review quality falls off a cliff and the diffs stop being trustworthy.
  • State the [refactor] goal concretely (e.g. migrate REST to GraphQL) so the task breakdown maps to real work.
  • Describe [codebase] accurately (e.g. a Next.js + Node monorepo) so the sequencing strategy fits your structure.
  • Set [risk_tolerance] honestly; low tolerance on a production app means more conservative rollback notes and smaller steps.
  • Insist on the scaffolding-first task so the new path exists alongside the old before any removal, keeping the app shippable.
  • Use the one-line verification per task as the gate before moving on, so a broken step can't silently propagate.

Frequently Asked Questions

Why decompose a refactor instead of handing the agent the whole job?
Handing the whole job to an agent produces a sprawling, unreviewable diff, which is the consistent failure mode. Slicing into bounded, ordered tasks keeps every step reviewable and the app shippable between each one.
How big should each task be?
Each task stays under your `[max_diff]`, and the author recommends keeping it to a few hundred lines. Past that, review quality falls off a cliff, so smaller diffs keep each change genuinely reviewable.
Does it keep the app working between tasks?
Yes. The sequencing strategy keeps the app green after every task, and a first scaffolding task adds the new path alongside the old before removal. Each task also has a one-line verification step to gate progress.
Can I make the plan more conservative?
Yes. Set `[risk_tolerance]` to low, and rollback notes per task plus smaller steps are calibrated accordingly. For a production app with no downtime, this produces a more cautious sequencing and removal strategy.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Cursor AI Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support