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.
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## Hard gates (sequenced)
11
12Run these **in order**. Do not move to the next gate until its **pass** condition is met (objective evidence, not internal certainty).
13
141. **Read** — Open the file and read the **full** enclosing function, method, or type (not only the diff hunk).
15 **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.
16
172. **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.
18 **Pass:** Recorded outcome: match count or list, or explicit “zero matches in repo” *before* asserting unused.
19
203. **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.
21 **Pass:** One sentence naming where responsibility lives, or “checked caller + framework path; still missing” with which layer you checked.
22
234. **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.
24 **Pass:** Chosen label matches a bullet under that severity; otherwise downgrade, reclassify as Informational, or omit.
25
265. **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.
27 **Pass:** Every step satisfied or the finding was removed or downgraded.
28
29The checklist below expands these gates by issue type; use both.
30
31## Pre-Report Verification Checklist
32
33Before flagging ANY issue, verify:
34
35- [ ] **I read the actual code** - Not just the diff context, but the full function/class
36- [ ] **I searched for usages** - Before claiming "unused", searched all references
37- [ ] **I checked surrounding code** - The issue may be handled elsewhere (guards, earlier checks)
38- [ ] **I verified syntax against current docs** - Framework syntax evolves (Tailwind v4, TS 5.x, React 19)
39- [ ] **I distinguished "wrong" from "different style"** - Both approaches may be valid
40- [ ] **I considered intentional design** - Checked comments, CLAUDE.md, architectural context
41
42## Verification by Issue Type
43
44### "Unused Variable/Function"
45
46**Before flagging**, you MUST:
471. Search for ALL references in the codebase (grep/find)
482. Check if it's exported and used by external consumers
493. Check if it's used via reflection, decorators, or dynamic dispatch
504. Verify it's not a callback passed to a framework
51
52**Common false positives:**
53- State setters in React (may trigger re-renders even if value appears unused)
54- Variables used in templates/JSX
55- Exports used by consuming packages
56
57### "Missing Validation/Error Handling"
58
59**Before flagging**, you MUST:
601. Check if validation exists at a higher level (caller, middleware, route handler)
612. Check if the framework provides validation (Pydantic, Zod, TypeScript)
623. Verify the "missing" check isn't present in a different form
63
64**Common false positives:**
65- Framework already validates (FastAPI + Pydantic, React Hook Form)
66- Parent component validates before passing props
67- Error boundary catches at higher level
68
69### "Type Assertion/Unsafe Cast"
70
71**Before flagging**, you MUST:
721. Confirm it's actually an assertion, not an annotation
732. Check if the type is narrowed by runtime checks before the point
743. Verify if framework guarantees the type (loader data, form data)
75
76**Valid patterns often flagged incorrectly:**
77```go
78// Type assertion with ok check, NOT unsafe cast
79data, ok := value.(UserData)
80if !ok {
81 return fmt.Errorf("unexpected type: %T", value)
82}
83
84// Type switch is safe narrowing
85switch v := value.(type) {
86case User:
87 v.Name // Go knows this is User
88}
89```
90
91### "Potential Memory Leak/Race Condition"
92
93**Before flagging**, you MUST:
941. Verify cleanup function is actually missing (not just in a different location)
952. Check if AbortController signal is checked after awaits
963. Confirm the component can actually unmount during the async operation
97
98**Common false positives:**
99- Cleanup exists in useEffect return
100- Signal is checked (code reviewer missed it)
101- Operation completes before unmount is possible
102
103### "Performance Issue"
104
105**Before flagging**, you MUST:
1061. Confirm the code runs frequently enough to matter (render vs click handler)
1072. Verify the optimization would have measurable impact
1083. Check if the framework already optimizes this (React compiler, memoization)
109
110**Do NOT flag:**
111- Functions created in click handlers (runs once per click)
112- Array methods on small arrays (< 100 items)
113- Object creation in event handlers
114
115## Severity Calibration
116
117### Critical (Block Merge)
118
119**ONLY use for:**
120- Security vulnerabilities (injection, auth bypass, data exposure)
121- Data corruption bugs
122- Crash-causing bugs in happy path
123- Breaking changes to public APIs
124
125### Major (Should Fix)
126
127**Use for:**
128- Logic bugs that affect functionality
129- Missing error handling that causes poor UX
130- Performance issues with measurable impact
131- Accessibility violations
132
133### Minor (Consider Fixing)
134
135**Use for:**
136- Code clarity improvements
137- Documentation gaps
138- Inconsistent style (within reason)
139- Non-critical test coverage gaps
140
141### Informational (No Action Required)
142
143**Use for:**
144- Improvements that require adding new dependencies or modules
145- Suggestions for net-new code that didn't exist in the codebase before (new modules, test suites, abstractions)
146- Architectural ideas for future consideration
147- Test infrastructure suggestions (new mock libraries, behaviour extraction)
148- Optimizations without measurable impact in the current context
149
150**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.
151
152### Do NOT Flag At All
153
154- Style preferences where both approaches are valid
155- Optimizations with no measurable benefit
156- Test code not meeting production standards (intentionally simpler)
157- Library/framework internal code (shadcn components, generated code)
158- Hypothetical issues that require unlikely conditions
159
160## Valid Patterns (Do NOT Flag)
161
162### Go
163
164| Pattern | Why It's Valid |
165|---------|----------------|
166| `val, ok := map[key]` | Comma-ok idiom, standard for maps |
167| Returning `error` as last return value | Go error handling convention |
168| `defer` for cleanup | Correct resource management pattern |
169| Short variable names in small scope | Idiomatic Go (e.g., `i`, `err`, `ctx`) |
170| `interface{}` / `any` in generic code | Valid for truly heterogeneous data |
171
172### Concurrency
173
174| Pattern | Why It's Valid |
175|---------|----------------|
176| Unbuffered channel for synchronization | Correct when goroutines must synchronize |
177| `select` with `default` | Non-blocking channel operation, intentional |
178| `sync.Once` for initialization | Thread-safe lazy init pattern |
179| `context.Background()` in main/tests | Valid root context for top-level calls |
180| Goroutine without explicit join | Valid for fire-and-forget with proper lifecycle management |
181
182### Testing
183
184| Pattern | Why It's Valid |
185|---------|----------------|
186| Table-driven tests | Standard Go testing pattern |
187| `t.Helper()` in test utilities | Correct for accurate error line reporting |
188| `testify/assert` alongside stdlib | Common and acceptable in Go projects |
189| Test function names without `_` | `TestFooBar` is idiomatic Go |
190
191### General
192
193| Pattern | Why It's Valid |
194|---------|----------------|
195| `+?` lazy quantifier in regex | Prevents over-matching, correct for many patterns |
196| Direct string concatenation | Simpler than template literals for simple cases |
197| Multiple returns in function | Can improve readability |
198| Comments explaining "why" | Better than no comments |
199
200## Context-Sensitive Rules
201
202### Error Handling
203
204Flag unchecked error **ONLY IF ALL** of these are true:
205- [ ] Error return is explicitly ignored (not `_`)
206- [ ] Function can return meaningful errors (not just `Close()`)
207- [ ] Not in test code or example code
208- [ ] Error would indicate a real problem, not a benign condition
209
210### Goroutine Lifecycle
211
212Flag goroutine leak **ONLY IF**:
213- [ ] No context cancellation controls the goroutine
214- [ ] No channel or WaitGroup provides shutdown signal
215- [ ] Goroutine can outlive its parent scope
216- [ ] Not a top-level server goroutine managed by the runtime
217
218### Interface Design
219
220Flag missing interface **ONLY IF**:
221- [ ] Concrete type is used across package boundaries
222- [ ] Testing requires mocking the dependency
223- [ ] Multiple implementations exist or are planned
224- [ ] Not a simple data struct (interfaces for behavior, not data)
225
226## Before Submitting Review
227
228Final verification:
2291. Re-read each finding and ask: "Did I verify this is actually an issue?"
2302. For each finding, can you point to the specific line that proves the issue exists?
2313. Would a domain expert agree this is a problem, or is it a style preference?
2324. Does fixing this provide real value, or is it busywork?
2335. Format every finding as: `[FILE:LINE] ISSUE_TITLE`
2346. 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.
2357. If this is a re-review: ONLY verify previous fixes. Do not introduce new findings.
236
237If uncertain about any finding, either:
238- Remove it from the review
239- Mark it as a question rather than an issue
240- Verify by reading more code context