Review Verification Protocol
This protocol MUST be followed before reporting any code review finding. Skipping these steps leads to false positives that waste developer time and erode trust in reviews.
Anti-confabulation (gate 0 — runs before every other gate)
Before issuing any verdict — flag, reject, or downgrade a finding — you MUST echo the exact artifact you are judging, quoted from a source you read in this turn:
- For a code finding: the file:line plus the cited code, read freshly now (not recalled from earlier in the session).
- For a diff review: the actual diff hunk under review.
The artifact is the only source of truth. Never infer what you are reviewing from the branch name, the working directory, surrounding files, or recollection. If your mental model differs from the freshly read source, the source wins. A verdict issued without a same-turn echo of its target is invalid — emit the echo first, or do not emit the verdict.
This gate exists because an LLM under contextual priming will confidently flag code that is not in the file. It runs before the hard gates below.
Hard gates (sequenced)
Run these in order. Do not move to the next gate until its pass condition is met (objective evidence, not internal certainty).
Read — Open the file and read the full enclosing function, method, or type (not only the diff hunk).
Pass: You can name the symbol and cite at least one line outside the changed lines that shows control flow, scope, or use relevant to the finding.
Reference (required before any “unused”, “dead code”, or “never called” claim) — Search the workspace for the identifier and for imports/exports that could reference it.
Pass: Recorded outcome: match count or list, or explicit “zero matches in repo” before asserting unused.
Upstream (required before “missing validation” or “missing error handling”) — Inspect the immediate caller, route/middleware, or documented framework behavior that might already enforce the rule.
Pass: One sentence naming where responsibility lives, or “checked caller + framework path; still missing” with which layer you checked.
Severity — Before assigning Critical or Major, map the issue to Severity Calibration and exclude style-only or Informational items.
Pass: Chosen label matches a bullet under that severity; otherwise downgrade, reclassify as Informational, or omit.
Submit — Each retained finding uses [FILE:LINE] plus a one-line proof; complete Before Submitting Review steps 1–7 for this review.
Pass: Every step satisfied or the finding was removed or downgraded.
The checklist below expands these gates by issue type; use both.
Pre-Report Verification Checklist
Before flagging ANY issue, verify:
Verification by Issue Type
"Unused Variable/Function"
Before flagging, you MUST:
- Search for ALL references in the codebase (grep/find)
- Check if it's exported and used by external consumers
- Check if it's used via reflection, decorators, or dynamic dispatch
- Verify it's not a callback passed to a framework
Common false positives:
- State setters in React (may trigger re-renders even if value appears unused)
- Variables used in templates/JSX
- Exports used by consuming packages
"Missing Validation/Error Handling"
Before flagging, you MUST:
- Check if validation exists at a higher level (caller, middleware, route handler)
- Check if the framework provides validation (Pydantic, Zod, TypeScript)
- Verify the "missing" check isn't present in a different form
Common false positives:
- Framework already validates (FastAPI + Pydantic, React Hook Form)
- Parent component validates before passing props
- Error boundary catches at higher level
"Type Assertion/Unsafe Cast"
Before flagging, you MUST:
- Confirm it's actually an assertion, not an annotation
- Check if the type is narrowed by runtime checks before the point
- Verify if framework guarantees the type (loader data, form data)
Valid patterns often flagged incorrectly:
// Type assertion with ok check, NOT unsafe cast
data, ok := value.(UserData)
if !ok {
return fmt.Errorf("unexpected type: %T", value)
}
// Type switch is safe narrowing
switch v := value.(type) {
case User:
v.Name // Go knows this is User
}
"Potential Memory Leak/Race Condition"
Before flagging, you MUST:
- Verify cleanup function is actually missing (not just in a different location)
- Check if AbortController signal is checked after awaits
- Confirm the component can actually unmount during the async operation
Common false positives:
- Cleanup exists in useEffect return
- Signal is checked (code reviewer missed it)
- Operation completes before unmount is possible
"Performance Issue"
Before flagging, you MUST:
- Confirm the code runs frequently enough to matter (render vs click handler)
- Verify the optimization would have measurable impact
- Check if the framework already optimizes this (React compiler, memoization)
Do NOT flag:
- Functions created in click handlers (runs once per click)
- Array methods on small arrays (< 100 items)
- Object creation in event handlers
Severity Calibration
Critical (Block Merge)
ONLY use for:
- Security vulnerabilities (injection, auth bypass, data exposure)
- Data corruption bugs
- Crash-causing bugs in happy path
- Breaking changes to public APIs
Major (Should Fix)
Use for:
- Logic bugs that affect functionality
- Missing error handling that causes poor UX
- Performance issues with measurable impact
- Accessibility violations
Minor (Consider Fixing)
Use for:
- Code clarity improvements
- Documentation gaps
- Inconsistent style (within reason)
- Non-critical test coverage gaps
Informational (No Action Required)
Use for:
- Improvements that require adding new dependencies or modules
- Suggestions for net-new code that didn't exist in the codebase before (new modules, test suites, abstractions)
- Architectural ideas for future consideration
- Test infrastructure suggestions (new mock libraries, behaviour extraction)
- Optimizations without measurable impact in the current context
These are NOT review blockers. They should be noted for the author's awareness but must not appear in the actionable issue count. The Verdict should ignore informational items entirely.
Do NOT Flag At All
- Style preferences where both approaches are valid
- Optimizations with no measurable benefit
- Test code not meeting production standards (intentionally simpler)
- Library/framework internal code (shadcn components, generated code)
- Hypothetical issues that require unlikely conditions
Valid Patterns (Do NOT Flag)
Go
| Pattern |
Why It's Valid |
val, ok := map[key] |
Comma-ok idiom, standard for maps |
Returning error as last return value |
Go error handling convention |
defer for cleanup |
Correct resource management pattern |
| Short variable names in small scope |
Idiomatic Go (e.g., i, err, ctx) |
interface{} / any in generic code |
Valid for truly heterogeneous data |
Concurrency
| Pattern |
Why It's Valid |
| Unbuffered channel for synchronization |
Correct when goroutines must synchronize |
select with default |
Non-blocking channel operation, intentional |
sync.Once for initialization |
Thread-safe lazy init pattern |
context.Background() in main/tests |
Valid root context for top-level calls |
| Goroutine without explicit join |
Valid for fire-and-forget with proper lifecycle management |
Testing
| Pattern |
Why It's Valid |
| Table-driven tests |
Standard Go testing pattern |
t.Helper() in test utilities |
Correct for accurate error line reporting |
testify/assert alongside stdlib |
Common and acceptable in Go projects |
Test function names without _ |
TestFooBar is idiomatic Go |
General
| Pattern |
Why It's Valid |
+? lazy quantifier in regex |
Prevents over-matching, correct for many patterns |
| Direct string concatenation |
Simpler than template literals for simple cases |
| Multiple returns in function |
Can improve readability |
| Comments explaining "why" |
Better than no comments |
Context-Sensitive Rules
Error Handling
Flag unchecked error ONLY IF ALL of these are true:
Goroutine Lifecycle
Flag goroutine leak ONLY IF:
Interface Design
Flag missing interface ONLY IF:
Before Submitting Review
Final verification:
- Re-read each finding and ask: "Did I verify this is actually an issue?"
- For each finding, can you point to the specific line that proves the issue exists?
- Would a domain expert agree this is a problem, or is it a style preference?
- Does fixing this provide real value, or is it busywork?
- Format every finding as:
[FILE:LINE] ISSUE_TITLE
- For each finding, ask: "Does this fix existing code, or does it request entirely new code that didn't exist before?" If the latter, downgrade to Informational.
- If this is a re-review: ONLY verify previous fixes. Do not introduce new findings.
If uncertain about any finding, either:
- Remove it from the review
- Mark it as a question rather than an issue
- Verify by reading more code context
1---2name: review-verification-protocol3description: Mandatory verification steps for all code reviews to reduce false positives. Load this skill before reporting ANY code review findings.4---5
6# Review Verification Protocol
7
8This protocol MUST be followed before reporting any code review finding. Skipping these steps leads to false positives that waste developer time and erode trust in reviews.
9
10## Anti-confabulation (gate 0 — runs before every other gate)
11
12Before issuing **any** verdict — flag, reject, or downgrade a finding — you MUST echo the exact artifact you are judging, quoted from a source you read in **this** turn:
13
14- For a code finding: the **file:line** plus the cited code, read freshly now (not recalled from earlier in the session).
15- For a diff review: the actual **diff hunk** under review.
16
17> The artifact is the only source of truth. **Never** infer what you are reviewing from the branch name, the working directory, surrounding files, or recollection. If your mental model differs from the freshly read source, **the source wins.** A verdict issued without a same-turn echo of its target is invalid — emit the echo first, or do not emit the verdict.
18
19This gate exists because an LLM under contextual priming will confidently flag code that is not in the file. It runs **before** the hard gates below.
20
21## Hard gates (sequenced)
22
23Run these **in order**. Do not move to the next gate until its **pass** condition is met (objective evidence, not internal certainty).
24
251. **Read** — Open the file and read the **full** enclosing function, method, or type (not only the diff hunk).
26 **Pass:** You can name the symbol and cite at least one line **outside** the changed lines that shows control flow, scope, or use relevant to the finding.
27
282. **Reference** (required before any “unused”, “dead code”, or “never called” claim) — Search the workspace for the identifier and for imports/exports that could reference it.
29 **Pass:** Recorded outcome: match count or list, or explicit “zero matches in repo” *before* asserting unused.
30
313. **Upstream** (required before “missing validation” or “missing error handling”) — Inspect the immediate caller, route/middleware, or documented framework behavior that might already enforce the rule.
32 **Pass:** One sentence naming where responsibility lives, or “checked caller + framework path; still missing” with which layer you checked.
33
344. **Severity** — Before assigning Critical or Major, map the issue to [Severity Calibration](#severity-calibration) and exclude style-only or [Informational](#informational-no-action-required) items.
35 **Pass:** Chosen label matches a bullet under that severity; otherwise downgrade, reclassify as Informational, or omit.
36
375. **Submit** — Each retained finding uses `[FILE:LINE]` plus a one-line proof; complete [Before Submitting Review](#before-submitting-review) steps 1–7 for this review.
38 **Pass:** Every step satisfied or the finding was removed or downgraded.
39
40The checklist below expands these gates by issue type; use both.
41
42## Pre-Report Verification Checklist
43
44Before flagging ANY issue, verify:
45
46- [ ] **I read the actual code** - Not just the diff context, but the full function/class
47- [ ] **I searched for usages** - Before claiming "unused", searched all references
48- [ ] **I checked surrounding code** - The issue may be handled elsewhere (guards, earlier checks)
49- [ ] **I verified syntax against current docs** - Framework syntax evolves (Tailwind v4, TS 5.x, React 19)
50- [ ] **I distinguished "wrong" from "different style"** - Both approaches may be valid
51- [ ] **I considered intentional design** - Checked comments, project conventions (e.g. AGENTS.md or CLAUDE.md), architectural context
52
53## Verification by Issue Type
54
55### "Unused Variable/Function"
56
57**Before flagging**, you MUST:
581. Search for ALL references in the codebase (grep/find)
592. Check if it's exported and used by external consumers
603. Check if it's used via reflection, decorators, or dynamic dispatch
614. Verify it's not a callback passed to a framework
62
63**Common false positives:**
64- State setters in React (may trigger re-renders even if value appears unused)
65- Variables used in templates/JSX
66- Exports used by consuming packages
67
68### "Missing Validation/Error Handling"
69
70**Before flagging**, you MUST:
711. Check if validation exists at a higher level (caller, middleware, route handler)
722. Check if the framework provides validation (Pydantic, Zod, TypeScript)
733. Verify the "missing" check isn't present in a different form
74
75**Common false positives:**
76- Framework already validates (FastAPI + Pydantic, React Hook Form)
77- Parent component validates before passing props
78- Error boundary catches at higher level
79
80### "Type Assertion/Unsafe Cast"
81
82**Before flagging**, you MUST:
831. Confirm it's actually an assertion, not an annotation
842. Check if the type is narrowed by runtime checks before the point
853. Verify if framework guarantees the type (loader data, form data)
86
87**Valid patterns often flagged incorrectly:**
88```go
89// Type assertion with ok check, NOT unsafe cast
90data, ok := value.(UserData)
91if !ok {
92 return fmt.Errorf("unexpected type: %T", value)
93}
94
95// Type switch is safe narrowing
96switch v := value.(type) {
97case User:
98 v.Name // Go knows this is User
99}
100```
101
102### "Potential Memory Leak/Race Condition"
103
104**Before flagging**, you MUST:
1051. Verify cleanup function is actually missing (not just in a different location)
1062. Check if AbortController signal is checked after awaits
1073. Confirm the component can actually unmount during the async operation
108
109**Common false positives:**
110- Cleanup exists in useEffect return
111- Signal is checked (code reviewer missed it)
112- Operation completes before unmount is possible
113
114### "Performance Issue"
115
116**Before flagging**, you MUST:
1171. Confirm the code runs frequently enough to matter (render vs click handler)
1182. Verify the optimization would have measurable impact
1193. Check if the framework already optimizes this (React compiler, memoization)
120
121**Do NOT flag:**
122- Functions created in click handlers (runs once per click)
123- Array methods on small arrays (< 100 items)
124- Object creation in event handlers
125
126## Severity Calibration
127
128### Critical (Block Merge)
129
130**ONLY use for:**
131- Security vulnerabilities (injection, auth bypass, data exposure)
132- Data corruption bugs
133- Crash-causing bugs in happy path
134- Breaking changes to public APIs
135
136### Major (Should Fix)
137
138**Use for:**
139- Logic bugs that affect functionality
140- Missing error handling that causes poor UX
141- Performance issues with measurable impact
142- Accessibility violations
143
144### Minor (Consider Fixing)
145
146**Use for:**
147- Code clarity improvements
148- Documentation gaps
149- Inconsistent style (within reason)
150- Non-critical test coverage gaps
151
152### Informational (No Action Required)
153
154**Use for:**
155- Improvements that require adding new dependencies or modules
156- Suggestions for net-new code that didn't exist in the codebase before (new modules, test suites, abstractions)
157- Architectural ideas for future consideration
158- Test infrastructure suggestions (new mock libraries, behaviour extraction)
159- Optimizations without measurable impact in the current context
160
161**These are NOT review blockers.** They should be noted for the author's awareness but must not appear in the actionable issue count. The Verdict should ignore informational items entirely.
162
163### Do NOT Flag At All
164
165- Style preferences where both approaches are valid
166- Optimizations with no measurable benefit
167- Test code not meeting production standards (intentionally simpler)
168- Library/framework internal code (shadcn components, generated code)
169- Hypothetical issues that require unlikely conditions
170
171## Valid Patterns (Do NOT Flag)
172
173### Go
174
175| Pattern | Why It's Valid |
176|---------|----------------|
177| `val, ok := map[key]` | Comma-ok idiom, standard for maps |
178| Returning `error` as last return value | Go error handling convention |
179| `defer` for cleanup | Correct resource management pattern |
180| Short variable names in small scope | Idiomatic Go (e.g., `i`, `err`, `ctx`) |
181| `interface{}` / `any` in generic code | Valid for truly heterogeneous data |
182
183### Concurrency
184
185| Pattern | Why It's Valid |
186|---------|----------------|
187| Unbuffered channel for synchronization | Correct when goroutines must synchronize |
188| `select` with `default` | Non-blocking channel operation, intentional |
189| `sync.Once` for initialization | Thread-safe lazy init pattern |
190| `context.Background()` in main/tests | Valid root context for top-level calls |
191| Goroutine without explicit join | Valid for fire-and-forget with proper lifecycle management |
192
193### Testing
194
195| Pattern | Why It's Valid |
196|---------|----------------|
197| Table-driven tests | Standard Go testing pattern |
198| `t.Helper()` in test utilities | Correct for accurate error line reporting |
199| `testify/assert` alongside stdlib | Common and acceptable in Go projects |
200| Test function names without `_` | `TestFooBar` is idiomatic Go |
201
202### General
203
204| Pattern | Why It's Valid |
205|---------|----------------|
206| `+?` lazy quantifier in regex | Prevents over-matching, correct for many patterns |
207| Direct string concatenation | Simpler than template literals for simple cases |
208| Multiple returns in function | Can improve readability |
209| Comments explaining "why" | Better than no comments |
210
211## Context-Sensitive Rules
212
213### Error Handling
214
215Flag unchecked error **ONLY IF ALL** of these are true:
216- [ ] Error return is explicitly ignored (not `_`)
217- [ ] Function can return meaningful errors (not just `Close()`)
218- [ ] Not in test code or example code
219- [ ] Error would indicate a real problem, not a benign condition
220
221### Goroutine Lifecycle
222
223Flag goroutine leak **ONLY IF**:
224- [ ] No context cancellation controls the goroutine
225- [ ] No channel or WaitGroup provides shutdown signal
226- [ ] Goroutine can outlive its parent scope
227- [ ] Not a top-level server goroutine managed by the runtime
228
229### Interface Design
230
231Flag missing interface **ONLY IF**:
232- [ ] Concrete type is used across package boundaries
233- [ ] Testing requires mocking the dependency
234- [ ] Multiple implementations exist or are planned
235- [ ] Not a simple data struct (interfaces for behavior, not data)
236
237## Before Submitting Review
238
239Final verification:
2401. Re-read each finding and ask: "Did I verify this is actually an issue?"
2412. For each finding, can you point to the specific line that proves the issue exists?
2423. Would a domain expert agree this is a problem, or is it a style preference?
2434. Does fixing this provide real value, or is it busywork?
2445. Format every finding as: `[FILE:LINE] ISSUE_TITLE`
2456. For each finding, ask: "Does this fix existing code, or does it request entirely new code that didn't exist before?" If the latter, downgrade to Informational.
2467. If this is a re-review: ONLY verify previous fixes. Do not introduce new findings.
247
248If uncertain about any finding, either:
249- Remove it from the review
250- Mark it as a question rather than an issue
251- Verify by reading more code context