principleModeratepending
Principle: Small PRs merge faster
Viewed 0 times
pull requestcode reviewsmall prfeature flagsvertical slice
Problem
Large pull requests take days to review, get rubber-stamped, and are more likely to introduce bugs.
Solution
Keep PRs small and focused:
Guidelines:
How to split large changes:
- PR 1: Refactor existing code to prepare for new feature
- PR 2: Add the new feature on clean foundation
- PR 1: Backend API endpoint (with tests)
- PR 2: Frontend UI that calls it (with tests)
- Ship incomplete features behind flags
- Each PR adds a piece, all hidden from users
- Final PR: enable the flag
- PR 1: Rename across codebase (easy to review)
- PR 2: Logic changes (needs careful review)
The math:
The best PR is one a reviewer can hold entirely in their head.
Guidelines:
- Target: < 400 lines changed (ideal: < 200)
- One logical change per PR
- If the description needs more than 3 bullet points, split the PR
How to split large changes:
- Refactor first, feature second:
- PR 1: Refactor existing code to prepare for new feature
- PR 2: Add the new feature on clean foundation
- Vertical slices:
- PR 1: Backend API endpoint (with tests)
- PR 2: Frontend UI that calls it (with tests)
- Feature flags:
- Ship incomplete features behind flags
- Each PR adds a piece, all hidden from users
- Final PR: enable the flag
- Mechanical changes separately:
- PR 1: Rename across codebase (easy to review)
- PR 2: Logic changes (needs careful review)
The math:
- 100-line PR: reviewed in 15 min, merged same day
- 1000-line PR: reviewed in 2 hours (spread over days), merged in 3-5 days
- Bug rate correlates with PR size, not linearly but exponentially
The best PR is one a reviewer can hold entirely in their head.
Why
Research (Microsoft, Google) shows defect density increases with change size. Small PRs get more thorough reviews and ship faster.
Context
Team development workflow and code review practices
Revisions (0)
No revisions yet.