swift-code-reviewer-skill 1.2.0 → 1.2.1

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +35 -169
  2. package/README.md +43 -2
  3. package/SKILL.md +107 -742
  4. package/bin/install.js +1 -1
  5. package/package.json +2 -1
  6. package/references/companion-skills.md +70 -0
  7. package/skills/README.md +43 -0
  8. package/skills/swift-concurrency/NOTICE.md +18 -0
  9. package/skills/swift-concurrency/SKILL.md +235 -0
  10. package/skills/swift-concurrency/references/actors.md +640 -0
  11. package/skills/swift-concurrency/references/async-await-basics.md +249 -0
  12. package/skills/swift-concurrency/references/async-sequences.md +635 -0
  13. package/skills/swift-concurrency/references/core-data.md +533 -0
  14. package/skills/swift-concurrency/references/glossary.md +96 -0
  15. package/skills/swift-concurrency/references/linting.md +38 -0
  16. package/skills/swift-concurrency/references/memory-management.md +542 -0
  17. package/skills/swift-concurrency/references/migration.md +721 -0
  18. package/skills/swift-concurrency/references/performance.md +574 -0
  19. package/skills/swift-concurrency/references/sendable.md +578 -0
  20. package/skills/swift-concurrency/references/tasks.md +604 -0
  21. package/skills/swift-concurrency/references/testing.md +565 -0
  22. package/skills/swift-concurrency/references/threading.md +452 -0
  23. package/skills/swift-expert/NOTICE.md +18 -0
  24. package/skills/swift-expert/SKILL.md +226 -0
  25. package/skills/swift-expert/references/async-concurrency.md +363 -0
  26. package/skills/swift-expert/references/memory-performance.md +380 -0
  27. package/skills/swift-expert/references/protocol-oriented.md +357 -0
  28. package/skills/swift-expert/references/swiftui-patterns.md +294 -0
  29. package/skills/swift-expert/references/testing-patterns.md +402 -0
  30. package/skills/swift-testing/NOTICE.md +18 -0
  31. package/skills/swift-testing/SKILL.md +295 -0
  32. package/skills/swift-testing/references/async-testing.md +245 -0
  33. package/skills/swift-testing/references/dump-snapshot-testing.md +265 -0
  34. package/skills/swift-testing/references/fixtures.md +193 -0
  35. package/skills/swift-testing/references/integration-testing.md +189 -0
  36. package/skills/swift-testing/references/migration-xctest.md +301 -0
  37. package/skills/swift-testing/references/parameterized-tests.md +171 -0
  38. package/skills/swift-testing/references/snapshot-testing.md +201 -0
  39. package/skills/swift-testing/references/test-doubles.md +243 -0
  40. package/skills/swift-testing/references/test-organization.md +231 -0
  41. package/skills/swiftui-expert-skill/NOTICE.md +18 -0
  42. package/skills/swiftui-expert-skill/SKILL.md +281 -0
  43. package/skills/swiftui-expert-skill/references/accessibility-patterns.md +151 -0
  44. package/skills/swiftui-expert-skill/references/animation-advanced.md +403 -0
  45. package/skills/swiftui-expert-skill/references/animation-basics.md +284 -0
  46. package/skills/swiftui-expert-skill/references/animation-transitions.md +326 -0
  47. package/skills/swiftui-expert-skill/references/charts-accessibility.md +135 -0
  48. package/skills/swiftui-expert-skill/references/charts.md +602 -0
  49. package/skills/swiftui-expert-skill/references/image-optimization.md +203 -0
  50. package/skills/swiftui-expert-skill/references/latest-apis.md +464 -0
  51. package/skills/swiftui-expert-skill/references/layout-best-practices.md +266 -0
  52. package/skills/swiftui-expert-skill/references/liquid-glass.md +414 -0
  53. package/skills/swiftui-expert-skill/references/list-patterns.md +394 -0
  54. package/skills/swiftui-expert-skill/references/macos-scenes.md +318 -0
  55. package/skills/swiftui-expert-skill/references/macos-views.md +357 -0
  56. package/skills/swiftui-expert-skill/references/macos-window-styling.md +303 -0
  57. package/skills/swiftui-expert-skill/references/performance-patterns.md +403 -0
  58. package/skills/swiftui-expert-skill/references/scroll-patterns.md +293 -0
  59. package/skills/swiftui-expert-skill/references/sheet-navigation-patterns.md +363 -0
  60. package/skills/swiftui-expert-skill/references/state-management.md +417 -0
  61. package/skills/swiftui-expert-skill/references/view-structure.md +389 -0
  62. package/skills/swiftui-ui-patterns/NOTICE.md +18 -0
  63. package/skills/swiftui-ui-patterns/SKILL.md +95 -0
  64. package/skills/swiftui-ui-patterns/references/app-wiring.md +201 -0
  65. package/skills/swiftui-ui-patterns/references/async-state.md +96 -0
  66. package/skills/swiftui-ui-patterns/references/components-index.md +50 -0
  67. package/skills/swiftui-ui-patterns/references/controls.md +57 -0
  68. package/skills/swiftui-ui-patterns/references/deeplinks.md +66 -0
  69. package/skills/swiftui-ui-patterns/references/focus.md +90 -0
  70. package/skills/swiftui-ui-patterns/references/form.md +97 -0
  71. package/skills/swiftui-ui-patterns/references/grids.md +71 -0
  72. package/skills/swiftui-ui-patterns/references/haptics.md +71 -0
  73. package/skills/swiftui-ui-patterns/references/input-toolbar.md +51 -0
  74. package/skills/swiftui-ui-patterns/references/lightweight-clients.md +93 -0
  75. package/skills/swiftui-ui-patterns/references/list.md +86 -0
  76. package/skills/swiftui-ui-patterns/references/loading-placeholders.md +38 -0
  77. package/skills/swiftui-ui-patterns/references/macos-settings.md +71 -0
  78. package/skills/swiftui-ui-patterns/references/matched-transitions.md +59 -0
  79. package/skills/swiftui-ui-patterns/references/media.md +73 -0
  80. package/skills/swiftui-ui-patterns/references/menu-bar.md +101 -0
  81. package/skills/swiftui-ui-patterns/references/navigationstack.md +159 -0
  82. package/skills/swiftui-ui-patterns/references/overlay.md +45 -0
  83. package/skills/swiftui-ui-patterns/references/performance.md +62 -0
  84. package/skills/swiftui-ui-patterns/references/previews.md +48 -0
  85. package/skills/swiftui-ui-patterns/references/scroll-reveal.md +133 -0
  86. package/skills/swiftui-ui-patterns/references/scrollview.md +87 -0
  87. package/skills/swiftui-ui-patterns/references/searchable.md +71 -0
  88. package/skills/swiftui-ui-patterns/references/sheets.md +155 -0
  89. package/skills/swiftui-ui-patterns/references/split-views.md +72 -0
  90. package/skills/swiftui-ui-patterns/references/tabview.md +114 -0
  91. package/skills/swiftui-ui-patterns/references/theming.md +71 -0
  92. package/skills/swiftui-ui-patterns/references/title-menus.md +93 -0
  93. package/skills/swiftui-ui-patterns/references/top-bar.md +49 -0
