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 forced unwrap
let data: UserData = await loader()
// Type narrowing makes this safe
if let user = data as? User {
user.name // Swift 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)
Swift
| Pattern |
Why It's Valid |
guard let early return |
Standard Swift pattern for unwrapping, not excessive nesting |
weak self in closures |
Required for breaking retain cycles, not unnecessary |
@State / @Binding property wrappers |
SwiftUI state management primitives |
Optional chaining (foo?.bar?.baz) |
Safe access pattern, not error suppression |
as? conditional cast |
Safer than force cast, correct for type narrowing |
SwiftUI
| Pattern |
Why It's Valid |
@StateObject in parent, @ObservedObject in child |
Correct ownership pattern |
| View body computed property without caching |
SwiftUI manages re-rendering efficiently |
AnyView for heterogeneous lists |
Valid when @ViewBuilder or generics aren't practical |
EnvironmentObject injection |
Standard SwiftUI dependency injection |
PreferenceKey for child-to-parent data |
Correct alternative to callbacks for layout data |
Testing
| Pattern |
Why It's Valid |
XCTAssertEqual without custom message |
Default messages are often sufficient |
async let in test methods |
Valid for concurrent test setup |
@MainActor test classes |
Required when testing UI-bound code |
| Mock objects without protocol conformance |
Simple test doubles are acceptable |
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
Swift Optionals
Flag force unwrap (!) ONLY IF ALL of these are true:
View Body Complexity
Flag complex View body ONLY IF:
Error Handling
Flag missing do/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-43description: 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```swift
57// Type annotation, NOT forced unwrap
58let data: UserData = await loader()
59
60// Type narrowing makes this safe
61if let user = data as? User {
62 user.name // Swift 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### Swift
138
139| Pattern | Why It's Valid |
140|---------|----------------|
141| `guard let` early return | Standard Swift pattern for unwrapping, not excessive nesting |
142| `weak self` in closures | Required for breaking retain cycles, not unnecessary |
143| `@State` / `@Binding` property wrappers | SwiftUI state management primitives |
144| Optional chaining (`foo?.bar?.baz`) | Safe access pattern, not error suppression |
145| `as?` conditional cast | Safer than force cast, correct for type narrowing |
146
147### SwiftUI
148
149| Pattern | Why It's Valid |
150|---------|----------------|
151| `@StateObject` in parent, `@ObservedObject` in child | Correct ownership pattern |
152| View body computed property without caching | SwiftUI manages re-rendering efficiently |
153| `AnyView` for heterogeneous lists | Valid when `@ViewBuilder` or generics aren't practical |
154| `EnvironmentObject` injection | Standard SwiftUI dependency injection |
155| `PreferenceKey` for child-to-parent data | Correct alternative to callbacks for layout data |
156
157### Testing
158
159| Pattern | Why It's Valid |
160|---------|----------------|
161| `XCTAssertEqual` without custom message | Default messages are often sufficient |
162| `async let` in test methods | Valid for concurrent test setup |
163| `@MainActor` test classes | Required when testing UI-bound code |
164| Mock objects without protocol conformance | Simple test doubles are acceptable |
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### Swift Optionals
178
179Flag force unwrap (`!`) **ONLY IF ALL** of these are true:
180- [ ] Value CAN actually be nil at runtime
181- [ ] No prior `guard let` or `if let` protects the access
182- [ ] Not in test code or prototype
183- [ ] Not a `@IBOutlet` (which is conventionally force-unwrapped)
184
185### View Body Complexity
186
187Flag complex View body **ONLY IF**:
188- [ ] Body exceeds 40 lines
189- [ ] Nested components could be extracted without losing clarity
190- [ ] Performance profiling shows actual rendering issues
191- [ ] Not a leaf view with minimal composition
192
193### Error Handling
194
195Flag missing `do/catch` **ONLY IF**:
196- [ ] No `Result` type wraps the throwing call
197- [ ] No higher-level error handler catches this
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