Più passaggi e revisione indipendente
Una nuova istanza trova problemi che l’autore non nota.
Più passaggi e revisione indipendente è una lezione Claude Architect gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Claude Architect, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Claude Architect include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
The Author's Blind Spot
You ask Claude to generate a function, then ask the same conversation to review it. It says "looks good." Why? Because the author already holds its own reasoning in context — it agrees with itself.
This is same-session self-review, and it is a classic anti-pattern. The model that wrote the code will not genuinely challenge it; it rationalizes the choices it just made.
The fix is independent review: a fresh instance, with no memory of the generation, inspects the output cold. A fresh pair of eyes finds issues the author misses.
Why Fresh Beats Self
A same-session reviewer is biased by the generation context: the justifications, assumptions, and shortcuts it already committed to are still in the message history.
An independent instance receives only the artifact (and the rules), not the author's internal narrative. It evaluates what is actually there, not what the author intended.
- Author retains reasoning → won't dispute itself.
- Fresh instance → no sunk-cost loyalty → real scrutiny.
Rule of thumb: independent / fresh-instance review beats same-session self-review.
A Clean Review Request
To run an independent review, start a new request with fresh messages — do not append to the generation history. Pass only the artifact and explicit review criteria.
Notice: no prior assistant turns, no "here's why I wrote it this way." The reviewer sees the code as a stranger would.
import anthropic
client = anthropic.Anthropic()
# Fresh client call — NO generation history attached
review = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=2048,
system=(
"You are an independent reviewer. You did NOT write this code. "
"Flag a finding ONLY when the code violates a stated rule or "
"contradicts its own comments."
),
messages=[
{"role": "user", "content": f"Review this artifact:\n\n{artifact}"}
],
)Explicit Criteria, Not Vague Pleas
"Be more precise" tells the reviewer nothing. Explicit criteria beat vague instructions.
Give the reviewer concrete, testable rules so its findings are reproducible and low-noise:
- Vague: "review carefully."
- Explicit: "flag a comment ONLY when it contradicts the code."
Precise criteria are what separate a reviewer that surfaces real defects from one that floods you with style nitpicks and false positives.
system = (
"Independent code reviewer. Apply these rules exactly:\n"
"1. Flag a function that mutates its input without saying so.\n"
"2. Flag a comment ONLY when it contradicts the code it describes.\n"
"3. Flag any missing error handling on a network or file call.\n"
"Do NOT report style preferences. Report nothing if no rule is violated."
)Multi-Pass: One Lens at a Time
A single pass that tries to check everything at once dilutes attention — the model spreads thin and misses defects.
Better: run multiple focused passes, each with a narrow mandate. One pass for security, one for correctness, one for the public API contract. Each pass attends fully to its lens.
This is the same principle behind multi-pass code review: separating concerns sharpens the model's focus on each one.
Per-File, Then Cross-File
For a multi-file change, do NOT review every file in one giant single pass — that dilutes attention across files.
Use a two-stage structure:
- Local pass: review each file on its own for internal correctness.
- Integration pass: a separate pass over how the files fit together — call sites, shared types, contract mismatches.
Single-pass multi-file review is an anti-pattern. Per-file local passes plus a dedicated cross-file integration pass catch what either alone would miss.
passes = [
{"name": "local", "scope": "one file at a time",
"focus": "internal correctness, error handling"},
{"name": "integration", "scope": "all files together",
"focus": "call sites, shared types, contract drift"},
]
for p in passes:
run_independent_review(artifact=p["scope"], rules=p["focus"]) # fresh instance each passIndependent Review in CI/CD
In a pipeline, run the review in an isolated session — separate from whatever generated the change. The isolated reviewer is less biased by the generation context, so it produces fewer rubber-stamps and fewer false positives.
Use non-interactive mode and a parseable format so the pipeline can act on results.
# CI review step: non-interactive, isolated from any generation step
claude -p "Review the staged diff against .claude/rules/review.md. \
Report only rule violations as JSON." \
--output-format json \
> review-findings.json
# Gate the merge on the parsed findings
jq -e '.findings | length == 0' review-findings.jsonRe-Runs: Report Only What's New
Reviews iterate. When you re-run a review after the author fixes some findings, do not start blind — and do not re-report everything.
Include the prior results in the new run and instruct the reviewer to report only new or still-unfixed issues. This keeps each iteration signal-rich instead of repeating noise the team already triaged.
review = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=2048,
system=(
"Independent reviewer, iteration 2. You are given the prior findings. "
"Report ONLY issues that are new or still unfixed. "
"Do not repeat findings the author already resolved."
),
messages=[{"role": "user", "content":
f"PRIOR FINDINGS:\n{prior_findings}\n\nUPDATED ARTIFACT:\n{artifact}"}],
)Structured Findings, Not Prose
A wall of review prose is hard to gate on. Force the reviewer to emit structured output so the pipeline can route each finding deterministically.
Use tool_choice set to "any" to guarantee the model returns a tool call (structured JSON) rather than free text. Mark a field required ONLY if it is always present — never require an optional field, or the model will fabricate it.
review_tool = {
"name": "report_findings",
"description": "Return code-review findings as structured data.",
"input_schema": {
"type": "object",
"properties": {
"findings": {"type": "array", "items": {
"type": "object",
"properties": {
"severity": {"type": "string", "enum": ["high", "med", "low"]},
"file": {"type": "string"},
"rule": {"type": "string"},
},
"required": ["severity", "file", "rule"],
}}
},
"required": ["findings"],
},
}
resp = client.messages.create(
model="claude-sonnet-4-5", max_tokens=2048,
tools=[review_tool],
tool_choice={"type": "any"}, # must call a tool -> structured output
messages=[{"role": "user", "content": artifact}],
)Independent Review vs Retry-With-Feedback
Independent review is not the same as a validation retry. Know which tool fits which problem.
- Retry-with-feedback fixes format, structural, or arithmetic errors: send the original input, the wrong output, and the exact validation error so the model corrects itself.
- Independent review catches judgment defects: contradicted assumptions, missed edge cases, contract drift — things a validator can't express as a schema rule.
Neither helps when information is simply absent from the source. A retry can't conjure a value that was never there; a reviewer can only flag the gap.
Fresh Session vs Resumed Session
When you reopen a review, beware stale context. Resuming a named session with --resume brings back old tool results — but if the codebase changed since, those results may be stale and the review wrong.
Often a fresh session with a structured summary of the current state beats a resumed one. The fresh instance reads the code as it is now, with no outdated baggage — exactly the independence advantage that makes fresh review powerful.
# Resumed: fast, but tool results can be STALE if files changed
claude --resume code-review-pr-412
# Often better for review: fresh session + verbatim current-state summary
claude -p "$(cat current_state_summary.md)\n\nReview the diff below for rule violations."Quick Check
An architect has Claude generate a 6-file refactor. To validate it before merge, which review setup is strongest?
Recap: Independence Is the Edge
Key takeaways for multi-pass and independent review:
- Fresh beats self: independent / fresh-instance review beats same-session self-review — the author won't challenge its own reasoning.
- Run it isolated: in CI/CD, review in an isolated session for less bias and fewer false positives; use
-pand--output-format json. - Multi-pass: one lens per pass; for multi-file changes do per-file local passes THEN a separate cross-file integration pass. Single-pass multi-file dilutes attention.
- Explicit criteria ("flag X only when Y") beat vague ones.
- Re-runs: include prior results, report only new or unfixed issues.
- Right tool: retry-with-feedback fixes format/arithmetic errors; review catches judgment defects; neither invents absent info.
Domande Frequenti
La lezione «Più passaggi e revisione indipendente» è gratuita?
Sì — il testo completo di «Più passaggi e revisione indipendente» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Claude Architect, passa a CoddyKit PRO. Il corso Claude Architect include 4 lezioni in totale.
Cosa imparerò in «Più passaggi e revisione indipendente»?
Una nuova istanza trova problemi che l’autore non nota. Eserciti Claude Architect con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Claude Architect?
Non è richiesta alcuna esperienza precedente. Claude Architect su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Più passaggi e revisione indipendente»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Claude Architect?
Sì. Ogni lezione Claude Architect include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Quando il retry è utile (e quando non lo è)
- Prompt di retry con feedback
- Autocorrezione
- Più passaggi e revisione indipendente