Use when SwiftUI view debugging requires systematic investigation - view updates not working after basic troubleshooting, intermittent UI issues, complex state dependencies, or when Self._printChanges() shows unexpected update patterns - systematic diagnostic workflows with Instruments integration
View on GitHubCharlesWiltgen/Axiom
axiom
.claude-plugin/plugins/axiom/skills/axiom-swiftui-debugging-diag/SKILL.md
January 16, 2026
Select agents to install to:
npx add-skill https://github.com/CharlesWiltgen/Axiom/blob/main/.claude-plugin/plugins/axiom/skills/axiom-swiftui-debugging-diag/SKILL.md -a claude-code --skill axiom-swiftui-debugging-diagInstallation paths:
.claude/skills/axiom-swiftui-debugging-diag/# SwiftUI Debugging Diagnostics
## When to Use This Diagnostic Skill
Use this skill when:
- **Basic troubleshooting failed** — Applied `axiom-swiftui-debugging` skill patterns but issue persists
- **Self._printChanges() shows unexpected patterns** — View updating when it shouldn't, or not updating when it should
- **Intermittent issues** — Works sometimes, fails other times ("heisenbug")
- **Complex dependency chains** — Need to trace data flow through multiple views/models
- **Performance investigation** — Views updating too often or taking too long
- **Preview mysteries** — Crashes or failures that aren't immediately obvious
## FORBIDDEN Actions
Under pressure, you'll be tempted to shortcuts that hide problems instead of diagnosing them. **NEVER do these**:
❌ **Guessing with random @State/@Observable changes**
- "Let me try adding @Observable here and see if it works"
- "Maybe if I change this to @StateObject it'll fix it"
❌ **Adding .id(UUID()) to force updates**
- Creates new view identity every render
- Destroys state preservation
- Masks root cause
❌ **Using ObservableObject when @Observable would work** (iOS 17+)
- Adds unnecessary complexity
- Miss out on automatic dependency tracking
❌ **Ignoring intermittent issues** ("works sometimes")
- "I'll just merge and hope it doesn't happen in production"
- Intermittent = systematic bug, not randomness
❌ **Shipping without understanding**
- "The fix works, I don't know why"
- Production is too expensive for trial-and-error
## Mandatory First Steps
Before diving into diagnostic patterns, establish baseline environment:
```bash
# 1. Verify Instruments setup
xcodebuild -version # Must be Xcode 26+ for SwiftUI Instrument
# 2. Build in Release mode for profiling
xcodebuild build -scheme YourScheme -configuration Release
# 3. Clear derived data if investigating preview issues
rm -rf ~/Library/Developer/Xcode/DerivedData
```
**Time cost**: 5 minutes
**Why**: Wrong Xcode version or Debug mode produces misle