crash-safety

crash-safety is a skill for Claude Code, Codex from mwd1234/ios-agentic-skills. It costs 48 tokens per session (1,732 once invoked), scanned A, original, MIT.

A code-review checklist for finding common causes of app crashes, including forced unwraps, missing checks, unhandled errors, and unsafe optional values. It also looks for safe fallback behavior and useful error states.

In plain words
What is it for?
Use it before App Store submission, after adding asynchronous or failure-prone code, during pull-request reviews, or after TestFlight crash reports. It checks patterns such as force unwraps, try!, fatalError, and missing UI-thread annotations.
Why use it?
It helps catch failures before release, especially in asynchronous or error-prone code. Replacing unsafe assumptions with guarded behavior can prevent production crashes and improve what users see when something goes wrong.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it before App Store submission, after adding asynchronous or failure-prone code, during pull-request reviews, or after TestFlight crash reports. It checks patterns such as force unwraps, try!, fatalError, and missing UI-thread annotations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mwd1234/ios-agentic-skills/crash-safety
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mwd1234/ios-agentic-skills --skill crash-safety
Clone the repo
git clone --depth 1 https://github.com/mwd1234/ios-agentic-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for crash-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/mwd1234/ios-agentic-skills/crash-safety/github.svg)](https://agentmods.dev/skills/mwd1234/ios-agentic-skills/crash-safety)
Your own site
<a href="https://agentmods.dev/skills/mwd1234/ios-agentic-skills/crash-safety"><img src="https://agentmods.dev/badge/skills/mwd1234/ios-agentic-skills/crash-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for crash-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/mwd1234/ios-agentic-skills/crash-safety"><img src="https://agentmods.dev/badge/skills/mwd1234/ios-agentic-skills/crash-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,732 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.01732
Opus 5 $0.00024 $0.00866
Sonnet 5 $0.00010 $0.00346
Haiku 4.5 $0.00005 $0.00173

Measured 12d ago against content hash 9ecf77cc7734, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

crash-safety scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agent/skills/crash-safety/SKILL.md · 224 lines

How it starts

The opening of the file, as written. The whole thing — 224 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Crash & Error Resilience Audit

Find risky unwraps, missing guards, and unhandled errors. Add safe fallbacks and user-friendly error states.

When to use this skill

  • Before App Store submission
  • After adding new async/error-prone code
  • When reviewing PRs with optional handling
  • After crash reports from TestFlight

Quick Reference: Risk Levels

Pattern Risk Fix
fatalError() 🔴 Critical Remove or guard with #if DEBUG
! force unwrap 🔴 High Use guard let, if let, or ??
try! 🔴 High Use do/catch or try? with fallback
preconditionFailure() 🔴 High Remove from production paths
Implicit unwrap (Type!) 🟡 Medium Convert to optional with safe access
Missing @MainActor 🟡 Medium Add for UI-updating code

Step 1: Fatal Crash Patterns

1.1 fatalError / preconditionFailure / assertionFailure

# These crash in production!
rg --type swift -g '!*Tests*' -g '!*UITests*' 'fatalError\(|preconditionFailure\(|assertionFailure\(' YourApp/

Fix: Remove or wrap in #if DEBUG:

#if DEBUG
fatalError("Unimplemented")
#else
return defaultValue
#endif

1.2 Force Unwraps (!)

# Force unwraps - tighter pattern to reduce false positives
rg --type swift -g '!*Tests*' -g '!*UITests*' '[a-zA-Z_][a-zA-Z0-9_]*\s*!' YourApp/ | grep -v '!=' | grep -v '//' | head -40

Exceptions (OK to skip):

  • @IBOutlet (UIKit pattern)
  • NSImage(named:)! with known system images
  • URL(string: "https://...")! with hardcoded valid URLs
  • Code inside #Preview { } blocks
  • Code inside *Tests*/ directories

1.3 Force Try (try!)

rg --type swift -g '!*Tests*' -g '!*UITests*' 'try!' YourApp/

Note: try! is acceptable in tests and previews where failure should crash during development.

Fix: Replace with do/catch or try? with default:

// ❌ Crashes on failure
let data = try! encoder.encode(object)

// ✅ Safe with error handling
let data = try? encoder.encode(object) ?? Data()

Read the full file on GitHub · 224 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 224 lines · 48 tokens per session scan A 9ecf77cc7734

Subscribe to this mod's changes

crash-safety is a skill published in the GitHub repository mwd1234/ios-agentic-skills (50 stars, last pushed 7mo ago), licensed MIT. It adds 48 tokens to every session and 1,732 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.