axiom-swiftui-debugging-diag
Use when SwiftUI view debugging requires systematic investigation - view updates not working after basic troubleshooting, intermittent UI issues, complex…
от ComeOnOliver★ 67 звёзд на GitHub
Установить axiom-swiftui-debugging-diag в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
SwiftUI Debugging Diagnostics
When to Use This Diagnostic Skill
Use this skill when:
- Basic troubleshooting failed — Applied
axiom-swiftui-debuggingskill 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:
# 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 misleading profiling data
Diagnostic Decision Tree
SwiftUI view issue after basic troubleshooting?
│
├─ View not updating?
│ ├─ Basic check: Add Self._printChanges() temporarily
│ │ ├─ Shows "@self changed" → View value changed
│ │ │ └─ Pattern D1: Analyze what caused view recreation
│ │ ├─ Shows specific state property → That state triggered update
│ │ │ └─ Verify: Should that state trigger update?
│ │ └─ Nothing logged → Body not being called at all
│ │ └─ Pattern D3: View Identity Investigation
│ └─ Advanced: Use SwiftUI Instrument
│ └─ Pattern D2: SwiftUI Instrument Investigation
│
├─ View updating too often?
│ ├─ Pattern D1: Self._printChanges() Analysis
│ │ └─ Identify unnecessary state dependencies
│ └─ Pattern D2: SwiftUI Instrument → Cause & Effect Graph
│ └─ Trace data flow, find broad dependencies
│
├─ Intermittent issues (works sometimes)?
│ ├─ Pattern D3: View Identity Investigation
│ │ └─ Check: Does identity change unexpectedly?
│ ├─ Pattern D4: Environment Dependency Check
│ │ └─ Check: Environment values changing frequently?
│ └─ Reproduce in preview 30+ times
│ └─ If can't reproduce: Likely timing/race condition
│
└─ Preview crashes (after basic fixes)?
├─ Pattern D5: Preview Diagnostics (Xcode 26)
│ └─ Check diagnostics button, crash logs
└─ If still fails: Pattern D2 (profile preview build)
Diagnostic Patterns
Pattern D1: Self._printChanges() Analysis
Time cost: 5 minutes
Symptom: Need to understand exactly why view body runs
When to use:
- View updating more often than expected
- View not updating when it should
- Verifying dependencies after refactoring
Technique:
struct MyView: View {
@State private var count = 0
@Environment(AppModel.self) private var model
var body: some View {
let _ = Self._printChanges() // Add temporarily
VStack {
Text("Count: \(count)")
Text("Model value: \(model.value)")
}
}
}
Output interpretation:
# Scenario 1: View parameter changed
MyView: @self changed
→ Parent passed new MyView instance
→ Check parent code - what triggered recreation?
# Scenario 2: State property changed
MyView: count changed
→ Local @State triggered update
→ Expected if you modified count
# Scenario 3: Environment property changed
MyView: @self changed # Environment is part of @self
→ Environment value changed (color scheme, locale, custom value)
→ Pattern D4: Check environment dependencies
# Scenario 4: Nothing logged
→ Body not being called
→ Pattern D3: View identity investigation
Common discoveries:
"@self changed" when you don't expect
- Parent recreating view unnecessarily
- Check parent's state management
Property shows changed but you didn't change it
- Indirect dependency (reading from object that changed)
- Pattern D2: Use Instruments to trace
*Multiple properties changing together
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл axiom-swiftui-debugging-diag?
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
Как установить скилл axiom-swiftui-debugging-diag?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл axiom-swiftui-debugging-diag запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…