package/SKILL.md CHANGED
@@ -1,797 +1,162 @@
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: "Multi-layer code review agent for Swift and SwiftUI projects. Analyzes PRs, diffs, and files across six dimensions: Swift 6+ concurrency safety, SwiftUI state management and modern APIs, performance (view updates, ForEach identity, lazy loading), security (force unwraps, Keychain, input validation), architecture compliance (MVVM/MVI/TCA, dependency injection), and project-specific standards from .claude/CLAUDE.md. Outputs structured reports with Critical/High/Medium/Low severity, positive feedback, and prioritized action items with file:line references. Use when the user says review this PR, review my code, review my changes, check this file, code review, audit this codebase, check code quality, review uncommitted changes, review all ViewModels, or mentions reviewing .swift files, navigation, sheets, theming, or async patterns."
21
4
  ---
22
5
 
23
6
  # Swift/SwiftUI Code Review Skill
24
7
 
25
- ## Overview
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.
26
9
 
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.
10
+ ## Workflow
28
11
 
29
- ### Key Capabilities
12
+ ### Phase 1 — Context Gathering
30
13
 
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
14
+ 1. Try to load `.claude/CLAUDE.md`.
15
+ - **If missing**: add a note to the report _"No project standards file found — review uses default Apple guidelines"_ — then continue.
16
+ 2. Obtain the changeset: `git diff`, `git diff --cached`, or `gh pr diff <n>`.
17
+ - **If diff is empty**: stop and ask the user to specify files, a PR number, or a directory.
18
+ 3. Read each changed file plus key related files (imports, protocols it conforms to, corresponding test file if present).
36
19
 
37
- ## When to Use This Skill
20
+ ### Phase 2 Analysis
38
21
 
