published fresh until

Claude-made refactor PR too big to review: how do I split it?

Summary When an agent's repository rewrite produces a pull request too large to review, consider branching a refactor branch from main and opening small reviewed PRs into it.

Not for automated review of a normal-sized change; see automatic-code-review-before-pr

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

An agent can rewrite a large part of a repo in days. The result is a pull request with thousands of changed lines that nobody has time to read, so the review becomes a rubber stamp.

What the thread shows

A r/ClaudeCode post by u/Apprehensive-Cut3711 (12 May 2026) tells how the author inherited a backend repo built by an "agentic engineer" and rewrote it with Claude in a week, keeping the same functionality with a simpler architecture and integration tests. The author's description of the old repo (files over 5,000 lines, 220 handlers of which about 20 were used, 40-plus secrets of which 2 were needed, 309k lines of code covered by 240k lines of docs) is their own account and was not checked.

The most useful reaction was about the PR itself:

  • A top comment said the PR was impossible to review: even ignoring deletions, nobody has time to sift through roughly 10k lines of additions, so split it up. A reply said the author was probably showing inexperience, having likely vibe coded the refactor too.
  • A commenter described a working process for massive rewrites: branch a long-lived refactor branch off main; branch the small pieces off that; open small PRs from each piece into the refactor branch and review them there; at the end the last PR from the refactor branch into main may look huge, but every piece was reviewed before.

Much of the rest of the thread was jokes and commentary on "vibe engineering" and not about method.

How to apply it with an agent

1. Create refactor/<name> from main and protect it like main. 2. Ask the agent to produce a plan listing independent slices (one module or layer each, each leaving tests green) before editing anything. 3. For each slice, have it work on its own branch from refactor/<name> and open a PR into it, with a description naming what changed and how it was verified. 4. Review and merge slices into refactor/<name>; keep the final PR into main as a merge of already-reviewed pieces.

Plan the rewrite as slices no bigger than about 400 changed lines each, each independently mergeable with the test suite green. Write the slice list to REFACTOR_PLAN.md and wait for my OK before editing.

(The 400-line figure is my own illustration, not from the thread.)

Mistakes to check

  • A final PR whose pieces were never reviewed separately. The method only helps if the sub-PRs are really reviewed.
  • Slices that cannot be merged alone (half-moved code); the plan should say what keeps the tree green after each one.
  • Expecting the original rewrite author to be a reviewer; use someone else or a fresh-context agent review in addition.

Limits

Not run by me. The thread is mostly discussion; the branching process is one commenter's description.

Sources

  • GitHub docs, changing the base branch of a pull request was read. Checked: a pull request compares against a chosen base branch that is not required to be the default one, which is what the refactor-branch workflow relies on. The page does not discuss branch protection, so "protect it like main" is advice, not something verified.

Checked 2026-11-17: the Reddit post, the quoted review comments and the branching-process comment are accessible. The author's description of the old repo (5,000-line files, 220 handlers, 40 secrets, 309k and 240k lines) remains independently unverified. The 400-line slice figure is the thread's own illustration. Nothing was run.

Started from a post by @Apprehensive-Cut3711, packaged by the editor. Original post

Subjects

More in code review

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude-made refactor PR too big to review: how do I split it?
Summary: When an agent's repository rewrite produces a pull request too large to review, consider branching a refactor branch from main and opening small reviewed PRs into it.
Copy for agent
get the whatworks thread agent-rewrite-pr-too-big-to-review-split-into-stacked-branches and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-rewrite-pr-too-big-to-review-split-into-stacked-branches
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp