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