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:
# Pattern matching, NOT type casting
%UserData{} = data = load_user()
# Guard clauses narrow the type safely
def process(%User{name: name} = user) do
name # Elixir knows this is a User struct
end
"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)
Elixir
| Pattern |
Why It's Valid |
case with multiple clauses |
Standard pattern matching, not excessive branching |
with chains |
Idiomatic for sequential operations that may fail |
Pipe operator (|>) chains |
Elixir's core composition pattern |
@spec without Dialyzer enforcement |
Documentation value even without static analysis |
defp private functions |
Proper encapsulation, not hidden complexity |
Phoenix/LiveView
| Pattern |
Why It's Valid |
assign/2 in mount/3 |
Standard LiveView state initialization |
handle_event/3 returning {:noreply, socket} |
Correct for UI-triggered state updates |
~H sigil for inline templates |
Valid for small components |
on_mount hooks |
Correct lifecycle pattern for auth/setup |
| PubSub broadcasts in handle_info |
Standard real-time communication pattern |
Testing
| Pattern |
Why It's Valid |
assert without message |
ExUnit provides clear diff output |
setup block for test context |
Standard ExUnit fixture pattern |
describe blocks for grouping |
Idiomatic test organization |
conn pipeline in controller tests |
Phoenix test helper convention |
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
Pattern Matching
Flag missing pattern match ONLY IF ALL of these are true:
Process Architecture
Flag missing supervision ONLY IF:
Error Handling
Flag missing error handling 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-33description: 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```elixir
57# Pattern matching, NOT type casting
58%UserData{} = data = load_user()
59
60# Guard clauses narrow the type safely
61def process(%User{name: name} = user) do
62 name # Elixir knows this is a User struct
63end
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### Elixir
138
139| Pattern | Why It's Valid |
140|---------|----------------|
141| `case` with multiple clauses | Standard pattern matching, not excessive branching |
142| `with` chains | Idiomatic for sequential operations that may fail |
143| Pipe operator (`\|>`) chains | Elixir's core composition pattern |
144| `@spec` without Dialyzer enforcement | Documentation value even without static analysis |
145| `defp` private functions | Proper encapsulation, not hidden complexity |
146
147### Phoenix/LiveView
148
149| Pattern | Why It's Valid |
150|---------|----------------|
151| `assign/2` in `mount/3` | Standard LiveView state initialization |
152| `handle_event/3` returning `{:noreply, socket}` | Correct for UI-triggered state updates |
153| `~H` sigil for inline templates | Valid for small components |
154| `on_mount` hooks | Correct lifecycle pattern for auth/setup |
155| PubSub broadcasts in handle_info | Standard real-time communication pattern |
156
157### Testing
158
159| Pattern | Why It's Valid |
160|---------|----------------|
161| `assert` without message | ExUnit provides clear diff output |
162| `setup` block for test context | Standard ExUnit fixture pattern |
163| `describe` blocks for grouping | Idiomatic test organization |
164| `conn` pipeline in controller tests | Phoenix test helper convention |
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### Pattern Matching
178
179Flag missing pattern match **ONLY IF ALL** of these are true:
180- [ ] Function receives structured data that should be destructured
181- [ ] Not a pass-through function that forwards data unchanged
182- [ ] Pattern match would prevent actual runtime errors
183- [ ] Not a GenServer callback with standard signature
184
185### Process Architecture
186
187Flag missing supervision **ONLY IF**:
188- [ ] Process is long-lived (not a Task)
189- [ ] Crash would affect system stability
190- [ ] No supervisor already manages this process
191- [ ] Not a test-only process
192
193### Error Handling
194
195Flag missing error handling **ONLY IF**:
196- [ ] No `with` clause handles the error case
197- [ ] No supervision tree restarts the process
198- [ ] The error would cascade beyond the current process
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