agentleFS
moasqmoasq/ios-dev-agent/.agents/skills/crash/SKILL.md

crash

Skill4 starsChanged 6 months agoMITView on GitHub

Use when a runtime crash occurs, the app crashes on a specific screen, or the user reports an EXC_BREAKPOINT / signal abort. Runs automated smoke tests first, then investigates with crash logs and backtraces.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 11 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the user reports a crash ("the app crashes when...") or you need to verify stability:

    line 12
  2. Distinctive:

    Use Xcode MCP to run the smoke walker:

    line 20
  3. Distinctive:

    If the smoke walker test target doesn't exist yet, see the Setup section below.

    line 34
  4. Distinctive:

    If a test fails, the Xcode MCP response includes:

    line 38
  5. Distinctive:

    After a test crash, check for crash logs:

    line 57
  6. Distinctive:

    If found, read the crash log and extract:

    line 63
  7. Very specific:

    Follow the /debugging skill methodology:

    line 100
  8. Distinctive:

    Read the file at the first app frame

    line 101
  9. Distinctive:

    Check error ledger history for matching patterns

    line 102
  10. Distinctive:

    If match → apply known fix

    line 103
  11. Distinctive:

    If no match → isolate by simplifying the crashing view

    line 104
  12. Very specific:

    Update ledger to [RESOLVED]

    line 106
  13. Distinctive:

    If no UI test target exists:

    line 124
  14. Very specific:

    Add .accessibilityIdentifier("name") to key interactive elements:

    line 164

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Runtime Crash Investigation

Automated crash detection and resolution for iOS apps.

Quick Start

When the user reports a crash ("the app crashes when...") or you need to verify stability:

  1. Run the smoke walker test — this walks every screen automatically
  2. If test fails — you have the exact crash point, skip to Step 4
  3. If test passes — the crash is flow-specific, investigate manually

Step 1: Run Automated Smoke Tests

Use Xcode MCP to run the smoke walker:

mcp__xcode__RunSomeTests with:
  targetName: "<AppName>UITests"
  testIdentifier: "SmokeWalkerTest"

Or run a specific test if you suspect a particular flow:

  • SmokeWalkerTest/testFullLoggingFlow — full 4-step logging
  • SmokeWalkerTest/testQuickSaveFlow — quick save from severity
  • SmokeWalkerTest/testStepNavigation — back/forward between steps
  • SmokeWalkerTest/testMigraineDetailAndEdit — detail view + edit mode

If the smoke walker test target doesn't exist yet, see the Setup section below.

Step 2: Parse Test Results

If a test fails, the Xcode MCP response includes:

  • Which test method failed — tells you which screen/flow crashed
  • The assertion message — tells you what was expected vs what happened
  • If it's a crash — no assertion, the app terminated unexpectedly

Map the failing test to the screen:

Test MethodScreenFlow
testHomeScreenLoadsHomeApp launch
testFullLoggingFlowLogAttackSheetStep-by-step logging
testQuickSaveFlowLogAttackSheetQuick save from step 1
testStepNavigationLogAttackSheetForward/back navigation
testDismissLogSheetLogAttackSheetSheet dismiss
testSettingsOpensSettingsSheetSettings display
testHistoryOpensHistoryViewHistory display
testMigraineDetailAndEditMigraineDetailSheetDetail + edit

Step 3: Harvest Crash Logs

After a test crash, check for crash logs:

find ~/Library/Logs/DiagnosticReports -name "*<AppName>*" -newer /tmp/.last_test_run -type f 2>/dev/null | head -5

If found, read the crash log and extract:

  1. Exception type — EXC_BREAKPOINT, EXC_BAD_ACCESS, SIGABRT
  2. Crashing thread name — main, AsyncRenderer, background
  3. First app frame — the first stack frame in YOUR code (not Apple frameworks)

Step 4: Classify the Crash

Crashing ThreadFirst App Frame PatternCategory
AsyncRendererColor.init, AppThemeruntime/async-render
AsyncRenderer_swift_task_checkIsolatedSwiftruntime/actor-isolation
Main threadForce unwrap, !runtime/nil-unwrap
Main threadIndex out of rangeruntime/index-out-of-bounds
Main threadModelContextruntime/swiftdata-thread
AnyView transition / animationruntime/navigation
AnyObservation, @Observableruntime/observation

Step 5: Log to Error Ledger

Append to .agents/errors/errors.md:

## [UNRESOLVED] <timestamp> — Runtime Crash: <brief description>

- **Error:** `<exception type + signal>`
- **File:** `<first app frame file:line>`
- **Category:** `runtime/<subcategory>`
- **Symptom:** <what the user saw or which test failed>
- **Crashing Thread:** `<thread name>`
- **First App Frame:** `<symbol>`
- **Root Cause:** _Pending investigation_
- **Fix:** _Pending_
- **Session:** `${CLAUDE_SESSION_ID}`

Step 6: Investigate and Fix

Follow the /debugging skill methodology:

  1. Read the file at the first app frame
  2. Check error ledger history for matching patterns
  3. If match → apply known fix
  4. If no match → isolate by simplifying the crashing view
  5. Fix root cause, rebuild, rerun the failing test
  6. Update ledger to [RESOLVED]

Step 7: Verify

Rerun the specific failing test:

mcp__xcode__RunSomeTests with:
  testIdentifier: "SmokeWalkerTest/testFullLoggingFlow"

Then run ALL smoke tests to ensure no regressions:

mcp__xcode__RunSomeTests with:
  testIdentifier: "SmokeWalkerTest"

Setup: Adding Smoke Tests to a New Project

If no UI test target exists:

1. Add to project.yml

  <AppName>UITests:
    type: bundle.ui-testing
    platform: iOS
    supportedDestinations:
      - iOS
    sources:
      - path: <AppName>UITests
        type: syncedFolder
    settings:
      base:
        SWIFT_VERSION: "6.0"
        GENERATE_INFOPLIST_FILE: YES
        PRODUCT_BUNDLE_IDENTIFIER: com.example.uitests
        CODE_SIGN_STYLE: Automatic
        SWIFT_APPROACHABLE_CONCURRENCY: YES
        SWIFT_DEFAULT_ACTOR_ISOLATION: MainActor
    dependencies:
      - target: <AppName>

2. Create test directory and file

mkdir -p <AppName>UITests

Create SmokeWalkerTest.swift that:

  • Launches the app with --uitesting argument
  • Sets continueAfterFailure = false
  • Walks through every major screen using accessibility identifiers
  • Taps interactive elements
  • Verifies screens render (elements exist)

3. Add accessibility identifiers to views

Add .accessibilityIdentifier("name") to key interactive elements:

  • Navigation buttons (log, settings, history)
  • Form buttons (next, save, back, close)
  • List rows (indexed: row_0, row_1)
  • Trigger/selection chips (named: trigger_stress)

Naming convention: <screen>_<element> in snake_case.

4. Regenerate Xcode project

mcp__xcodegen__regenerate_project

Rules

  • Always run smoke tests first — don't guess, let the test find the crash
  • Trust test failure location — the failing test method IS the crashing screen
  • Log every crash to errors.md — even if you fix it immediately
  • Rerun tests after fix — verify no regressions
  • Never skip the ledger — every crash feeds the learning system

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.