39
- Use this skill when you need to:
22
+ For each category, load the reference file before writing findings:
40
23
 
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
24
+ 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`
25
+ 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`
26
+ 3. **Performance** view body cost, ForEach identity, lazy loading, retain cycles → `references/performance-review.md`
27
+ 4. **Security** force unwraps, Keychain vs UserDefaults, input validation, no secrets in logs → `references/security-checklist.md`
28
+ 5. **Architecture** MVVM/MVI/TCA compliance, DI, testability → `references/architecture-patterns.md`
29
+ 6. **Project Standards** validate against `.claude/CLAUDE.md` rules → `references/custom-guidelines.md`
48
30
 
49
- **Trigger patterns:**
31
+ For test file findings, consult `skills/swift-testing/references/test-organization.md`.
32
+ For navigation/routing findings, consult `skills/swiftui-ui-patterns/references/navigationstack.md`.
50
33
 
51
- - "Review this PR"
52
- - "Review [filename].swift"
53
- - "Review my changes"
54
- - "Code review for [component]"
55
- - "Check if this follows our coding standards"
56
- - "Review against .claude/CLAUDE.md"
34
+ ### Phase 3 — Report
57
35
 
58
- ## Review Workflow
36
+ Group findings by file → sort by severity within each file → write prioritized action items.
59
37
 
60
- The skill follows a **four-phase workflow** to ensure comprehensive and actionable feedback:
38
+ Severity: **Critical** (crash/data race/security hole) · **High** (anti-pattern/major arch violation) · **Medium** (quality/maintainability) · **Low** (style/suggestion).
61
39
 
62
- ### Phase 1: Context Gathering
40
+ Include one-sentence positive feedback where code is notably well-written. Never pad with generic praise.
63
41
 
64
- **Objective**: Understand the project context and scope of review
42
+ ## Concrete Finding Examples
65
43
 
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
44
+ ### Force Unwrap → guard let (Critical)
70
45
 
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)
46
+ **`LoginViewModel.swift:89`** Current:
77
47
 
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:**
332
-
333
- - Force unwrap detection (`!`, `as!`, `try!`)
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)
340
-
341
- **Reference:** `references/security-checklist.md`
342
-
343
- ### 5. Architecture & Design
344
-
345
- **What to Check:**
346
-
347
- - MVVM, MVI, TCA, or other architecture compliance
348
- - Dependency injection patterns
349
- - Separation of concerns
350
- - Module boundaries
351
- - Code organization
352
- - Testability
353
- - Documentation quality
354
-
355
- **Reference:** `references/architecture-patterns.md`
356
-
357
- ### 6. Project-Specific Standards
358
-
359
- **What to Check:**
360
-
361
- - `.claude/CLAUDE.md` compliance
362
- - Custom architecture patterns
363
- - Design system usage
364
- - Navigation patterns
365
- - Error handling standards
366
- - Testing requirements
367
-
368
- **Reference:** `references/custom-guidelines.md`
369
-
370
- ## Integration with Existing Skills
371
-
372
- This skill **references** (not duplicates) three foundational skills for domain expertise:
373
-
374
- ### 1. swift-best-practices
375
-
376
- **When to Use:** Reviewing Swift language usage, concurrency patterns, API design, or Swift 6+ migration
377
-
378
- **What it Provides:**
379
-
380
- - Swift 6+ concurrency patterns (actors, async/await, Sendable)
381
- - API design guidelines compliance
382
- - Availability pattern validation
383
- - Breaking changes detection
384
- - Modern Swift feature adoption
385
-
386
- **How to Leverage:**
387
-
388
- - Read `~/.claude/skills/swift-best-practices/references/concurrency.md` for concurrency checks
389
- - Reference `swift6-features.md` for Swift 6 migration patterns
390
- - Use `api-design.md` for naming and parameter validation
391
-
392
- ### 2. swiftui-expert-skill
393
-
394
- **When to Use:** Reviewing SwiftUI views, state management, or UI code
395
-
396
- **What it Provides:**
397
-
398
- - State management patterns (@Observable, @State, @Binding)
399
- - Modern SwiftUI API guidance (iOS 17+, macOS 14+)
400
- - View composition best practices
401
- - Property wrapper selection guide
402
- - Accessibility patterns
403
-
404
- **How to Leverage:**
405
-
406
- - Read `~/.claude/skills/swiftui-expert-skill/references/state-management.md` for property wrapper checks
407
- - Reference `modern-apis.md` for deprecation detection
408
- - Use `view-composition.md` for component structure validation
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>
48
+ ```swift
49
+ let user = repository.currentUser!
50
+ ```
464
51
 
