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)
Complete in order for each finding (or once per batch if every finding shares the same file/symbol). Do not advance while the prior gate fails.
Read gate — Open and read the full containing symbol (function, class, component, hook), not only the diff hunk or snippet.
Pass: You can state the file path and symbol name you read without re-opening the file.
Reference gate (required before “unused”, “dead code”, or “never called”) — Run a workspace search for the identifier (or equivalent: find references in the IDE).
Pass: One concrete artifact: e.g. “rg/search: N matches” or “only the definition in path” — not a guess.
Mitigation gate — Look for handling elsewhere: callers, middleware, route/loaders, error boundaries, framework validation, earlier guards, or comments/ADR context.
Pass: Either cite where the concern is already addressed, or one explicit sentence: “No mitigating pattern found after checking [scope].”
Claim gate — Each reported issue must include [FILE:LINE] and a specific line or behavior that demonstrates the problem; severity must match Severity Calibration below.
Pass: A reviewer could navigate to that line and see the same issue; “might” or “could” without an anchor fails this gate.
The checklist below restates the same expectations in checkbox form.
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 annotation, NOT assertion
const data: UserData = await loader()
// Type narrowing makes this safe
if (isUser(data)) {
data.name // TypeScript 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)
TypeScript
| Pattern |
Why It's Valid |
map.get(key) || [] |
Map.get() returns T | undefined, fallback is correct |
| Class exports without separate type export |
Classes work as both value and type |
as const on literal arrays |
Creates readonly tuple types |
| Type annotation on variable declaration |
Not a type assertion |
satisfies instead of as |
Type checking without assertion |
React
| Pattern |
Why It's Valid |
| Array index as key (static list) |
Valid when: items don't reorder, list is static, no item identity needed |
| Inline arrow in onClick |
Valid for non-performance-critical handlers (runs once per click) |
| State that appears unused |
May be set via refs, external callbacks, or triggers re-renders |
| Empty dependency array with refs |
Refs are stable, don't need to be dependencies |
| Non-null assertion after check |
TypeScript narrowing may not track through all patterns |
Testing
| Pattern |
Why It's Valid |
toHaveTextContent without regex |
Handles nested text correctly |
| Mock at module level |
Defined once, not duplicated |
| Index-based test data |
Tests don't need stable identity |
| Simplified error messages |
Test clarity over production polish |
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
React Keys
Flag array index as key ONLY IF ALL of these are true:
useEffect Dependencies
Flag missing dependency ONLY IF:
Error Handling
Flag missing try/catch ONLY IF:
Before Submitting Review
Final verification (after Hard gates for each finding):
- 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? (must satisfy Claim gate)
- 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-protocol-63description: 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
12Complete **in order** for each finding (or once per batch if every finding shares the same file/symbol). Do not advance while the prior gate fails.
13
141. **Read gate** — Open and read the **full** containing symbol (function, class, component, hook), not only the diff hunk or snippet.
15 **Pass:** You can state the **file path** and **symbol name** you read without re-opening the file.
16
172. **Reference gate** (required before “unused”, “dead code”, or “never called”) — Run a workspace search for the identifier (or equivalent: find references in the IDE).
18 **Pass:** One concrete artifact: e.g. “`rg`/search: N matches” or “only the definition in `path`” — not a guess.
19
203. **Mitigation gate** — Look for handling elsewhere: callers, middleware, route/loaders, error boundaries, framework validation, earlier guards, or comments/ADR context.
21 **Pass:** Either cite **where** the concern is already addressed, or one explicit sentence: “No mitigating pattern found after checking [scope].”
22
234. **Claim gate** — Each reported issue must include **`[FILE:LINE]`** and a **specific line or behavior** that demonstrates the problem; severity must match [Severity Calibration](#severity-calibration) below.
24 **Pass:** A reviewer could navigate to that line and see the same issue; “might” or “could” without an anchor fails this gate.
25
26The checklist below restates the same expectations in checkbox form.
27
28## Pre-Report Verification Checklist
29
30Before flagging ANY issue, verify:
31
32- [ ] **I read the actual code** - Not just the diff context, but the full function/class (see **Read gate**)
33- [ ] **I searched for usages** - Before claiming "unused", searched all references (see **Reference gate**)
34- [ ] **I checked surrounding code** - The issue may be handled elsewhere (guards, earlier checks) (see **Mitigation gate**)
35- [ ] **I verified syntax against current docs** - Framework syntax evolves (Tailwind v4, TS 5.x, React 19)
36- [ ] **I distinguished "wrong" from "different style"** - Both approaches may be valid
37- [ ] **I considered intentional design** - Checked comments, CLAUDE.md, architectural context
38
39## Verification by Issue Type
40
41### "Unused Variable/Function"
42
43**Before flagging**, you MUST:
441. Search for ALL references in the codebase (grep/find)
452. Check if it's exported and used by external consumers
463. Check if it's used via reflection, decorators, or dynamic dispatch
474. Verify it's not a callback passed to a framework
48
49**Common false positives:**
50- State setters in React (may trigger re-renders even if value appears unused)
51- Variables used in templates/JSX
52- Exports used by consuming packages
53
54### "Missing Validation/Error Handling"
55
56**Before flagging**, you MUST:
571. Check if validation exists at a higher level (caller, middleware, route handler)
582. Check if the framework provides validation (Pydantic, Zod, TypeScript)
593. Verify the "missing" check isn't present in a different form
60
61**Common false positives:**
62- Framework already validates (FastAPI + Pydantic, React Hook Form)
63- Parent component validates before passing props
64- Error boundary catches at higher level
65
66### "Type Assertion/Unsafe Cast"
67
68**Before flagging**, you MUST:
691. Confirm it's actually an assertion, not an annotation
702. Check if the type is narrowed by runtime checks before the point
713. Verify if framework guarantees the type (loader data, form data)
72
73**Valid patterns often flagged incorrectly:**
74```typescript
75// Type annotation, NOT assertion
76const data: UserData = await loader()
77
78// Type narrowing makes this safe
79if (isUser(data)) {
80 data.name // TypeScript knows this is User
81}
82```
83
84### "Potential Memory Leak/Race Condition"
85
86**Before flagging**, you MUST:
871. Verify cleanup function is actually missing (not just in a different location)
882. Check if AbortController signal is checked after awaits
893. Confirm the component can actually unmount during the async operation
90
91**Common false positives:**
92- Cleanup exists in useEffect return
93- Signal is checked (code reviewer missed it)
94- Operation completes before unmount is possible
95
96### "Performance Issue"
97
98**Before flagging**, you MUST:
991. Confirm the code runs frequently enough to matter (render vs click handler)
1002. Verify the optimization would have measurable impact
1013. Check if the framework already optimizes this (React compiler, memoization)
102
103**Do NOT flag:**
104- Functions created in click handlers (runs once per click)
105- Array methods on small arrays (< 100 items)
106- Object creation in event handlers
107
108## Severity Calibration
109
110### Critical (Block Merge)
111
112**ONLY use for:**
113- Security vulnerabilities (injection, auth bypass, data exposure)
114- Data corruption bugs
115- Crash-causing bugs in happy path
116- Breaking changes to public APIs
117
118### Major (Should Fix)
119
120**Use for:**
121- Logic bugs that affect functionality
122- Missing error handling that causes poor UX
123- Performance issues with measurable impact
124- Accessibility violations
125
126### Minor (Consider Fixing)
127
128**Use for:**
129- Code clarity improvements
130- Documentation gaps
131- Inconsistent style (within reason)
132- Non-critical test coverage gaps
133
134### Informational (No Action Required)
135
136**Use for:**
137- Improvements that require adding new dependencies or modules
138- Suggestions for net-new code that didn't exist in the codebase before (new modules, test suites, abstractions)
139- Architectural ideas for future consideration
140- Test infrastructure suggestions (new mock libraries, behaviour extraction)
141- Optimizations without measurable impact in the current context
142
143**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.
144
145### Do NOT Flag At All
146
147- Style preferences where both approaches are valid
148- Optimizations with no measurable benefit
149- Test code not meeting production standards (intentionally simpler)
150- Library/framework internal code (shadcn components, generated code)
151- Hypothetical issues that require unlikely conditions
152
153## Valid Patterns (Do NOT Flag)
154
155### TypeScript
156
157| Pattern | Why It's Valid |
158|---------|----------------|
159| `map.get(key) \|\| []` | `Map.get()` returns `T \| undefined`, fallback is correct |
160| Class exports without separate type export | Classes work as both value and type |
161| `as const` on literal arrays | Creates readonly tuple types |
162| Type annotation on variable declaration | Not a type assertion |
163| `satisfies` instead of `as` | Type checking without assertion |
164
165### React
166
167| Pattern | Why It's Valid |
168|---------|----------------|
169| Array index as key (static list) | Valid when: items don't reorder, list is static, no item identity needed |
170| Inline arrow in onClick | Valid for non-performance-critical handlers (runs once per click) |
171| State that appears unused | May be set via refs, external callbacks, or triggers re-renders |
172| Empty dependency array with refs | Refs are stable, don't need to be dependencies |
173| Non-null assertion after check | TypeScript narrowing may not track through all patterns |
174
175### Testing
176
177| Pattern | Why It's Valid |
178|---------|----------------|
179| `toHaveTextContent` without regex | Handles nested text correctly |
180| Mock at module level | Defined once, not duplicated |
181| Index-based test data | Tests don't need stable identity |
182| Simplified error messages | Test clarity over production polish |
183
184### General
185
186| Pattern | Why It's Valid |
187|---------|----------------|
188| `+?` lazy quantifier in regex | Prevents over-matching, correct for many patterns |
189| Direct string concatenation | Simpler than template literals for simple cases |
190| Multiple returns in function | Can improve readability |
191| Comments explaining "why" | Better than no comments |
192
193## Context-Sensitive Rules
194
195### React Keys
196
197Flag array index as key **ONLY IF ALL** of these are true:
198- [ ] Items CAN be reordered (sortable list, drag-drop)
199- [ ] Items CAN be inserted/removed from middle
200- [ ] Items HAVE stable identifiers available (id, uuid)
201- [ ] The list is NOT completely replaced atomically
202
203### useEffect Dependencies
204
205Flag missing dependency **ONLY IF**:
206- [ ] The value actually changes during component lifetime
207- [ ] Stale closure would cause incorrect behavior
208- [ ] The value is NOT a ref (refs are stable)
209- [ ] The value is NOT a stable callback (useCallback with empty deps)
210
211### Error Handling
212
213Flag missing try/catch **ONLY IF**:
214- [ ] No error boundary catches this at a higher level
215- [ ] The framework doesn't handle errors (loader errorElement)
216- [ ] The error would cause a crash, not just a failed operation
217- [ ] User needs specific feedback for this error type
218
219## Before Submitting Review
220
221Final verification (after [Hard gates](#hard-gates-sequenced) for each finding):
222
2231. Re-read each finding and ask: "Did I verify this is actually an issue?"
2242. For each finding, can you point to the **specific line** that proves the issue exists? (must satisfy **Claim gate**)
2253. Would a domain expert agree this is a problem, or is it a style preference?
2264. Does fixing this provide real value, or is it busywork?
2275. Format every finding as: `[FILE:LINE] ISSUE_TITLE`
2286. 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.
2297. If this is a re-review: ONLY verify previous fixes. Do not introduce new findings.
230
231If uncertain about any finding, either:
232- Remove it from the review
233- Mark it as a question rather than an issue
234- Verify by reading more code context