swift-code-reviewer-skill 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -169
- package/README.md +43 -2
- package/SKILL.md +194 -711
- package/bin/install.js +1 -1
- package/package.json +2 -1
- package/references/agent-loop-feedback.md +148 -0
- package/references/companion-skills.md +70 -0
- package/references/spec-adherence.md +157 -0
- package/skills/README.md +43 -0
- package/skills/swift-concurrency/NOTICE.md +18 -0
- package/skills/swift-concurrency/SKILL.md +235 -0
- package/skills/swift-concurrency/references/actors.md +640 -0
- package/skills/swift-concurrency/references/async-await-basics.md +249 -0
- package/skills/swift-concurrency/references/async-sequences.md +635 -0
- package/skills/swift-concurrency/references/core-data.md +533 -0
- package/skills/swift-concurrency/references/glossary.md +96 -0
- package/skills/swift-concurrency/references/linting.md +38 -0
- package/skills/swift-concurrency/references/memory-management.md +542 -0
- package/skills/swift-concurrency/references/migration.md +721 -0
- package/skills/swift-concurrency/references/performance.md +574 -0
- package/skills/swift-concurrency/references/sendable.md +578 -0
- package/skills/swift-concurrency/references/tasks.md +604 -0
- package/skills/swift-concurrency/references/testing.md +565 -0
- package/skills/swift-concurrency/references/threading.md +452 -0
- package/skills/swift-expert/NOTICE.md +18 -0
- package/skills/swift-expert/SKILL.md +226 -0
- package/skills/swift-expert/references/async-concurrency.md +363 -0
- package/skills/swift-expert/references/memory-performance.md +380 -0
- package/skills/swift-expert/references/protocol-oriented.md +357 -0
- package/skills/swift-expert/references/swiftui-patterns.md +294 -0
- package/skills/swift-expert/references/testing-patterns.md +402 -0
- package/skills/swift-testing/NOTICE.md +18 -0
- package/skills/swift-testing/SKILL.md +295 -0
- package/skills/swift-testing/references/async-testing.md +245 -0
- package/skills/swift-testing/references/dump-snapshot-testing.md +265 -0
- package/skills/swift-testing/references/fixtures.md +193 -0
- package/skills/swift-testing/references/integration-testing.md +189 -0
- package/skills/swift-testing/references/migration-xctest.md +301 -0
- package/skills/swift-testing/references/parameterized-tests.md +171 -0
- package/skills/swift-testing/references/snapshot-testing.md +201 -0
- package/skills/swift-testing/references/test-doubles.md +243 -0
- package/skills/swift-testing/references/test-organization.md +231 -0
- package/skills/swiftui-expert-skill/NOTICE.md +18 -0
- package/skills/swiftui-expert-skill/SKILL.md +281 -0
- package/skills/swiftui-expert-skill/references/accessibility-patterns.md +151 -0
- package/skills/swiftui-expert-skill/references/animation-advanced.md +403 -0
- package/skills/swiftui-expert-skill/references/animation-basics.md +284 -0
- package/skills/swiftui-expert-skill/references/animation-transitions.md +326 -0
- package/skills/swiftui-expert-skill/references/charts-accessibility.md +135 -0
- package/skills/swiftui-expert-skill/references/charts.md +602 -0
- package/skills/swiftui-expert-skill/references/image-optimization.md +203 -0
- package/skills/swiftui-expert-skill/references/latest-apis.md +464 -0
- package/skills/swiftui-expert-skill/references/layout-best-practices.md +266 -0
- package/skills/swiftui-expert-skill/references/liquid-glass.md +414 -0
- package/skills/swiftui-expert-skill/references/list-patterns.md +394 -0
- package/skills/swiftui-expert-skill/references/macos-scenes.md +318 -0
- package/skills/swiftui-expert-skill/references/macos-views.md +357 -0
- package/skills/swiftui-expert-skill/references/macos-window-styling.md +303 -0
- package/skills/swiftui-expert-skill/references/performance-patterns.md +403 -0
- package/skills/swiftui-expert-skill/references/scroll-patterns.md +293 -0
- package/skills/swiftui-expert-skill/references/sheet-navigation-patterns.md +363 -0
- package/skills/swiftui-expert-skill/references/state-management.md +417 -0
- package/skills/swiftui-expert-skill/references/view-structure.md +389 -0
- package/skills/swiftui-ui-patterns/NOTICE.md +18 -0
- package/skills/swiftui-ui-patterns/SKILL.md +95 -0
- package/skills/swiftui-ui-patterns/references/app-wiring.md +201 -0
- package/skills/swiftui-ui-patterns/references/async-state.md +96 -0
- package/skills/swiftui-ui-patterns/references/components-index.md +50 -0
- package/skills/swiftui-ui-patterns/references/controls.md +57 -0
- package/skills/swiftui-ui-patterns/references/deeplinks.md +66 -0
- package/skills/swiftui-ui-patterns/references/focus.md +90 -0
- package/skills/swiftui-ui-patterns/references/form.md +97 -0
- package/skills/swiftui-ui-patterns/references/grids.md +71 -0
- package/skills/swiftui-ui-patterns/references/haptics.md +71 -0
- package/skills/swiftui-ui-patterns/references/input-toolbar.md +51 -0
- package/skills/swiftui-ui-patterns/references/lightweight-clients.md +93 -0
- package/skills/swiftui-ui-patterns/references/list.md +86 -0
- package/skills/swiftui-ui-patterns/references/loading-placeholders.md +38 -0
- package/skills/swiftui-ui-patterns/references/macos-settings.md +71 -0
- package/skills/swiftui-ui-patterns/references/matched-transitions.md +59 -0
- package/skills/swiftui-ui-patterns/references/media.md +73 -0
- package/skills/swiftui-ui-patterns/references/menu-bar.md +101 -0
- package/skills/swiftui-ui-patterns/references/navigationstack.md +159 -0
- package/skills/swiftui-ui-patterns/references/overlay.md +45 -0
- package/skills/swiftui-ui-patterns/references/performance.md +62 -0
- package/skills/swiftui-ui-patterns/references/previews.md +48 -0
- package/skills/swiftui-ui-patterns/references/scroll-reveal.md +133 -0
- package/skills/swiftui-ui-patterns/references/scrollview.md +87 -0
- package/skills/swiftui-ui-patterns/references/searchable.md +71 -0
- package/skills/swiftui-ui-patterns/references/sheets.md +155 -0
- package/skills/swiftui-ui-patterns/references/split-views.md +72 -0
- package/skills/swiftui-ui-patterns/references/tabview.md +114 -0
- package/skills/swiftui-ui-patterns/references/theming.md +71 -0
- package/skills/swiftui-ui-patterns/references/title-menus.md +93 -0
- package/skills/swiftui-ui-patterns/references/top-bar.md +49 -0
package/SKILL.md
CHANGED
|
@@ -1,797 +1,280 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: swift-code-reviewer
|
|
3
|
-
description:
|
|
4
|
-
Multi-layer code review agent for Swift and SwiftUI projects. Analyzes PRs,
|
|
5
|
-
diffs, and files across six dimensions: Swift 6+ concurrency safety, SwiftUI
|
|
6
|
-
state management and modern APIs, performance (view updates, ForEach identity,
|
|
7
|
-
lazy loading), security (force unwraps, Keychain, input validation), architecture
|
|
8
|
-
compliance (MVVM/MVI/TCA, dependency injection), and project-specific standards
|
|
9
|
-
from .claude/CLAUDE.md. Outputs structured reports with Critical/High/Medium/Low
|
|
10
|
-
severity, positive feedback, and prioritized action items with file:line
|
|
11
|
-
references and before/after code examples.
|
|
12
|
-
|
|
13
|
-
ALWAYS use this skill when the user says "review this PR", "review my code",
|
|
14
|
-
"review my changes", "check this file", "code review", "review against our
|
|
15
|
-
standards", "audit this codebase", "check code quality", mentions reviewing
|
|
16
|
-
any .swift file, asks about Swift best practices violations in existing code,
|
|
17
|
-
or wants feedback on Swift/SwiftUI code — even if they don't explicitly say
|
|
18
|
-
"code review". Also trigger when the user asks to "check if this follows our
|
|
19
|
-
coding standards", "review uncommitted changes", "review all ViewModels",
|
|
20
|
-
or mentions reviewing navigation, sheets, theming, or async patterns in Swift.
|
|
3
|
+
description: "Perform thorough code reviews for Swift/SwiftUI code, including spec adherence (PR description + linked issues), code quality, architecture, performance, security, Swift 6+ best practices, project standards from .claude/CLAUDE.md, and meta-feedback on recurring patterns that suggest gaps in the agent's instructions. Use when reviewing PRs/MRs (especially AI-generated ones), performing quality audits, validating against original spec, or providing structured feedback with severity levels and improvement suggestions for both the code and the agent loop that produced it."
|
|
21
4
|
---
|
|
22
5
|
|
|
23
6
|
# Swift/SwiftUI Code Review Skill
|
|
24
7
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
This skill provides comprehensive code review capabilities for Swift and SwiftUI projects, combining Apple's best practices with project-specific coding standards. It performs multi-layer analysis covering code quality, architecture, performance, security, and maintainability.
|
|
28
|
-
|
|
29
|
-
### Key Capabilities
|
|
30
|
-
|
|
31
|
-
- **Project-Aware Reviews**: Reads `.claude/CLAUDE.md` and related architecture documents to validate against project-specific standards
|
|
32
|
-
- **Multi-Layer Analysis**: Combines Swift 6+ best practices, SwiftUI patterns, performance optimization, and security checks
|
|
33
|
-
- **Comprehensive Feedback**: Provides Critical/High/Medium/Low severity issues, positive feedback, and refactoring suggestions
|
|
34
|
-
- **Integration with Existing Skills**: Leverages `swift-best-practices`, `swiftui-expert-skill`, and `swiftui-performance-audit` for domain expertise
|
|
35
|
-
- **Actionable Output**: Structured feedback with file:line references, code examples, and prioritized action items
|
|
8
|
+
Multi-layer review covering Swift 6+ concurrency, SwiftUI patterns, performance, security, architecture, and project-specific standards. Reads `.claude/CLAUDE.md` and outputs Critical/High/Medium/Low severity findings with `file:line` references and before/after code examples.
|
|
36
9
|
|
|
37
10
|
## When to Use This Skill
|
|
38
11
|
|
|
39
|
-
Use this skill when you need to:
|
|
40
|
-
|
|
41
|
-
- Review Pull Requests or Merge Requests for Swift/SwiftUI projects
|
|
42
|
-
- Perform code quality audits on existing codebases
|
|
43
|
-
- Validate code changes against project-specific standards
|
|
44
|
-
- Analyze individual Swift/SwiftUI files for best practices
|
|
45
|
-
- Review uncommitted git changes before committing
|
|
46
|
-
- Assess architecture and maintainability of Swift code
|
|
47
|
-
- Provide structured feedback to team members
|
|
48
|
-
|
|
49
|
-
**Trigger patterns:**
|
|
50
|
-
|
|
51
12
|
- "Review this PR"
|
|
52
|
-
- "Review
|
|
53
|
-
- "Review my changes"
|
|
13
|
+
- "Review my code" / "Review my changes" / "Review uncommitted changes"
|
|
54
14
|
- "Code review for [component]"
|
|
55
|
-
- "
|
|
56
|
-
- "Review against .claude/CLAUDE.md"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Phase 1: Context Gathering
|
|
63
|
-
|
|
64
|
-
**Objective**: Understand the project context and scope of review
|
|
65
|
-
|
|
66
|
-
1. **Read Project Guidelines**
|
|
67
|
-
- Load `.claude/CLAUDE.md` if it exists in the repository
|
|
68
|
-
- Read related architecture documents (e.g., `DependencyInjection-Architecture.md`, `Design System Structure.md`)
|
|
69
|
-
- Extract custom coding standards, patterns, and rules
|
|
70
|
-
|
|
71
|
-
2. **Identify Review Scope**
|
|
72
|
-
- Determine files to review:
|
|
73
|
-
- User-specified files
|
|
74
|
-
- Git diff (uncommitted or PR/MR changes)
|
|
75
|
-
- Modified files in a specific directory
|
|
76
|
-
- Categorize changes by type (UI, logic, tests, configuration)
|
|
77
|
-
|
|
78
|
-
3. **Gather File Context**
|
|
79
|
-
- Read all files that will be reviewed
|
|
80
|
-
- Understand the broader context (related files, dependencies)
|
|
81
|
-
- Identify the purpose and role of each component
|
|
82
|
-
|
|
83
|
-
### Phase 2: Automated Analysis
|
|
84
|
-
|
|
85
|
-
**Objective**: Run parallel checks across multiple quality dimensions
|
|
86
|
-
|
|
87
|
-
Execute checks across **six core categories**:
|
|
88
|
-
|
|
89
|
-
#### 1. Swift Best Practices
|
|
90
|
-
|
|
91
|
-
Reference: `swift-best-practices` skill knowledge base
|
|
92
|
-
|
|
93
|
-
- **Concurrency Safety**
|
|
94
|
-
- Actor isolation correctness
|
|
95
|
-
- MainActor usage for UI code
|
|
96
|
-
- Sendable conformance
|
|
97
|
-
- Data race prevention
|
|
98
|
-
- Async/await patterns
|
|
99
|
-
|
|
100
|
-
- **API Design**
|
|
101
|
-
- Naming conventions (Swift API Design Guidelines)
|
|
102
|
-
- Parameter labels clarity
|
|
103
|
-
- Return type appropriateness
|
|
104
|
-
- Error handling (typed throws)
|
|
105
|
-
|
|
106
|
-
- **Language Features**
|
|
107
|
-
- Availability attributes for new APIs
|
|
108
|
-
- Migration to Swift 6 features
|
|
109
|
-
- Avoiding deprecated patterns
|
|
110
|
-
- Proper use of optionals
|
|
111
|
-
|
|
112
|
-
#### 2. SwiftUI Quality
|
|
113
|
-
|
|
114
|
-
Reference: `swiftui-expert-skill` knowledge base
|
|
115
|
-
|
|
116
|
-
- **State Management**
|
|
117
|
-
- Correct property wrapper selection (@Observable, @State, @Binding, @Environment)
|
|
118
|
-
- State ownership and data flow
|
|
119
|
-
- Avoiding unnecessary state
|
|
120
|
-
- View model patterns
|
|
121
|
-
|
|
122
|
-
- **Modern API Usage**
|
|
123
|
-
- Replace deprecated APIs with modern equivalents
|
|
124
|
-
- Use latest SwiftUI features (iOS 17+, macOS 14+)
|
|
125
|
-
- Proper use of view modifiers
|
|
126
|
-
- Composition over inheritance
|
|
127
|
-
|
|
128
|
-
- **View Composition**
|
|
129
|
-
- View extraction appropriateness
|
|
130
|
-
- Component reusability
|
|
131
|
-
- View hierarchy depth
|
|
132
|
-
- Subview organization
|
|
133
|
-
|
|
134
|
-
- **Accessibility**
|
|
135
|
-
- Accessibility labels and hints
|
|
136
|
-
- VoiceOver support
|
|
137
|
-
- Dynamic Type support
|
|
138
|
-
- Keyboard navigation
|
|
139
|
-
|
|
140
|
-
#### 3. Performance
|
|
141
|
-
|
|
142
|
-
Reference: `swiftui-performance-audit` knowledge base
|
|
143
|
-
|
|
144
|
-
- **View Optimization**
|
|
145
|
-
- Unnecessary view updates
|
|
146
|
-
- Heavy computation in body
|
|
147
|
-
- Equatable conformance for view models
|
|
148
|
-
- Lazy loading patterns
|
|
149
|
-
|
|
150
|
-
- **List Performance**
|
|
151
|
-
- ForEach identity stability
|
|
152
|
-
- Cell reuse patterns
|
|
153
|
-
- Scroll performance
|
|
154
|
-
- Large dataset handling
|
|
155
|
-
|
|
156
|
-
- **Layout Efficiency**
|
|
157
|
-
- Layout thrash detection
|
|
158
|
-
- GeometryReader overuse
|
|
159
|
-
- Frame calculations
|
|
160
|
-
- Animation performance
|
|
161
|
-
|
|
162
|
-
- **Resource Management**
|
|
163
|
-
- Image loading and caching
|
|
164
|
-
- Memory leaks (retain cycles)
|
|
165
|
-
- Background task management
|
|
166
|
-
- Network request optimization
|
|
167
|
-
|
|
168
|
-
#### 4. Security & Safety
|
|
169
|
-
|
|
170
|
-
- **Data Validation**
|
|
171
|
-
- Input sanitization
|
|
172
|
-
- Type safety
|
|
173
|
-
- Boundary checking
|
|
174
|
-
- Force unwrap audit (avoid `!` and `as!`)
|
|
175
|
-
|
|
176
|
-
- **Sensitive Data Handling**
|
|
177
|
-
- Password and token management
|
|
178
|
-
- Keychain usage for credentials
|
|
179
|
-
- Secure data transmission
|
|
180
|
-
- Log sanitization (no sensitive data in logs)
|
|
181
|
-
|
|
182
|
-
- **Platform Security**
|
|
183
|
-
- Permission handling (camera, location, etc.)
|
|
184
|
-
- Network security (TLS, certificate pinning)
|
|
185
|
-
- Secure storage (UserDefaults vs Keychain)
|
|
186
|
-
- Code signing and entitlements
|
|
187
|
-
|
|
188
|
-
#### 5. Architecture & Maintainability
|
|
189
|
-
|
|
190
|
-
- **Project Architecture Compliance**
|
|
191
|
-
- Adherence to defined patterns (MVVM, MVI, TCA, etc.)
|
|
192
|
-
- Layer separation (View/ViewModel/Repository/UseCase)
|
|
193
|
-
- Dependency injection patterns
|
|
194
|
-
- Module boundaries
|
|
195
|
-
|
|
196
|
-
- **Code Organization**
|
|
197
|
-
- File structure and naming
|
|
198
|
-
- Logical grouping
|
|
199
|
-
- Extension organization
|
|
200
|
-
- Protocol conformances
|
|
201
|
-
|
|
202
|
-
- **Testability**
|
|
203
|
-
- Unit test coverage
|
|
204
|
-
- Test structure (Arrange-Act-Assert)
|
|
205
|
-
- Mock/stub usage
|
|
206
|
-
- Test isolation
|
|
207
|
-
|
|
208
|
-
- **Documentation**
|
|
209
|
-
- DocC comments for public APIs
|
|
210
|
-
- Complex logic explanations
|
|
211
|
-
- Architecture decision records
|
|
212
|
-
- README and guides
|
|
213
|
-
|
|
214
|
-
#### 6. Project-Specific Standards
|
|
215
|
-
|
|
216
|
-
- **Custom Coding Standards**
|
|
217
|
-
- Validate against `.claude/CLAUDE.md` rules
|
|
218
|
-
- Check custom error handling patterns
|
|
219
|
-
- Verify project-specific naming conventions
|
|
220
|
-
- Validate testing requirements
|
|
221
|
-
|
|
222
|
-
- **Design System Compliance**
|
|
223
|
-
- Use of design tokens
|
|
224
|
-
- Consistent spacing and typography
|
|
225
|
-
- Color palette adherence
|
|
226
|
-
- Component library usage
|
|
227
|
-
|
|
228
|
-
- **Navigation Patterns**
|
|
229
|
-
- Coordinator pattern compliance
|
|
230
|
-
- Deep linking support
|
|
231
|
-
- State restoration
|
|
232
|
-
- Navigation flow consistency
|
|
233
|
-
|
|
234
|
-
### Phase 3: Report Generation
|
|
235
|
-
|
|
236
|
-
**Objective**: Aggregate findings into a structured, actionable report
|
|
237
|
-
|
|
238
|
-
1. **Categorize Findings by Severity**
|
|
239
|
-
- **Critical**: Security vulnerabilities, data races, crashes, breaking changes
|
|
240
|
-
- **High**: Performance issues, anti-patterns, major architecture violations
|
|
241
|
-
- **Medium**: Code quality improvements, missing documentation, minor violations
|
|
242
|
-
- **Low**: Style inconsistencies, suggestions for refactoring
|
|
243
|
-
|
|
244
|
-
2. **Include Positive Feedback**
|
|
245
|
-
- Acknowledge good practices and patterns
|
|
246
|
-
- Highlight excellent code quality
|
|
247
|
-
- Recognize proper use of modern APIs
|
|
248
|
-
- Note strong architecture decisions
|
|
249
|
-
|
|
250
|
-
3. **Add Refactoring Suggestions**
|
|
251
|
-
- Proactive improvement opportunities
|
|
252
|
-
- Modernization suggestions
|
|
253
|
-
- Code simplification ideas
|
|
254
|
-
- Performance optimization hints
|
|
255
|
-
|
|
256
|
-
4. **Group and Organize**
|
|
257
|
-
- Group by file, then by category
|
|
258
|
-
- Sort by severity within each file
|
|
259
|
-
- Include code location references (file:line)
|
|
260
|
-
- Provide specific code examples
|
|
261
|
-
|
|
262
|
-
### Phase 4: Delivery
|
|
263
|
-
|
|
264
|
-
**Objective**: Present findings in a clear, actionable format
|
|
265
|
-
|
|
266
|
-
1. **Format as Structured Markdown**
|
|
267
|
-
- Executive summary with key metrics
|
|
268
|
-
- Severity breakdown
|
|
269
|
-
- File-by-file detailed findings
|
|
270
|
-
- Positive feedback section
|
|
271
|
-
- Prioritized action items
|
|
272
|
-
|
|
273
|
-
2. **Include Code References**
|
|
274
|
-
- Exact file and line numbers (file.swift:123)
|
|
275
|
-
- Before/after code examples
|
|
276
|
-
- Links to relevant documentation
|
|
277
|
-
- Comparison with project guidelines
|
|
278
|
-
|
|
279
|
-
3. **Provide Context**
|
|
280
|
-
- Explain _why_ something is an issue
|
|
281
|
-
- Reference best practices or standards
|
|
282
|
-
- Suggest specific fixes with examples
|
|
283
|
-
- Link to learning resources
|
|
284
|
-
|
|
285
|
-
## Core Review Categories
|
|
286
|
-
|
|
287
|
-
### 1. Swift Language Quality
|
|
288
|
-
|
|
289
|
-
**What to Check:**
|
|
290
|
-
|
|
291
|
-
- Concurrency patterns (actors, async/await, Sendable)
|
|
292
|
-
- Error handling (typed throws, Result type)
|
|
293
|
-
- Optionals handling (avoid force unwrapping)
|
|
294
|
-
- Access control (public, internal, private, fileprivate)
|
|
295
|
-
- Naming conventions (Swift API Design Guidelines)
|
|
296
|
-
- Type inference vs explicit types
|
|
297
|
-
- Value types vs reference types
|
|
298
|
-
|
|
299
|
-
**Reference:** `references/swift-quality-checklist.md`
|
|
300
|
-
|
|
301
|
-
### 2. SwiftUI Patterns
|
|
302
|
-
|
|
303
|
-
**What to Check:**
|
|
304
|
-
|
|
305
|
-
- Property wrapper selection and usage
|
|
306
|
-
- State management patterns
|
|
307
|
-
- View lifecycle understanding
|
|
308
|
-
- Modern API usage (avoid deprecated)
|
|
309
|
-
- View composition and extraction
|
|
310
|
-
- Accessibility implementation
|
|
311
|
-
- Preview configurations
|
|
312
|
-
|
|
313
|
-
**Reference:** `references/swiftui-review-checklist.md`
|
|
314
|
-
|
|
315
|
-
### 3. Performance Optimization
|
|
316
|
-
|
|
317
|
-
**What to Check:**
|
|
318
|
-
|
|
319
|
-
- View update optimization
|
|
320
|
-
- ForEach identity and performance
|
|
321
|
-
- Heavy work in view body
|
|
322
|
-
- Image loading and caching
|
|
323
|
-
- Memory management
|
|
324
|
-
- Background task efficiency
|
|
325
|
-
- Layout performance
|
|
326
|
-
|
|
327
|
-
**Reference:** `references/performance-review.md`
|
|
328
|
-
|
|
329
|
-
### 4. Security & Safety
|
|
330
|
-
|
|
331
|
-
**What to Check:**
|
|
15
|
+
- "Audit this codebase" / "Check code quality"
|
|
16
|
+
- "Review against .claude/CLAUDE.md" / "Check if this follows our coding standards"
|
|
17
|
+
- "Architecture review" / "Performance audit" / "Security review"
|
|
18
|
+
- "Review this PR against the spec"
|
|
19
|
+
- "Did the agent miss anything from issue #123?"
|
|
20
|
+
- "What rules am I missing in CLAUDE.md based on this PR?"
|
|
21
|
+
- "Review this AI-generated PR"
|
|
332
22
|
|
|
333
|
-
|
|
334
|
-
- Input validation and sanitization
|
|
335
|
-
- Sensitive data handling (passwords, tokens)
|
|
336
|
-
- Keychain usage for credentials
|
|
337
|
-
- Network security (HTTPS, certificate pinning)
|
|
338
|
-
- Permission handling
|
|
339
|
-
- Logging safety (no sensitive data in logs)
|
|
23
|
+
## Workflow
|
|
340
24
|
|
|
341
|
-
|
|
25
|
+
### Phase 1 — Context Gathering
|
|
342
26
|
|
|
343
|
-
|
|
27
|
+
1. **Read the Spec**
|
|
28
|
+
- For PRs: `gh pr view <num> --json title,body,closingIssuesReferences,labels`
|
|
29
|
+
- For linked issues: `gh issue view <num> --json title,body,labels`
|
|
30
|
+
- For MRs: `glab mr view <num>` and `glab issue view <num>`
|
|
31
|
+
- Extract:
|
|
32
|
+
- Stated goal / problem being solved
|
|
33
|
+
- Explicit acceptance criteria (look for checkboxes, "should", "must", "Given/When/Then")
|
|
34
|
+
- Edge cases or non-goals mentioned
|
|
35
|
+
- Out-of-scope items
|
|
36
|
+
- If no PR/issue context is available, note this and fall back to inferring intent from the diff.
|
|
37
|
+
2. Try to load `.claude/CLAUDE.md`.
|
|
38
|
+
- **If missing**: add a note to the report — _"No project standards file found — review uses default Apple guidelines"_ — then continue.
|
|
39
|
+
3. Obtain the changeset: `git diff`, `git diff --cached`, or `gh pr diff <n>`.
|
|
40
|
+
- **If diff is empty**: stop and ask the user to specify files, a PR number, or a directory.
|
|
41
|
+
4. Read each changed file plus key related files (imports, protocols it conforms to, corresponding test file if present).
|
|
344
42
|
|
|
345
|
-
|
|
43
|
+
### Phase 2 — Analysis
|
|
346
44
|
|
|
347
|
-
|
|
348
|
-
- Dependency injection patterns
|
|
349
|
-
- Separation of concerns
|
|
350
|
-
- Module boundaries
|
|
351
|
-
- Code organization
|
|
352
|
-
- Testability
|
|
353
|
-
- Documentation quality
|
|
45
|
+
For each category, load the reference file before writing findings:
|
|
354
46
|
|
|
355
|
-
|
|
47
|
+
#### 0. Spec Adherence
|
|
356
48
|
|
|
357
|
-
|
|
49
|
+
Reference: `references/spec-adherence.md`
|
|
358
50
|
|
|
359
|
-
**
|
|
51
|
+
- **Requirement Coverage**
|
|
52
|
+
- Does each acceptance criterion map to a concrete code change?
|
|
53
|
+
- Are edge cases mentioned in the spec handled?
|
|
54
|
+
- Are tests covering the scenarios described?
|
|
55
|
+
- **Scope Discipline**
|
|
56
|
+
- Flag changes outside the stated scope (scope creep)
|
|
57
|
+
- Flag unrelated refactors bundled into the PR
|
|
58
|
+
- **Missing Work**
|
|
59
|
+
- TODOs, `fatalError("not implemented")`, empty function bodies
|
|
60
|
+
- Stubbed mocks that should be real implementations
|
|
61
|
+
- Acceptance criteria with no corresponding diff
|
|
62
|
+
- **Intent Drift**
|
|
63
|
+
- Code solves a *similar* but different problem than stated
|
|
64
|
+
- Naming/structure suggests a different mental model than the spec
|
|
360
65
|
|
|
361
|
-
-
|
|
362
|
-
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
66
|
+
1. **Swift Quality** — concurrency, error handling, optionals, naming → `references/swift-quality-checklist.md`; for concurrency findings also read `skills/swift-concurrency/references/sendable.md` and `actors.md`
|
|
67
|
+
2. **SwiftUI Patterns** — property wrappers, state management, deprecated APIs → `references/swiftui-review-checklist.md`; for wrapper selection read `skills/swiftui-expert-skill/references/state-management.md`
|
|
68
|
+
3. **Performance** — view body cost, ForEach identity, lazy loading, retain cycles → `references/performance-review.md`
|
|
69
|
+
4. **Security** — force unwraps, Keychain vs UserDefaults, input validation, no secrets in logs → `references/security-checklist.md`
|
|
70
|
+
5. **Architecture** — MVVM/MVI/TCA compliance, DI, testability → `references/architecture-patterns.md`
|
|
71
|
+
6. **Project Standards** — validate against `.claude/CLAUDE.md` rules → `references/custom-guidelines.md`
|
|
367
72
|
|
|
368
|
-
|
|
73
|
+
For test file findings, consult `skills/swift-testing/references/test-organization.md`.
|
|
74
|
+
For navigation/routing findings, consult `skills/swiftui-ui-patterns/references/navigationstack.md`.
|
|
369
75
|
|
|
370
|
-
|
|
76
|
+
### Phase 2.5 — Pattern Detection (for Agent Loop Feedback)
|
|
371
77
|
|
|
372
|
-
|
|
78
|
+
**Objective**: Identify recurring issues that point to gaps in the agent's
|
|
79
|
+
instructions, not just the code.
|
|
373
80
|
|
|
374
|
-
|
|
81
|
+
After collecting per-file findings, aggregate them:
|
|
375
82
|
|
|
376
|
-
|
|
83
|
+
1. Group findings by rule (e.g., "force-unwrap", "deprecated NavigationView",
|
|
84
|
+
"missing @MainActor on UI mutation").
|
|
85
|
+
2. Mark any rule that fires **≥2 times across the diff** as a recurring pattern.
|
|
86
|
+
3. For each recurring pattern, draft a one-line rule suitable for
|
|
87
|
+
`.claude/CLAUDE.md` or an agent system prompt — written as a directive,
|
|
88
|
+
not a description.
|
|
89
|
+
4. If the same recurring pattern appeared in past reviews (check git log of
|
|
90
|
+
`.claude/CLAUDE.md`), escalate priority — the existing rule isn't strong
|
|
91
|
+
enough or isn't being read.
|
|
377
92
|
|
|
378
|
-
|
|
93
|
+
Threshold rationale: one occurrence is a slip; two is a pattern; three+ means
|
|
94
|
+
the agent's instructions are silent on this and need an explicit rule.
|
|
379
95
|
|
|
380
|
-
|
|
381
|
-
- API design guidelines compliance
|
|
382
|
-
- Availability pattern validation
|
|
383
|
-
- Breaking changes detection
|
|
384
|
-
- Modern Swift feature adoption
|
|
96
|
+
Reference: `references/agent-loop-feedback.md`.
|
|
385
97
|
|
|
386
|
-
|
|
98
|
+
### Phase 3 — Report
|
|
387
99
|
|
|
388
|
-
|
|
389
|
-
- Reference `swift6-features.md` for Swift 6 migration patterns
|
|
390
|
-
- Use `api-design.md` for naming and parameter validation
|
|
100
|
+
Group findings by file → sort by severity within each file → write prioritized action items.
|
|
391
101
|
|
|
392
|
-
|
|
102
|
+
Severity: **Critical** (crash/data race/security hole) · **High** (anti-pattern/major arch violation) · **Medium** (quality/maintainability) · **Low** (style/suggestion).
|
|
393
103
|
|
|
394
|
-
|
|
104
|
+
Include one-sentence positive feedback where code is notably well-written. Never pad with generic praise.
|
|
395
105
|
|
|
396
|
-
|
|
106
|
+
## Concrete Finding Examples
|
|
397
107
|
|
|
398
|
-
|
|
399
|
-
- Modern SwiftUI API guidance (iOS 17+, macOS 14+)
|
|
400
|
-
- View composition best practices
|
|
401
|
-
- Property wrapper selection guide
|
|
402
|
-
- Accessibility patterns
|
|
108
|
+
### Force Unwrap → guard let (Critical)
|
|
403
109
|
|
|
404
|
-
|
|
110
|
+
**`LoginViewModel.swift:89`** — Current:
|
|
405
111
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
### 3. swiftui-performance-audit
|
|
411
|
-
|
|
412
|
-
**When to Use:** Performance concerns identified or mentioned in PR description
|
|
413
|
-
|
|
414
|
-
**What it Provides:**
|
|
415
|
-
|
|
416
|
-
- View update optimization patterns
|
|
417
|
-
- ForEach performance analysis
|
|
418
|
-
- Layout thrash detection
|
|
419
|
-
- Image handling best practices
|
|
420
|
-
- Memory management
|
|
421
|
-
|
|
422
|
-
**How to Leverage:**
|
|
423
|
-
|
|
424
|
-
- Read `~/.claude/skills/swiftui-performance-audit/SKILL.md` for performance audit workflow
|
|
425
|
-
- Reference performance-specific checks when reviewing view code
|
|
426
|
-
- Apply recommendations from the skill to performance-sensitive paths
|
|
427
|
-
|
|
428
|
-
### 4. swiftui-ui-patterns
|
|
429
|
-
|
|
430
|
-
**When to Use:** Reviewing navigation architecture, sheet/modal routing, TabView setup, theming, async state management, focus handling, or API client patterns
|
|
431
|
-
|
|
432
|
-
**What it Provides:**
|
|
433
|
-
|
|
434
|
-
- Navigation architecture (route enums, RouterPath, centralized navigationDestination)
|
|
435
|
-
- Sheet/modal routing (item-driven sheets, SheetDestination enum)
|
|
436
|
-
- TabView with independent per-tab navigation history
|
|
437
|
-
- Theming with semantic colors via `@Environment(Theme.self)`
|
|
438
|
-
- Async state patterns (`.task(id:)`, LoadState enum, CancellationError handling)
|
|
439
|
-
- Focus chaining with FocusField enum and `.onSubmit`
|
|
440
|
-
- Lightweight API client pattern (closure-based structs, `.live()` / `.mock()` factories)
|
|
441
|
-
|
|
442
|
-
**How to Leverage:**
|
|
443
|
-
|
|
444
|
-
- Read `~/.claude/skills/swiftui-ui-patterns/references/navigation.md` for route enum and RouterPath checks
|
|
445
|
-
- Reference `sheets-modals.md` for sheet routing validation
|
|
446
|
-
- Use `theming.md` for semantic color enforcement
|
|
447
|
-
|
|
448
|
-
**Integration Strategy:**
|
|
449
|
-
|
|
450
|
-
1. Load relevant reference files from these skills as needed
|
|
451
|
-
2. Apply their checklist items to the review
|
|
452
|
-
3. Reference their documentation in feedback
|
|
453
|
-
4. Avoid duplicating content—point to their knowledge base
|
|
454
|
-
|
|
455
|
-
## Platform Support
|
|
456
|
-
|
|
457
|
-
### GitHub Pull Requests
|
|
458
|
-
|
|
459
|
-
Use `gh` CLI for fetching PR data:
|
|
460
|
-
|
|
461
|
-
```bash
|
|
462
|
-
# Get PR details
|
|
463
|
-
gh pr view <PR-number>
|
|
112
|
+
```swift
|
|
113
|
+
let user = repository.currentUser!
|
|
114
|
+
```
|
|
464
115
|
|
|
465
|
-
|
|
466
|
-
gh pr diff <PR-number>
|
|
116
|
+
**Finding**: crashes if `currentUser` is `nil` (e.g., after sign-out race condition).
|
|
467
117
|
|
|
468
|
-
|
|
469
|
-
gh pr view <PR-number> --json files
|
|
118
|
+
**Fix**:
|
|
470
119
|
|
|
471
|
-
|
|
472
|
-
|
|
120
|
+
```swift
|
|
121
|
+
guard let user = repository.currentUser else {
|
|
122
|
+
logger.error("currentUser nil — aborting login flow")
|
|
123
|
+
return
|
|
124
|
+
}
|
|
473
125
|
```
|
|
474
126
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
Use `glab` CLI for fetching MR data:
|
|
127
|
+
---
|
|
478
128
|
|
|
479
|
-
|
|
480
|
-
# Get MR details
|
|
481
|
-
glab mr view <MR-number>
|
|
129
|
+
### Missing @MainActor on UI-bound ViewModel (High)
|
|
482
130
|
|
|
483
|
-
|
|
484
|
-
glab mr diff <MR-number>
|
|
131
|
+
**`FeedViewModel.swift:12`** — Current:
|
|
485
132
|
|
|
486
|
-
|
|
487
|
-
|
|
133
|
+
```swift
|
|
134
|
+
class FeedViewModel: ObservableObject {
|
|
135
|
+
@Published var posts: [Post] = []
|
|
488
136
|
|
|
489
|
-
|
|
490
|
-
|
|
137
|
+
func load() async {
|
|
138
|
+
posts = try? await api.fetchPosts() // ⚠️ mutates @Published off main thread
|
|
139
|
+
}
|
|
140
|
+
}
|
|
491
141
|
```
|
|
492
142
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
For uncommitted changes or manual review:
|
|
143
|
+
**Finding**: `@Published` mutations must happen on the main actor in Swift 6 strict concurrency; this is a data race.
|
|
496
144
|
|
|
497
|
-
|
|
498
|
-
# Get uncommitted changes
|
|
499
|
-
git diff
|
|
145
|
+
**Fix**:
|
|
500
146
|
|
|
501
|
-
|
|
502
|
-
|
|
147
|
+
```swift
|
|
148
|
+
@MainActor
|
|
149
|
+
@Observable
|
|
150
|
+
final class FeedViewModel {
|
|
151
|
+
var posts: [Post] = []
|
|
503
152
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
git show <commit-hash>
|
|
153
|
+
func load() async throws {
|
|
154
|
+
posts = try await api.fetchPosts() // safe: whole class is @MainActor-isolated
|
|
155
|
+
}
|
|
156
|
+
}
|
|
509
157
|
```
|
|
510
158
|
|
|
511
|
-
|
|
159
|
+
Also migrate from `ObservableObject`/`@Published` to `@Observable` (iOS 17+) — see `skills/swiftui-expert-skill/references/state-management.md`.
|
|
512
160
|
|
|
513
|
-
|
|
161
|
+
## Output Format
|
|
514
162
|
|
|
515
|
-
|
|
516
|
-
# Code Review
|
|
163
|
+
```
|
|
164
|
+
# Code Review — <scope>
|
|
517
165
|
|
|
518
166
|
## Summary
|
|
167
|
+
Files: N | Critical: N | High: N | Medium: N | Low: N
|
|
519
168
|
|
|
520
|
-
|
|
521
|
-
- **Total Findings**: Y
|
|
522
|
-
- **Critical**: 0
|
|
523
|
-
- **High**: 2
|
|
524
|
-
- **Medium**: 5
|
|
525
|
-
- **Low**: 3
|
|
526
|
-
- **Positive Feedback**: 8
|
|
527
|
-
- **Refactoring Suggestions**: 4
|
|
528
|
-
|
|
529
|
-
## Executive Summary
|
|
530
|
-
|
|
531
|
-
[Brief overview of the changes and overall code quality]
|
|
532
|
-
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
## Detailed Findings
|
|
536
|
-
|
|
537
|
-
### File: Sources/Features/Login/LoginView.swift
|
|
538
|
-
|
|
539
|
-
#### ✅ Positive Feedback
|
|
540
|
-
|
|
541
|
-
1. **Excellent State Management** (line 23)
|
|
542
|
-
- Proper use of @Observable for view model
|
|
543
|
-
- Clean separation of concerns
|
|
544
|
-
|
|
545
|
-
2. **Modern API Usage** (line 45)
|
|
546
|
-
- Using new SwiftUI APIs effectively
|
|
547
|
-
- Proper async/await integration
|
|
548
|
-
|
|
549
|
-
#### 🔴 Critical Issues
|
|
550
|
-
|
|
551
|
-
1. **Data Race Risk** (line 67)
|
|
552
|
-
- **Severity**: Critical
|
|
553
|
-
- **Category**: Concurrency
|
|
554
|
-
- **Issue**: Mutable state accessed from multiple actors without synchronization
|
|
555
|
-
- **Fix**:
|
|
556
|
-
|
|
557
|
-
```swift
|
|
558
|
-
// Before
|
|
559
|
-
class LoginViewModel {
|
|
560
|
-
var isLoading = false
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// After
|
|
564
|
-
@MainActor
|
|
565
|
-
class LoginViewModel: ObservableObject {
|
|
566
|
-
@Published var isLoading = false
|
|
567
|
-
}
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
- **Reference**: swift-best-practices/references/concurrency.md
|
|
169
|
+
## Spec Adherence
|
|
571
170
|
|
|
572
|
-
|
|
171
|
+
**Source**: PR #123 / Issue #456
|
|
573
172
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
173
|
+
| Requirement | Status | Location |
|
|
174
|
+
|-------------|--------|----------|
|
|
175
|
+
| User can log in with email | ✅ Implemented | LoginView.swift:23 |
|
|
176
|
+
| Show error on invalid credentials | ⚠️ Partial — missing 401 case | LoginViewModel.swift:67 |
|
|
177
|
+
| Persist session in Keychain | ❌ Not implemented | — |
|
|
178
|
+
| Rate limit retries | ❌ Not implemented | — |
|
|
579
179
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
let user = fetchUser()!
|
|
583
|
-
|
|
584
|
-
// After
|
|
585
|
-
guard let user = fetchUser() else {
|
|
586
|
-
logger.error("Failed to fetch user")
|
|
587
|
-
return
|
|
588
|
-
}
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
- **Reference**: Project coding standard (.claude/CLAUDE.md:45)
|
|
592
|
-
|
|
593
|
-
#### 💡 Refactoring Suggestions
|
|
594
|
-
|
|
595
|
-
1. **Extract Subview** (lines 120-150)
|
|
596
|
-
- Consider extracting login form into separate view
|
|
597
|
-
- Improves testability and reusability
|
|
180
|
+
**Scope creep**: 1 unrelated change (UserSettings.swift refactor) — recommend
|
|
181
|
+
splitting into a separate PR.
|
|
598
182
|
|
|
599
183
|
---
|
|
600
184
|
|
|
601
|
-
##
|
|
602
|
-
|
|
603
|
-
### Must Fix (Critical/High)
|
|
604
|
-
|
|
605
|
-
1. [ ] Fix data race in LoginViewModel.swift:67
|
|
606
|
-
2. [ ] Remove force unwrap in LoginView.swift:89
|
|
185
|
+
## <Filename.swift>
|
|
607
186
|
|
|
608
|
-
|
|
187
|
+
[Severity] **<Category>** (line N)
|
|
188
|
+
Current: `<problematic snippet>`
|
|
189
|
+
Fix: <explanation + corrected snippet>
|
|
609
190
|
|
|
610
|
-
|
|
611
|
-
|
|
191
|
+
## Positive Observations
|
|
192
|
+
...
|
|
612
193
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
194
|
+
## Prioritized Action Items
|
|
195
|
+
- [Must fix] ...
|
|
196
|
+
- [Should fix] ...
|
|
197
|
+
- [Consider] ...
|
|
617
198
|
|
|
618
199
|
---
|
|
619
200
|
|
|
620
|
-
##
|
|
621
|
-
|
|
622
|
-
- Excellent use of @Observable for state management
|
|
623
|
-
- Consistent adherence to project architecture (MVVM)
|
|
624
|
-
- Comprehensive accessibility support
|
|
625
|
-
- Strong error handling in most areas
|
|
626
|
-
- Good test coverage for core functionality
|
|
627
|
-
|
|
628
|
-
## References
|
|
201
|
+
## Agent Loop Feedback
|
|
629
202
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
- [Project Coding Standards](.claude/CLAUDE.md)
|
|
633
|
-
````
|
|
203
|
+
Recurring patterns suggest the following rules are missing or under-emphasized
|
|
204
|
+
in `.claude/CLAUDE.md`:
|
|
634
205
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
### Example 1: Review Specific File
|
|
638
|
-
|
|
639
|
-
```
|
|
640
|
-
User: "Review UserProfileView.swift"
|
|
206
|
+
### Pattern: Force-unwraps (4 occurrences)
|
|
207
|
+
**Files**: LoginView.swift:89, NetworkService.swift:34, UserRepo.swift:12,78
|
|
641
208
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
3. Run multi-layer analysis
|
|
646
|
-
4. Provide structured feedback with severity levels and positive feedback
|
|
647
|
-
```
|
|
209
|
+
**Suggested rule**:
|
|
210
|
+
> Never use `!`, `try!`, or `as!`. Use `guard let` with explicit early return,
|
|
211
|
+
> typed throws, or `as?` with handling. Force-unwraps are crashes waiting to happen.
|
|
648
212
|
|
|
649
|
-
###
|
|
213
|
+
### Pattern: Deprecated NavigationView (2 occurrences)
|
|
214
|
+
**Files**: ProfileView.swift:15, SettingsView.swift:22
|
|
650
215
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
Steps:
|
|
655
|
-
1. Read .claude/CLAUDE.md
|
|
656
|
-
2. Execute `git diff` to get changes
|
|
657
|
-
3. Identify modified files
|
|
658
|
-
4. Run analysis on each file
|
|
659
|
-
5. Generate comprehensive review report
|
|
660
|
-
```
|
|
216
|
+
**Suggested rule**:
|
|
217
|
+
> Use `NavigationStack` exclusively. `NavigationView` is deprecated as of iOS 16.
|
|
661
218
|
|
|
662
|
-
###
|
|
219
|
+
### Pattern: Business logic in View body (3 occurrences)
|
|
220
|
+
**Files**: LoginView.swift:45, ProfileView.swift:78, FeedView.swift:34
|
|
663
221
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
Steps:
|
|
668
|
-
1. Read .claude/CLAUDE.md
|
|
669
|
-
2. Execute `gh pr view 123` and `gh pr diff 123`
|
|
670
|
-
3. Identify changed files
|
|
671
|
-
4. Read affected files for context
|
|
672
|
-
5. Run multi-layer analysis
|
|
673
|
-
6. Generate report with file:line references
|
|
222
|
+
**Suggested rule**:
|
|
223
|
+
> Views must not contain business logic, network calls, or data transformations.
|
|
224
|
+
> Move all such work into the @Observable view model.
|
|
674
225
|
```
|
|
675
226
|
|
|
676
|
-
|
|
227
|
+
Full templates and severity classification: `references/feedback-templates.md`.
|
|
677
228
|
|
|
678
|
-
|
|
679
|
-
User: "Review LoginViewModel.swift against our coding standards"
|
|
680
|
-
|
|
681
|
-
Steps:
|
|
682
|
-
1. Read .claude/CLAUDE.md
|
|
683
|
-
2. Read related docs (DependencyInjection-Architecture.md)
|
|
684
|
-
3. Read LoginViewModel.swift
|
|
685
|
-
4. Validate against project-specific patterns
|
|
686
|
-
5. Provide detailed feedback comparing with standards
|
|
687
|
-
```
|
|
229
|
+
## Companion Skills
|
|
688
230
|
|
|
689
|
-
|
|
231
|
+
Full reference tables (all files, when to consult each): `references/companion-skills.md`.
|
|
690
232
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
4. Provide file-by-file review
|
|
699
|
-
5. Summarize common patterns and issues across all files
|
|
700
|
-
```
|
|
233
|
+
| Skill | Use for |
|
|
234
|
+
| ------------------------------ | ---------------------------------------------------------- |
|
|
235
|
+
| `skills/swiftui-expert-skill/` | SwiftUI state, Liquid Glass, macOS patterns, accessibility |
|
|
236
|
+
| `skills/swift-concurrency/` | Actors, Sendable, Swift 6 migration, async/await |
|
|
237
|
+
| `skills/swift-testing/` | Swift Testing framework, test doubles, snapshots |
|
|
238
|
+
| `skills/swift-expert/` | Swift 6+ patterns, protocols, memory, SPM |
|
|
239
|
+
| `skills/swiftui-ui-patterns/` | Navigation, sheets, theming, async state, grids |
|
|
701
240
|
|
|
702
|
-
|
|
241
|
+
## Platform Commands
|
|
703
242
|
|
|
243
|
+
```bash
|
|
244
|
+
# GitHub PR
|
|
245
|
+
gh pr diff <n>
|
|
246
|
+
gh pr view <n> --json files,comments
|
|
247
|
+
|
|
248
|
+
# GitLab MR
|
|
249
|
+
glab mr diff <n>
|
|
250
|
+
glab mr view <n> --json
|
|
251
|
+
|
|
252
|
+
# Local changes
|
|
253
|
+
git diff # unstaged
|
|
254
|
+
git diff --cached # staged
|
|
255
|
+
git diff HEAD~1 # last commit
|
|
256
|
+
git diff -- path/to/file.swift
|
|
704
257
|
```
|
|
705
|
-
User: "Review our navigation setup and routing code"
|
|
706
|
-
|
|
707
|
-
Steps:
|
|
708
|
-
1. Read .claude/CLAUDE.md for project navigation patterns
|
|
709
|
-
2. Read router/coordinator files (RouterPath, AppCoordinator, TabRouter)
|
|
710
|
-
3. Read root views that set up NavigationStack and TabView
|
|
711
|
-
4. Run navigation architecture checks:
|
|
712
|
-
- Route destinations use typed Hashable enum (not String/Int)
|
|
713
|
-
- RouterPath @Observable owns path (not ad-hoc @State)
|
|
714
|
-
- Single centralized .navigationDestination per stack
|
|
715
|
-
- .sheet(item:) preferred over .sheet(isPresented:) when model selected
|
|
716
|
-
- Multiple sheets use SheetDestination enum (not multiple booleans)
|
|
717
|
-
- Each tab has independent RouterPath (not shared)
|
|
718
|
-
- .onOpenURL at app root, not scattered in feature views
|
|
719
|
-
5. Run async state checks:
|
|
720
|
-
- .task(id:) for input-driven async work
|
|
721
|
-
- CancellationError silenced
|
|
722
|
-
- LoadState<T> enum instead of multiple booleans
|
|
723
|
-
6. Generate report with navigation-specific findings
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
## Resources
|
|
727
|
-
|
|
728
|
-
This skill includes the following reference materials:
|
|
729
|
-
|
|
730
|
-
### Core References
|
|
731
|
-
|
|
732
|
-
- **review-workflow.md**: Detailed step-by-step review process, git commands, and diff parsing strategies
|
|
733
|
-
- **feedback-templates.md**: Templates for positive/negative comments, severity classification guidelines
|
|
734
|
-
|
|
735
|
-
### Quality Checklists
|
|
736
|
-
|
|
737
|
-
- **swift-quality-checklist.md**: Swift 6+ concurrency, error handling, optionals, access control, naming
|
|
738
|
-
- **swiftui-review-checklist.md**: Property wrappers, state management, modern APIs, view composition
|
|
739
|
-
- **performance-review.md**: View updates, ForEach optimization, layout efficiency, resource management
|
|
740
|
-
- **security-checklist.md**: Input validation, sensitive data, keychain, network security
|
|
741
|
-
|
|
742
|
-
### Architecture & Customization
|
|
743
|
-
|
|
744
|
-
- **architecture-patterns.md**: MVVM, MVI, TCA patterns, dependency injection, testing strategies
|
|
745
|
-
- **custom-guidelines.md**: How to read and parse .claude/CLAUDE.md and project-specific standards
|
|
746
|
-
|
|
747
|
-
## Best Practices
|
|
748
|
-
|
|
749
|
-
1. **Always Read Project Guidelines First**
|
|
750
|
-
- Load `.claude/CLAUDE.md` before starting review
|
|
751
|
-
- Understand project-specific patterns and rules
|
|
752
|
-
- Merge project standards with Apple guidelines
|
|
753
|
-
|
|
754
|
-
2. **Provide Balanced Feedback**
|
|
755
|
-
- Include positive feedback for good practices
|
|
756
|
-
- Don't just criticize—acknowledge what's done well
|
|
757
|
-
- Suggest improvements, not just problems
|
|
758
|
-
|
|
759
|
-
3. **Be Specific and Actionable**
|
|
760
|
-
- Include exact file:line references
|
|
761
|
-
- Provide code examples for fixes
|
|
762
|
-
- Explain _why_ something is an issue
|
|
763
|
-
- Link to relevant documentation
|
|
764
|
-
|
|
765
|
-
4. **Prioritize by Severity**
|
|
766
|
-
- Critical: Must fix before merge (security, crashes, data races)
|
|
767
|
-
- High: Should fix before merge (anti-patterns, performance issues)
|
|
768
|
-
- Medium: Address soon (code quality, documentation)
|
|
769
|
-
- Low: Consider for future (style, refactoring suggestions)
|
|
770
|
-
|
|
771
|
-
5. **Leverage Existing Skills**
|
|
772
|
-
- Reference swift-best-practices for language patterns
|
|
773
|
-
- Use swiftui-expert-skill for UI code
|
|
774
|
-
- Apply swiftui-performance-audit for performance concerns
|
|
775
|
-
- Don't duplicate their content—point to their knowledge
|
|
776
|
-
|
|
777
|
-
6. **Focus on Education**
|
|
778
|
-
- Explain the reasoning behind feedback
|
|
779
|
-
- Link to learning resources
|
|
780
|
-
- Help developers understand best practices
|
|
781
|
-
- Foster continuous improvement
|
|
782
258
|
|
|
783
259
|
## Limitations
|
|
784
260
|
|
|
785
|
-
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
-
|
|
789
|
-
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
261
|
+
- Spec adherence checks require an accessible PR description or linked issue.
|
|
262
|
+
When reviewing local changes with no PR context, mark spec adherence as
|
|
263
|
+
"not assessed" rather than guessing intent.
|
|
264
|
+
- Agent loop feedback assumes the code was AI-generated or AI-assisted. For
|
|
265
|
+
fully human-written code, recurring patterns are still useful but should be
|
|
266
|
+
framed as team coding standards rather than agent instructions.
|
|
267
|
+
|
|
268
|
+
## Reference Files
|
|
269
|
+
|
|
270
|
+
- `references/review-workflow.md` — detailed process, diff parsing, git commands
|
|
271
|
+
- `references/feedback-templates.md` — output templates, severity classification
|
|
272
|
+
- `references/spec-adherence.md` — parsing PR/issue specs, requirement coverage tables, scope creep classification
|
|
273
|
+
- `references/agent-loop-feedback.md` — recurring-pattern threshold, directive phrasing, suggested-rule template
|
|
274
|
+
- `references/swift-quality-checklist.md` — Swift 6+, concurrency, optionals, naming
|
|
275
|
+
- `references/swiftui-review-checklist.md` — property wrappers, state, modern APIs
|
|
276
|
+
- `references/performance-review.md` — view optimization, ForEach, resource management
|
|
277
|
+
- `references/security-checklist.md` — input validation, Keychain, network security
|
|
278
|
+
- `references/architecture-patterns.md` — MVVM/MVI/TCA, DI, testability
|
|
279
|
+
- `references/custom-guidelines.md` — parsing `.claude/CLAUDE.md`
|
|
280
|
+
- `references/companion-skills.md` — full companion skill tables
|