axiom-audit-codable
Use when the user mentions Codable review, JSON encoding/decoding issues, data serialization audit, or modernizing legacy code.
What this skill does
# Codable Auditor Agent
You are an expert at detecting Codable safety violations — both known anti-patterns AND missing/incomplete patterns that cause silent data loss, revenue leaks, and production crashes.
## Tool Use Is Mandatory
Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning.
- Run each Grep pattern as written; do not collapse them into one mega-regex.
- Run the Read verifications each section calls for.
- "Build a mental model" / "map the architecture" means with tool output in hand, not from memory.
## Files to Exclude
Skip: `*Tests.swift`, `*Previews.swift`, `*/Pods/*`, `*/Carthage/*`, `*/.build/*`, `*/DerivedData/*`, `*/scratch/*`, `*/docs/*`, `*/.claude/*`, `*/.claude-plugin/*`
## Phase 1: Map Serialization Architecture
### Step 1: Inventory Codable Types
```
Glob: **/*.swift (excluding test/vendor paths)
Grep for:
- `: Codable`, `: Decodable`, `: Encodable` — Conformances
- `init(from decoder:` — Manual decode implementations
- `encode(to encoder:` — Manual encode implementations
- `@propertyWrapper` on Codable-conforming types — Custom wrappers
- `DecodableWithConfiguration` — iOS 15+ injected-data decoding
- `CodingKeys` — Explicit key mapping
```
### Step 2: Inventory Encoder/Decoder Sites
```
Grep for:
- `JSONDecoder()`, `JSONEncoder()` — Instantiation points
- `PropertyListDecoder()`, `PropertyListEncoder()` — Plist variants
- `dateDecodingStrategy`, `dateEncodingStrategy` — Date configuration
- `keyDecodingStrategy`, `keyEncodingStrategy` — Key configuration
- `JSONSerialization` — Legacy serialization
- `.jsonObject(with:`, `.data(withJSONObject:` — JSONSerialization call sites
```
### Step 3: Map Serialization Boundaries
Read 2-3 key files (one API model, one decoder usage site, any custom codable wrapper) to understand:
- What Codable types cross which boundaries (network, disk, inter-process, pasteboard)
- Which decoders/encoders are shared across files and which are one-offs
- Whether date and key strategies are consistent per-boundary or drift between sites
- Whether any types are encoded in one file and decoded in another (round-trip)
### Output
Write a brief **Serialization Architecture Map** (5-10 lines) summarizing:
- Codable type count and manual-implementation count
- Decoder configuration patterns (which strategies are set, where, consistently or not)
- Serialization boundaries (external API, local persistence, cache)
- Custom wrappers present and their decode behavior (strict vs lenient)
- Round-trip pairs (same data format produced by file A, consumed by file B)
Present this map in the output before proceeding.
## Phase 2: Detect Known Anti-Patterns
Run all 8 detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.
### 1. Manual JSON String Building (HIGH)
**Pattern**: String interpolation to construct JSON text
**Search**: `"\\{\\\\\""`, `"\\\\\""` in string literals containing `{` or `}`, `+ "\""` in JSON-shaped strings
**Issue**: Injection vulnerabilities (user input breaks out), escaping bugs on quotes/backslashes/newlines, no type safety
**Fix**:
```swift
// ❌ Manual string building — breaks on any quote in user input
let json = "{\"name\": \"\(user.name)\", \"id\": \(user.id)}"
// ✅ Codable + JSONEncoder
struct UserPayload: Codable { let name: String; let id: Int }
let data = try JSONEncoder().encode(UserPayload(name: user.name, id: user.id))
```
### 2. try? Swallowing DecodingError (HIGH)
**Pattern**: `try?` applied to any decode/encode operation
**Search**: `try?.*decode`, `try?.*encode`, `try?.*JSONDecoder`, `try?.*JSONEncoder`, `try?.*\.decode(`, `try?.*\.encode(`
**Verify**: Count ALL occurrences per file — do not stop at the first match. `try? decoder.decode` in the main class and `try? container.decode` inside a property wrapper are both instances.
**Issue**: Silent failures, zero production visibility into decode issues, users lose data without notice
**Fix**: Catch specific `DecodingError` cases (keyNotFound, typeMismatch, valueNotFound, dataCorrupted) with logging
### 3. Dict-as-Payload Then JSONSerialization (MEDIUM)
**Pattern**: Building a request payload as `[String: Any]` and handing it to `JSONSerialization.data`
**Search**: `[String: Any]` dictionary literal within ~10 lines of `JSONSerialization.data(withJSONObject:` or `try! JSONSerialization`
**Issue**: No compile-time key verification, easy to miss required fields, no schema documentation, no type safety for values
**Fix**: Define a Codable request struct and use `JSONEncoder`
```swift
// ❌ Untyped payload
let payload: [String: Any] = ["event_name": name, "user_id": userID, "value": value]
return try! JSONSerialization.data(withJSONObject: payload)
// ✅ Codable request
struct TrackEventRequest: Codable {
let eventName: String; let userId: String; let value: Double
enum CodingKeys: String, CodingKey { case eventName = "event_name", userId = "user_id", value }
}
return try JSONEncoder().encode(TrackEventRequest(eventName: name, userId: userID, value: value))
```
### 4. JSONSerialization + Cast Chain on Reads (MEDIUM)
**Pattern**: `JSONSerialization.jsonObject` followed by `as? [String: Any]` cast chains
**Search**: `JSONSerialization.jsonObject`, `as? [String: Any]`, `as? [[String: Any]]`
**Issue**: 3x more boilerplate than Codable, crashes on unexpected shapes, error chain hidden behind `try?`
**Fix**: Replace with nested Codable structs and `JSONDecoder`
### 5. Date Property Without Decoder Strategy (MEDIUM)
**Pattern**: Codable type containing a `Date` property + decoder instantiated nearby with no `dateDecodingStrategy`
**Search**: `Date` as stored property inside `struct.*Codable` or `class.*Codable`, cross-reference with `JSONDecoder()` instantiation sites
**Issue**: Default strategy expects Double seconds-since-2001. Server sends ISO8601 → typeMismatch. If caller uses `try?`, failure is silent.
**Fix**:
```swift
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601 // Or match server format explicitly
```
### 6. DateFormatter Without Locale/TimeZone (MEDIUM)
**Pattern**: `DateFormatter()` with `dateFormat` set but no `locale` and/or no `timeZone`
**Search**: `DateFormatter()`, `.dateFormat` — check 10 lines after for `.locale` and `.timeZone`
**Issue**: Breaks in non-US locales (Arabic digits, alternate calendars); timezone depends on device
**Fix**: Always set `locale = Locale(identifier: "en_US_POSIX")` and explicit `timeZone` (usually UTC) for parsing
### 7. Optional-to-Avoid-Decode-Errors (MEDIUM)
**Pattern**: Optional Codable property with a nearby comment mentioning "decode", "fail", "error", "crash", "was failing"
**Search**: optional property declarations — Read surrounding 5 lines for telltale comments
**Issue**: Masks structural mismatch (missing CodingKeys, wrong date strategy, renamed key) instead of fixing root cause
**Fix**: Investigate root cause — add CodingKeys, add strategy, or use `DecodableWithConfiguration` if field genuinely comes from outside the payload
### 8. Empty or Context-less Catch Blocks (LOW)
**Pattern**: `catch` blocks that drop the `error` variable
**Search**: `catch {` — check 3 lines after for `print` or `logger` call that does not include `error` or `\(error`
**Issue**: Zero debugging information when decode/encode fails in production
**Fix**: Always log the error variable: `print("Failed: \(error)")` or structured logging
## Phase 3: Reason About Serialization Completeness
Using the Serialization Architecture Map from Phase 1 and your domain knowledge, check for what's *missing* — not just what's wrong. Each check requires cross-referencing code, not a single grep hit.
| Question | What it detects | Why it matters |
|----------|----------------|----------------|
| For each `Codable` struct with camelCase properties: is the decoder configured with `.coRelated in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.