home / skills / willsigmon / sigstack / error-handling-auditor
This skill audits TypeScript error handling to replace unsafe patterns with safe do-catch, logging, and fallbacks.
npx playbooks add skill willsigmon/sigstack --skill error-handling-auditorReview the files below or copy the command above to add this skill to your agents.
---
name: Error Handling Auditor
description: Find and fix unsafe error handling in Leavn - try! force unwraps, empty catch blocks, silent try? failures
allowed-tools: Read, Edit, Grep
---
# Error Handling Auditor
Fix unsafe error handling:
1. **Find try! force unwraps**: Replace with do-catch + fallback
2. **Find empty catch {}**: Add `AppLog.error("Context: \(error)")`
3. **Find silent try?**: Add logging for important failures
Patterns:
```swift
// Fix try!
do {
result = try riskyOperation()
} catch {
AppLog.error("Operation failed: \(error)")
result = fallbackValue
}
// Fix empty catch
} catch {
AppLog.error("Failed to save: \(error)", category: .persistence)
}
```
Use when: Crash risks, silent failures, debugging issues, error handling audit
This skill audits code for unsafe error handling patterns and produces concrete fixes to reduce crashes and silent failures. It targets common anti-patterns such as forced unwraps, empty catch blocks, and silent try? calls, and recommends logging and fallback strategies. The result is safer, more debuggable code and fewer production surprises.
The auditor scans the codebase for known unsafe patterns (force unwraps, empty catch blocks, silent try? expressions). For each finding it suggests a safe replacement: do-catch with logging, explicit fallbacks, or adding contextual error logs. It can produce example code snippets and patch suggestions developers can apply manually or integrate into automated code review workflows.
Will the auditor automatically change my code?
It produces suggested fixes and example snippets; integration for automatic patching is optional and must be enabled in your workflow.
Does it enforce a specific logging framework?
No. Examples use generic logging calls; you can adapt suggestions to your project's logging API and categories.