CursorRefactoringLevel 3: Workflows

How Do You Turn a Big Agent Change Into PRs People Can Review?

Build freely, and then clean up. Once the feature works, ask Agent to rework the history into small commits with clear messages, or run the built-in /split-to-prs skill to break the change into smaller pull requests. Agent output tends to arrive as one huge diff, and that's the part you can fix afterward.

Prompt to copy
Rework this branch's commits into reviewable pieces.

First make a backup branch called [backup-branch-name] at the current HEAD. Then reset softly to [main], read through all the changes, and plan a logical sequence of commits, each one a single change with a clear message. Show me the plan and wait for my OK.

After creating the commits, compare the final tree with the backup branch and confirm the diff is empty. Don't push.
  1. 1Reset to main
  2. 2Read all the changes
  3. 3Plan a logical sequence
  4. 4Create clean commits
  5. 5Diff against the original
The steps in Cursor's course for reworking history. The final diff is what makes it safe to hand off.

Try it now

  1. 1On a branch with a large change, type /split-to-prs in the Agent input, or paste the prompt above if you only want cleaner commits.
  2. 2Read what it proposes, and check that tests and the code they cover land in the same commit.
  3. 3Run git diff [backup-branch-name] yourself. It worked if the diff is empty and git log reads like a sensible story.

Use it when

After a long Agent run or a refactor that touched many files, before you ask a teammate to review. Also use it when you see that one PR is really two or three unrelated changes.

Skip it when

Small changes that are already one logical commit. Also be careful on a branch others have pulled, because rewriting its history will cause problems for them. Do this before you share the branch, or create new branches instead.

Why it works

Agents can produce hundreds of changed lines at once, which is hard for anyone to review. Cursor's course recommends small commits, where each one is a single logical change, so a reviewer can step through the history. It describes the steps: the agent resets to main, reads through all the changes, plans a logical sequence, creates clean commits, and validates that the final diff matches the original so nothing is lost. That last check is what makes this safe to hand off.

Example

Say a feature branch has 40 files changed and one commit called "wip". The agent proposes four commits: database column, API route with its tests, UI component, and a refactor it needed along the way. You ask it to move the refactor first, since it stands alone and is easy to approve. The empty diff against the backup confirms the content is unchanged, and a reviewer now reads four short steps.

Going further

Turn this into a shared command. Cursor's course suggests writing a skill so anyone on the team can run something like /rework-commits after a feature, and /create-skill will build it for you. Before review, ask "What questions will reviewers have about these changes?" with @Branch attached. Also know that Agent commits may carry a Made with Cursor trailer, which is on by default. From Cursor 3.11, toggle it in Cursor Settings > Git & PRs > Attribution.

Common mistakes

  • Rewriting history without a backup branch, leaving nothing to compare with.
  • Trusting the agent's report that nothing was lost rather than running the diff yourself.
  • Force-pushing a rewritten branch that teammates already use.
  • Splitting commits along file boundaries rather than logical changes, which gives you tidy commits that don't pass tests on their own.

Sources

Checked 6 November 2026. Products change often, so confirm details with the vendor.

Related

Beyond the course