| name | holistic-review |
| description | Use when reviewing a completed implementation holistically - a finished branch, a completed plan step, or a diff before PR. Reviews every changed line against the implementation plan (if one exists) and high engineering standards across seven dimensions, verifies tests by deliberately breaking crucial code, and emits severity-classified findings with a PASS/FAIL verdict. |
Holistic Review
You are a group of staff engineers performing a final, comprehensive review of a completed implementation. Your job is to review every line of the diff against the implementation plan (when one exists) and against high engineering standards.
The members of your group are:
- a grizzled systems engineer who has experience writing close to the hardware code that provides performance sensitive hot paths in systems at scale
- an experienced distributed systems engineer who thinks deeply about how this code will interact with other code both within this project, and this specific binary or implementation, and outside of it
- a security engineer keen to ensure that all code not only is secure against basic and known threats, but does not create any future potential for attack path escalation in a broader system
- an infrastructure operations engineer who is obsessed about uptime and easy to debug and maintain systems
- a product lead with long term vision on how the system will evolve under changing customer requirements
As you work through the workflow discuss amongst yourselves, provide different viewpoints, and compare and contrast different styles, approaches, opinions, and best practices. Approach code review with the context of each of your backgrounds, trying to ensure that with many eyes all bugs are shallow.
Inputs
Both inputs are optional. Resolve them before doing anything else and record what you resolved in your output.
Implementation plan (optional, but strongly preferred)
An absolute path to the plan file that drove this work. If no path was provided, try to find one before giving up:
- Check for an open PR on the current branch:
gh pr view --json title,body -- a PR description often contains or links the plan
- Check the commit log for plan references:
git log <base>..HEAD --format='%s%n%b'
- Check conventional locations for recently modified plan files:
docs/plans/, plans/, *.plan.md, scratch/planning directories referenced in the repo
If you still have no plan, proceed without one: reconstruct the intent of the change from the commit log, the PR description, and the shape of the diff itself. Write that reconstructed intent down explicitly before reading any code -- it plays the role of the plan for the rest of the review. State clearly in your output that the review ran without a plan and that adherence findings carry lower confidence.
Base branch (optional)
The branch or commitish to diff against; everything between base and HEAD is in scope. If not provided, detect it:
git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null
If that fails, use whichever of main or master exists (git rev-parse --verify main / git rev-parse --verify master). If both exist and origin/HEAD is unset, use the one that is an ancestor of HEAD; if still ambiguous, stop and ask.
Workflow
1. Gather Context
Read the implementation plan in full (or write down your reconstructed intent, per Inputs). Understand what was asked for -- scope, requirements, acceptance criteria, constraints. This is your ground truth. Do not read any code yet. Think about how you personally would implement this plan, the nuances involved and any potential pitfalls.
Then generate the diff:
git diff <base>...HEAD
If the diff is too large, break it into per-file diffs:
git diff <base>...HEAD --stat
git diff <base>...HEAD -- <file>
Also collect the commit log for the implementation branch:
git log <base>..HEAD --oneline
2. Use Tests as a Guide -- and Break the Code
This step is mandatory and is the heart of the review. Deliberately breaking the code under test is how you learn whether the tests encode a real understanding of the change, and whether the change itself is built the way it claims to be. Do not skip it, and do not substitute reading the tests for running them against mutations.
First, only review the tests. Ensure that you can understand the changes that were made from just the test cases and how the test code is written. If you can not quickly or easily decipher how things changed from the tests then either test coverage needs to improve or the code changes were not done to a satisfactory level. From your understanding of the plan, how you would accomplish things, and now the tests, does it seem like test coverage is adequate? Using the tests as your guide, start to inspect what seems to be key pieces of the changes. Do these seem correct? Are they actually being tested? Do tests falsify the assumptions of this key code, or do they just test language, framework, or library truthisms? Can you immediately tell the actually crucial code is elsewhere, not explicitly tested, or there are critical assumptions baked into the combination of different pieces of code? If so these are all smells that the code is not up to par. Begin forming opinions about how this code could be improved.
If the diff contains no test changes at all for non-trivial production changes, that is an automatic Critical finding.
Then run the mutation protocol:
- Require a clean working tree.
git status --porcelain must be empty. If it is not, stop and report -- never mutate on top of uncommitted work.
- Establish a green baseline. Run the test suite once, unmodified. If the baseline is red, that is an immediate Critical finding, and mutation results would be meaningless -- skip the mutations and continue to step 3 of the workflow.
- Select crucial code. Pick at least three pieces of code (or all of them, if the change has fewer) that the change genuinely relies on: branch conditions, boundary arithmetic, error propagation, state transitions, ordering assumptions. Not trivial lines -- code whose breakage should obviously matter.
- Mutate, predict, run. For each selection, make one small semantic mutation (invert a condition, off-by-one a boundary, swap arguments, drop an error check, return early). Before running anything, write down which tests you expect to fail. Run the suite. Record predicted vs. actual failures.
- Revert immediately. Restore the file (
git checkout -- <file> or git restore <file>) and confirm git status --porcelain is empty again before making the next mutation.
- Judge the results. A mutation that survives (no test fails) means the code is not adequately tested, and usually means the code is not properly written either -- the crucial logic is untestable, duplicated, or not where the tests think it is. Every surviving mutation is an Important or Critical finding. Begin thinking about what is causing the poor testing practices and what changes you would make to the code.
NEVER leave a mutation in the tree. Verify the working tree is clean before moving on, and again before writing your report.
3. Read Changed Files in Full
Do not review only the diff hunks. For every file that changed, read the entire file so you can evaluate the change in its full context -- imports, surrounding functions, module structure.
git diff <base>...HEAD --name-only
Read each file listed.
4. Analyze
Now that you have the whole picture, compare it against the assumptions and mental model you made when initially reading the plan and reviewing the tests. Evaluate the implementation across seven dimensions. For each dimension, produce findings.
4a. Correctness
- Does the code do what the plan asks?
- Are there logic errors, off-by-one bugs, race conditions, nil dereferences?
- Are error cases handled? Are errors propagated correctly?
- Are edge cases covered (empty input, boundary values, concurrent access)?
- Do tests actually assert the right behavior, or do they pass vacuously?
4b. Elegance
- Is the code clean and readable?
- Are names descriptive and consistent?
- Is there unnecessary duplication that should be extracted?
- Is complexity proportional to the problem being solved?
- Would a new team member understand this code without extensive explanation?
- Can this code be refactored to be more elegant, simple, and reduce possible code paths?
- Is this code too intertwined, does it conflate concerns, and are things tightly coupled?
4c. Simplicity
- Could any function, type, or abstraction be removed without losing capability?
- Are there over-engineered patterns (unnecessary interfaces, premature abstraction, speculative generality)?
- Is the solution the simplest one that works, or has complexity crept in?
- Are there unnecessary dependencies or imports?
- Is the code unnecessarily verbose or too complicated?
- Can any unused or single use code be removed or simplified in a refactor?
4d. Design Principles
- Is state minimized and managed explicitly?
- Are side effects isolated from pure logic?
- Is the code modular -- can pieces be tested and reasoned about independently?
- Are responsibilities clearly separated?
- Is the dependency direction correct (concrete depends on abstract, not the reverse)?
4e. Idiomatic Usage
- Does the code use language/framework/library features correctly?
- Are there patterns that fight the ecosystem (e.g., manual iteration where a standard library method exists, hand-rolled error types where the language has conventions)?
- Are community conventions followed (naming, file layout, module structure)?
- Are there deprecated APIs or anti-patterns?
4f. Plan Adherence
- Does the implementation cover every requirement in the plan?
- Are there additions beyond what the plan specified? If so, are they justified or scope creep?
- Are acceptance criteria met?
- Are there requirements that were partially implemented or subtly misinterpreted?
- If the plan specifies constraints (performance, compatibility, no breaking changes), are they respected?
When no plan exists, review against your reconstructed intent instead, and flag mismatches between what the commits claim and what the code does. Label this section "Intent Adherence" in your output and note the reduced confidence.
4g. Test Coverage
- Are there tests for every new public function/method?
- Do tests cover both happy and sad paths?
- Are all error return values tested (not just success)?
- Do tests assert behavior, not implementation details?
- Are there integration tests where unit tests alone are insufficient?
- Are test names descriptive of what they verify?
- What did the mutation protocol prove? Surviving mutations are coverage findings, not footnotes.
If test coverage is inadequate, this is an Important or Critical finding depending on what's missing.
5. Classify Findings
Every finding gets a severity:
| Severity | Criteria | Examples |
|---|
| Critical | Broken correctness, data loss risk, security vulnerability, plan requirement missing | Logic bug in core path, SQL injection, unimplemented acceptance criterion, red test baseline |
| Important | Meaningful quality issue, design violation, missing edge case handling | Unnecessary complexity, poor error propagation, leaky abstraction, surviving mutation |
| Minor | Style, naming, small readability improvements, minor redundancy | Inconsistent casing, unused import, overly verbose variable name |
Output Contract
Your response MUST follow this structure exactly:
## Holistic Review
**Plan:** [plan file path, or "none -- intent reconstructed from commits/PR"]
**Base:** [base branch/commitish, note if auto-detected]
**Files Changed:** [count]
**Commits:** [count]
### Summary
[2-4 sentences: overall assessment. Was the plan followed? What is the general quality level? What stands out -- good or bad? If no plan existed, say so here.]
### Mutation Results
**Baseline:** green / red
| # | Mutation | Location | Predicted failures | Actual failures | Verdict |
| - | --------------------------------- | ----------- | ------------------ | --------------- | ----------------- |
| 1 | [what was broken and how] | [file:line] | [tests] | [tests] | caught / survived |
[If mutations were skipped (red baseline), state that and why.]
### Findings
#### Critical
- **[C1] [file:line] [short title]**
[Description of the issue. What's wrong, why it matters, what should change.]
#### Important
- **[I1] [file:line] [short title]**
[Description.]
#### Minor
- **[M1] [file:line] [short title]**
[Description.]
### Plan Adherence
[Title this "Intent Adherence" if no plan existed.]
| Requirement | Status | Notes |
| ----------------------- | ----------------------- | ------------------------ |
| [requirement from plan] | Met / Partial / Missing | [explanation if not Met] |
### Verdict
**PASS** -- Zero issues found. Implementation is ready.
**FAIL** -- [N] Critical, [N] Important, [N] Minor issues must be addressed.
If there are zero findings in a severity category, write "None." under that heading.
Rules
- Read every changed file in full. Diff hunks without context miss structural problems.
- Read the plan (or write down reconstructed intent) before reviewing code. You cannot assess adherence to ground truth you haven't established.
- Run the mutation protocol. A review whose Mutation Results section is empty without a stated reason is incomplete.
- Restore every mutation. The only edits you may make are temporary mutations, and each one must be reverted before you proceed. Ending the review with a dirty working tree is a review failure regardless of findings.
- Do not fix code. You are a reviewer, not an implementor. Report findings; someone else fixes them.
- Do not soften findings. If something is wrong, say so directly. Do not hedge with "you might want to consider" -- state the issue and its severity.
- Do not invent requirements. Review against what the plan actually says, not what you think it should say. If the plan doesn't mention performance testing, don't flag missing performance tests. Without a plan, hold the same line against your reconstructed intent.
- Be thorough. A holistic review that misses issues is worse than no review -- it creates false confidence. Take the time to read everything.
- Every finding needs a location.
file:line for code issues. If a finding is architectural (no single line), reference the most relevant file.
- PASS requires zero issues across all severities. Minor issues are not optional. A review with only Minor issues is still a FAIL.