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, property, 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/@objc/#selector/SPM symbols 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, parent View / coordinator / ViewModel, app or scene delegate pipeline, 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/ripgrep or IDE references)
- Check if it's
public/open and used by other modules or targets (SPM, app extensions)
- Check if it's used via Objective-C runtime,
#selector, key paths, or dynamic dispatch
- Verify it's not a delegate/callback the framework invokes by contract
Common false positives:
- SwiftUI state (
@State, @Binding, @Observable) that drives updates even when the binding looks “unused” in one branch
- Symbols referenced from Interface Builder, asset catalogs,
#Preview, tests, or other targets
@objc, #selector, or dynamic dispatch to a symbol search may not show as plain call sites
"Missing Validation/Error Handling"
Before flagging, you MUST:
- Check if validation exists at a higher level (caller, parent
ViewModel, coordinator, app/scene delegate)
- Check if the framework or type already enforces invariants (
Codable, property wrappers, URLSession APIs)
- Verify the "missing" check isn't present in a different form (e.g.
Result, async error path, user-facing alert elsewhere)
Common false positives:
- Parent or router validates before this layer runs
- Errors surface via delegate, Combine pipeline, or unified logging — not every call needs local
do/catch
- User-visible failure is handled in a single choke point (e.g. one alert coordinator)
"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 or prior step guarantees the type (parsed JSON, Core Data fetch, async loader result)
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 is actually missing (not
deinit, onDisappear, cancel(), or store teardown elsewhere)
- Check if
Task cancellation, AsyncSequence termination, or Combine subscription disposal is handled after awaits
- Confirm the view or object can actually deallocate or invalidate during the async operation
Common false positives:
[weak self] or [unowned self] already used where needed
Task is cancelled when the view disappears (reviewer missed the link)
- Operation finishes before lifetime issues are possible
"Performance Issue"
Before flagging, you MUST:
- Confirm the code runs frequently enough to matter (SwiftUI body / layout vs one-off action)
- Verify the optimization would have measurable impact (Instruments or clear hot path)
- Check if the framework already mitigates this (SwiftUI diffing, lazy containers,
@Observable granularity)
Do NOT flag:
- Allocations in infrequent actions (sheet presentation, button tap)
- Linear work on small collections without evidence of scale
- Short-lived value types in event handlers when profiling doesn’t justify change
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 (generated Swift, SPM vendored sources, Xcode-generated)
- 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-23description: 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, property, 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/`@objc`/`#selector`/SPM symbols 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, parent `View` / coordinator / `ViewModel`, app or scene delegate pipeline, 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** - Apple APIs evolve (Swift concurrency, SwiftUI lifecycle, new SDKs); when syntax may have changed, confirm against current Apple documentation
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/ripgrep or IDE references)
482. Check if it's `public`/`open` and used by other modules or targets (SPM, app extensions)
493. Check if it's used via Objective-C runtime, `#selector`, key paths, or dynamic dispatch
504. Verify it's not a delegate/callback the framework invokes by contract
51
52**Common false positives:**
53- SwiftUI state (`@State`, `@Binding`, `@Observable`) that drives updates even when the binding looks “unused” in one branch
54- Symbols referenced from Interface Builder, asset catalogs, `#Preview`, tests, or other targets
55- `@objc`, `#selector`, or dynamic dispatch to a symbol search may not show as plain call sites
56
57### "Missing Validation/Error Handling"
58
59**Before flagging**, you MUST:
601. Check if validation exists at a higher level (caller, parent `ViewModel`, coordinator, app/scene delegate)
612. Check if the framework or type already enforces invariants (`Codable`, property wrappers, `URLSession` APIs)
623. Verify the "missing" check isn't present in a different form (e.g. `Result`, async error path, user-facing alert elsewhere)
63
64**Common false positives:**
65- Parent or router validates before this layer runs
66- Errors surface via delegate, Combine pipeline, or unified logging — not every call needs local `do/catch`
67- User-visible failure is handled in a single choke point (e.g. one alert coordinator)
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 or prior step guarantees the type (parsed JSON, Core Data fetch, async loader result)
75
76**Valid patterns often flagged incorrectly:**
77```swift
78// Type annotation, NOT forced unwrap
79let data: UserData = await loader()
80
81// Type narrowing makes this safe
82if let user = data as? User {
83 user.name // Swift knows this is User
84}
85```
86
87### "Potential Memory Leak/Race Condition"
88
89**Before flagging**, you MUST:
901. Verify cleanup is actually missing (not `deinit`, `onDisappear`, `cancel()`, or `store` teardown elsewhere)
912. Check if `Task` cancellation, `AsyncSequence` termination, or Combine subscription disposal is handled after awaits
923. Confirm the view or object can actually deallocate or invalidate during the async operation
93
94**Common false positives:**
95- `[weak self]` or `[unowned self]` already used where needed
96- `Task` is cancelled when the view disappears (reviewer missed the link)
97- Operation finishes before lifetime issues are possible
98
99### "Performance Issue"
100
101**Before flagging**, you MUST:
1021. Confirm the code runs frequently enough to matter (SwiftUI body / layout vs one-off action)
1032. Verify the optimization would have measurable impact (Instruments or clear hot path)
1043. Check if the framework already mitigates this (SwiftUI diffing, lazy containers, `@Observable` granularity)
105
106**Do NOT flag:**
107- Allocations in infrequent actions (sheet presentation, button tap)
108- Linear work on small collections without evidence of scale
109- Short-lived value types in event handlers when profiling doesn’t justify change
110
111## Severity Calibration
112
113### Critical (Block Merge)
114
115**ONLY use for:**
116- Security vulnerabilities (injection, auth bypass, data exposure)
117- Data corruption bugs
118- Crash-causing bugs in happy path
119- Breaking changes to public APIs
120
121### Major (Should Fix)
122
123**Use for:**
124- Logic bugs that affect functionality
125- Missing error handling that causes poor UX
126- Performance issues with measurable impact
127- Accessibility violations
128
129### Minor (Consider Fixing)
130
131**Use for:**
132- Code clarity improvements
133- Documentation gaps
134- Inconsistent style (within reason)
135- Non-critical test coverage gaps
136
137### Informational (No Action Required)
138
139**Use for:**
140- Improvements that require adding new dependencies or modules
141- Suggestions for net-new code that didn't exist in the codebase before (new modules, test suites, abstractions)
142- Architectural ideas for future consideration
143- Test infrastructure suggestions (new mock libraries, behaviour extraction)
144- Optimizations without measurable impact in the current context
145
146**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.
147
148### Do NOT Flag At All
149
150- Style preferences where both approaches are valid
151- Optimizations with no measurable benefit
152- Test code not meeting production standards (intentionally simpler)
153- Library/framework internal code (generated Swift, SPM vendored sources, Xcode-generated)
154- Hypothetical issues that require unlikely conditions
155
156## Valid Patterns (Do NOT Flag)
157
158### Swift
159
160| Pattern | Why It's Valid |
161|---------|----------------|
162| `guard let` early return | Standard Swift pattern for unwrapping, not excessive nesting |
163| `weak self` in closures | Required for breaking retain cycles, not unnecessary |
164| `@State` / `@Binding` property wrappers | SwiftUI state management primitives |
165| Optional chaining (`foo?.bar?.baz`) | Safe access pattern, not error suppression |
166| `as?` conditional cast | Safer than force cast, correct for type narrowing |
167
168### SwiftUI
169
170| Pattern | Why It's Valid |
171|---------|----------------|
172| `@StateObject` in parent, `@ObservedObject` in child | Correct ownership pattern |
173| View body computed property without caching | SwiftUI manages re-rendering efficiently |
174| `AnyView` for heterogeneous lists | Valid when `@ViewBuilder` or generics aren't practical |
175| `EnvironmentObject` injection | Standard SwiftUI dependency injection |
176| `PreferenceKey` for child-to-parent data | Correct alternative to callbacks for layout data |
177
178### Testing
179
180| Pattern | Why It's Valid |
181|---------|----------------|
182| `XCTAssertEqual` without custom message | Default messages are often sufficient |
183| `async let` in test methods | Valid for concurrent test setup |
184| `@MainActor` test classes | Required when testing UI-bound code |
185| Mock objects without protocol conformance | Simple test doubles are acceptable |
186
187### General
188
189| Pattern | Why It's Valid |
190|---------|----------------|
191| `+?` lazy quantifier in regex | Prevents over-matching, correct for many patterns |
192| Direct string concatenation | Simpler than template literals for simple cases |
193| Multiple returns in function | Can improve readability |
194| Comments explaining "why" | Better than no comments |
195
196## Context-Sensitive Rules
197
198### Swift Optionals
199
200Flag force unwrap (`!`) **ONLY IF ALL** of these are true:
201- [ ] Value CAN actually be nil at runtime
202- [ ] No prior `guard let` or `if let` protects the access
203- [ ] Not in test code or prototype
204- [ ] Not a `@IBOutlet` (which is conventionally force-unwrapped)
205
206### View Body Complexity
207
208Flag complex View body **ONLY IF**:
209- [ ] Body exceeds 40 lines
210- [ ] Nested components could be extracted without losing clarity
211- [ ] Performance profiling shows actual rendering issues
212- [ ] Not a leaf view with minimal composition
213
214### Error Handling
215
216Flag missing `do/catch` **ONLY IF**:
217- [ ] No `Result` type wraps the throwing call
218- [ ] No higher-level error handler catches this
219- [ ] The error would cause a crash, not just a failed operation
220- [ ] User needs specific feedback for this error type
221
222## Before Submitting Review
223
224Final verification:
2251. Re-read each finding and ask: "Did I verify this is actually an issue?"
2262. For each finding, can you point to the specific line that proves the issue exists?
2273. Would a domain expert agree this is a problem, or is it a style preference?
2284. Does fixing this provide real value, or is it busywork?
2295. Format every finding as: `[FILE:LINE] ISSUE_TITLE`
2306. 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.
2317. If this is a re-review: ONLY verify previous fixes. Do not introduce new findings.
232
233If uncertain about any finding, either:
234- Remove it from the review
235- Mark it as a question rather than an issue
236- Verify by reading more code context