465
- # Get PR diff
466
- gh pr diff <PR-number>
52
+ **Finding**: crashes if `currentUser` is `nil` (e.g., after sign-out race condition).
467
53
 
468
- # List PR files
469
- gh pr view <PR-number> --json files
54
+ **Fix**:
470
55
 
471
- # Get PR comments
472
- gh pr view <PR-number> --json comments
56
+ ```swift
57
+ guard let user = repository.currentUser else {
58
+ logger.error("currentUser nil — aborting login flow")
59
+ return
60
+ }
473
61
  ```
474
62
 
475
- ### GitLab Merge Requests
63
+ ---
476
64
 
477
- Use `glab` CLI for fetching MR data:
65
+ ### Missing @MainActor on UI-bound ViewModel (High)
478
66
 
479
- ```bash
480
- # Get MR details
481
- glab mr view <MR-number>
67
+ **`FeedViewModel.swift:12`** — Current:
482
68
 
483
- # Get MR diff
484
- glab mr diff <MR-number>
69
+ ```swift
70
+ class FeedViewModel: ObservableObject {
71
+ @Published var posts: [Post] = []
485
72
 
486
- # List MR files
487
- glab mr view <MR-number> --json
488
-
489
- # Get MR comments
490
- glab mr note list <MR-number>
73
+ func load() async {
74
+ posts = try? await api.fetchPosts() // ⚠️ mutates @Published off main thread
75
+ }
76
+ }
491
77
  ```
492
78
 
493
- ### Local Git Changes
79
+ **Finding**: `@Published` mutations must happen on the main actor in Swift 6 strict concurrency; this is a data race.
494
80
 
495
- For uncommitted changes or manual review:
81
+ **Fix**:
496
82
 
497
- ```bash
498
- # Get uncommitted changes
499
- git diff
83
+ ```swift
84
+ @MainActor
85
+ @Observable
86
+ final class FeedViewModel {
87
+ var posts: [Post] = []
500
88
 
501
- # Get staged changes
502
- git diff --cached
503
-
504
- # Get changes in specific files
505
- git diff -- path/to/file.swift
506
-
507
- # Get commit diff
508
- git show <commit-hash>
89
+ func load() async throws {
90
+ posts = try await api.fetchPosts() // safe: whole class is @MainActor-isolated
91
+ }
92
+ }
509
93
  ```
510
94
 
511
- ## Output Format
95
+ Also migrate from `ObservableObject`/`@Published` to `@Observable` (iOS 17+) — see `skills/swiftui-expert-skill/references/state-management.md`.
512
96
 
513
- The review report follows this structure:
97
+ ## Output Format
514
98
 
515
- ````markdown
516
- # Code Review Report
99
+ ```
100
+ # Code Review — <scope>
517
101
 
518
102
  ## Summary
103
+ Files: N | Critical: N | High: N | Medium: N | Low: N
519
104
 
520
- - **Files Reviewed**: X
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
571
-
572
- #### 🟡 High Priority
573
-
574
- 1. **Force Unwrap Detected** (line 89)
575
- - **Severity**: High
576
- - **Category**: Safety
577
- - **Issue**: Force unwrapping optional can cause crash
578
- - **Fix**:
579
-
580
- ```swift
581
- // Before
582
- let user = fetchUser()!
105
+ ## <Filename.swift>
583
106
 
