Agent skill
swift-diagnostics
Use when debugging NavigationStack issues (not responding, unexpected pops, crashes), build failures (SPM resolution, "No such module", hanging builds), or memory problems (retain cycles, leaks, deinit not called). Systematic diagnostic workflows for iOS/macOS.
Install this agent skill to your Project
npx add-skill https://github.com/johnrogers/claude-swift-engineering/tree/main/plugins/swift-engineering/skills/swift-diagnostics
SKILL.md
Swift Diagnostics
Systematic debugging workflows for iOS/macOS development. These patterns help identify root causes in minutes rather than hours by following structured diagnostic approaches.
Reference Loading Guide
ALWAYS load reference files if there is even a small chance the content may be required. It's better to have the context than to miss a pattern or make a mistake.
| Reference | Load When |
|---|---|
| Navigation | NavigationStack not responding, unexpected pops, deep link failures |
| Build Issues | SPM resolution, "No such module", dependency conflicts |
| Memory | Retain cycles, memory growth, deinit not called |
| Build Performance | Slow builds, Derived Data issues, Xcode hangs |
| Xcode Debugging | LLDB commands, breakpoints, view debugging |
Core Workflow
- Identify symptom category - Navigation, build, memory, or performance
- Load the relevant reference - Each has diagnostic decision trees
- Run mandatory first checks - Before changing any code
- Follow the decision tree - Reach diagnosis in 2-5 minutes
- Apply fix and verify - One fix at a time, test each
Key Principle
80% of "mysterious" issues stem from predictable patterns:
- Navigation: Path state management or destination placement
- Build: Stale caches or dependency resolution
- Memory: Timer/observer leaks or closure captures
- Performance: Environment problems, not code bugs
Diagnose systematically. Never guess.
Common Mistakes
-
Skipping mandatory first checks — Jumping straight to code changes before running diagnostics (clean build, restart simulator, restart Xcode) means you'll chase ghosts. Always start with the mandatory checks.
-
Changing multiple things at once — "Let me delete DerivedData AND restart simulator AND kill Xcode" means you can't isolate which fix actually worked. Change one variable at a time.
-
Assuming you know the cause — "NavigationStack stopped working, must be my reducer" — actually it was stale DerivedData. Diagnostic trees prevent assumptions. Follow the tree, don't guess.
-
Missing memory basics — Calling
deinitnot being called is a retain cycle, but beginners often blame architecture. Use Instruments to verify leaks before refactoring. Data, not intuition. -
Not isolating the problem — Testing with your whole app complicates diagnosis. Create a minimal reproducible example with just the problematic feature. Isolation reveals root causes.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
swiftui-advanced
Use when implementing gesture composition (simultaneous, sequenced, exclusive), adaptive layouts (ViewThatFits, AnyLayout, size classes), or choosing architecture patterns (MVVM vs TCA vs vanilla, State-as-Bridge). Covers advanced SwiftUI patterns beyond basic views.
ios-hig
Use when designing iOS interfaces, implementing accessibility (VoiceOver, Dynamic Type), handling dark mode, ensuring adequate touch targets, providing animation/haptic feedback, or requesting user permissions. Apple Human Interface Guidelines for iOS compliance.
ios-26-platform
Use when implementing iOS 26 features (Liquid Glass, new SwiftUI APIs, WebView, Chart3D), deploying iOS 26+ apps, or supporting backward compatibility with iOS 17/18.
swiftui-patterns
Use when implementing iOS 17+ SwiftUI patterns: @Observable/@Bindable, MVVM architecture, NavigationStack, lazy loading, UIKit interop, accessibility (VoiceOver/Dynamic Type), async operations (.task/.refreshable), or migrating from ObservableObject/@StateObject.
grdb
Use when writing raw SQL with GRDB, complex joins across 4+ tables, window functions, ValueObservation for reactive queries, or dropping down from SQLiteData for performance. Direct SQLite access for iOS/macOS with type-safe queries and migrations.
swift-testing
Use when writing tests with Swift Testing (@Test,
Didn't find tool you were looking for?