584
- // After
585
- guard let user = fetchUser() else {
586
- logger.error("Failed to fetch user")
587
- return
588
- }
589
- ```
107
+ [Severity] **<Category>** (line N)
108
+ Current: `<problematic snippet>`
109
+ Fix: <explanation + corrected snippet>
590
110
 
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
598
-
599
- ---
111
+ ## Positive Observations
112
+ ...
600
113
 
601
114
  ## Prioritized Action Items
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
607
-
608
- ### Should Fix (Medium)
609
-
610
- 1. [ ] Add documentation to public APIs
611
- 2. [ ] Improve error handling in NetworkService.swift
612
-
613
- ### Consider (Low)
614
-
615
- 1. [ ] Refactor login form into separate view
616
- 2. [ ] Add more unit tests for edge cases
617
-
618
- ---
619
-
620
- ## Positive Patterns Observed
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
629
-
630
- - [Swift Best Practices](~/.claude/skills/swift-best-practices/SKILL.md)
631
- - [SwiftUI Expert Guide](~/.claude/skills/swiftui-expert-skill/SKILL.md)
632
- - [Project Coding Standards](.claude/CLAUDE.md)
633
- ````
634
-
635
- ## How to Use
636
-
637
- ### Example 1: Review Specific File
638
-
639
- ```
640
- User: "Review UserProfileView.swift"
641
-
642
- Steps:
643
- 1. Read .claude/CLAUDE.md for project standards
644
- 2. Read UserProfileView.swift
645
- 3. Run multi-layer analysis
646
- 4. Provide structured feedback with severity levels and positive feedback
115
+ - [Must fix] ...
116
+ - [Should fix] ...
117
+ - [Consider] ...
647
118
  ```
648
119
 
649
- ### Example 2: Review Git Changes
650
-
651
- ```
652
- User: "Review my uncommitted changes"
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
- ```
120
+ Full templates and severity classification: `references/feedback-templates.md`.
661
121
 
662
- ### Example 3: Review Pull Request
122
+ ## Companion Skills
663
123
 
664
- ```
665
- User: "Review PR #123"
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
674
- ```
124
+ Full reference tables (all files, when to consult each): `references/companion-skills.md`.
675
125
 
676
- ### Example 4: Review Against Custom Guidelines
126
+ | Skill | Use for |
127
+ | ------------------------------ | ---------------------------------------------------------- |
128
+ | `skills/swiftui-expert-skill/` | SwiftUI state, Liquid Glass, macOS patterns, accessibility |
129
+ | `skills/swift-concurrency/` | Actors, Sendable, Swift 6 migration, async/await |
130
+ | `skills/swift-testing/` | Swift Testing framework, test doubles, snapshots |
131
+ | `skills/swift-expert/` | Swift 6+ patterns, protocols, memory, SPM |
132
+ | `skills/swiftui-ui-patterns/` | Navigation, sheets, theming, async state, grids |
677
133
 
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
- ```
134
+ ## Platform Commands
688
135
 
689
- ### Example 5: Review Multiple Files
690
-
691
- ```
692
- User: "Review all ViewModels in the Features folder"
693
-
694
- Steps:
695
- 1. Read .claude/CLAUDE.md
696
- 2. Find all *ViewModel.swift files in Features/
697
- 3. Analyze each against architecture patterns
698
- 4. Provide file-by-file review
699
- 5. Summarize common patterns and issues across all files
700
- ```
701
-
702
- ### Example 6: Review Navigation / Routing Code
703
-
704
- ```
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
136
+ ```bash
137
+ # GitHub PR
138
+ gh pr diff <n>
139
+ gh pr view <n> --json files,comments
140
+
141
+ # GitLab MR
142
+ glab mr diff <n>
143
+ glab mr view <n> --json
144
+
145
+ # Local changes
146
+ git diff # unstaged
147
+ git diff --cached # staged
148
+ git diff HEAD~1 # last commit
149
+ git diff -- path/to/file.swift
724
150
  ```
725
151
 
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
-
783
- ## Limitations
784
-
785
- - Cannot execute code or run tests (can only analyze statically)
786
- - Cannot access external systems or APIs
787
- - Limited to analyzing code provided or accessible via git
788
- - Cannot detect runtime issues that require execution
789
- - Performance analysis is based on patterns, not profiling data
790
-
791
- For runtime analysis, recommend using Instruments or other profiling tools.
792
-
793
- ## Version
794
-
795
- **Version**: 1.2.0
796
- **Last Updated**: 2026-04-10
797
- **Compatible with**: Swift 6+, SwiftUI (iOS 17+, macOS 14+, watchOS 10+, tvOS 17+, visionOS 1+)
152
+ ## Reference Files
153
+
154
+ - `references/review-workflow.md` detailed process, diff parsing, git commands
155
+ - `references/feedback-templates.md` — output templates, severity classification
156
+ - `references/swift-quality-checklist.md` — Swift 6+, concurrency, optionals, naming
157
+ - `references/swiftui-review-checklist.md` — property wrappers, state, modern APIs
158
+ - `references/performance-review.md` view optimization, ForEach, resource management
159
+ - `references/security-checklist.md` input validation, Keychain, network security
160
+ - `references/architecture-patterns.md` — MVVM/MVI/TCA, DI, testability
161
+ - `references/custom-guidelines.md` — parsing `.claude/CLAUDE.md`
162
+ - `references/companion-skills.md` — full companion skill tables