Skip to content
Development
Skill

/axiom-audit-storage

Use when the user mentions file storage issues, data loss, backup bloat, or asks to audit storage usage.

From plugin
axiom
1.1k66 skills1 MCP
Install
$ npx -y skills add charleswiltgen/axiom --skill axiom-audit-storage --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/axiom-audit-storage

Context preview

The summary Claude sees to decide when to auto-load this skill.

Use when the user mentions file storage issues, data loss, backup bloat, or asks to audit storage usage.

SKILL.md

axiom-audit-storage.SKILL.md
name: axiom-audit-storage
description: Use when the user mentions file storage issues, data loss, backup bloat, or asks to audit storage usage.
license: MIT
disable-model-invocation: true

Storage Auditor Agent

You are an expert at detecting file storage mistakes — both known anti-patterns AND missing/incomplete patterns that cause data loss, backup bloat, sensitive-data exposure, and cross-process invisibility.

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 Storage Architecture

Step 1: Identify Storage Locations

Glob: **/*.swift, **/Info.plist, **/*.entitlements (excluding test/vendor paths)
Grep for:
  - `\.documentDirectory`, `Documents/` — user-visible storage
  - `\.cachesDirectory`, `Caches/` — purgeable cache
  - `\.applicationSupportDirectory`, `Application Support` — hidden persistent app data
  - `NSTemporaryDirectory`, `tmp/` — truly temporary
  - `containerURL(forSecurityApplicationGroupIdentifier:` — App Group shared container
  - `forUbiquityContainerIdentifier` — iCloud Drive container
  - `Library/` — generic library subpaths

Step 2: Identify Persistence Channels

Grep for:
  - `UserDefaults` — small KV settings
  - `Keychain`, `kSecClass` — secure secrets
  - `\.write\(to:`, `Data.*write\(`, `FileManager.*createFile` — direct file writes
  - `URLResourceValues` — resource attribute customization
  - `isExcludedFromBackup` — backup exclusion
  - `FileProtectionType`, `\.completeFileProtection`, `\.completeUntilFirstUserAuthentication`, `\.complete` — protection level

Step 3: Identify Sensitive Data Surface

Grep for:
  - `token`, `password`, `secret`, `apiKey`, `credential`, `auth` (case-insensitive) — sensitive identifiers
  - `JWT`, `OAuth`, `refreshToken`, `accessToken` — auth tokens
  - file writes of these → should be in Keychain, not files

Step 4: Read Key Storage Files

Read 2-3 representative files (FileManager extension / DownloadManager / CacheManager / SettingsService) to understand:

  • Which directory each data type lands in
  • Whether backup exclusion is applied consistently to non-user content
  • Whether sensitive data goes through Keychain or files
  • Whether App Group container is used (only matters if extensions exist)

Output

Write a brief **Storage Map** (5-10 lines) summarizing:

  • Locations in use (Documents / Caches / Application Support / tmp / App Group / iCloud Drive)
  • What goes where (user docs / cache / settings / secrets)
  • Backup-exclusion discipline (consistent / partial / missing)
  • File-protection discipline (explicit / default / missing)
  • Whether secrets use Keychain (yes / no / mixed)
  • App Group / extensions: in use? sharing what data?

Present this map in the output before proceeding.

Phase 2: Detect Known Anti-Patterns

Run all 5 detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.

Pattern 1: Files in tmp/ That Aren't Truly Temporary (CRITICAL/HIGH)

**Issue**: `tmp/` is purged aggressively by iOS — at low-storage events, app updates, sometimes between sessions. Anything that needs to survive past a few minutes is at data-loss risk. **Search**:

  • `NSTemporaryDirectory`
  • `tmp/` in URL strings or path components
  • `\.itemReplacementDirectory` (if used to *persist*, not as scratch)

**Verify**: Read matching files; check what's being written and whether the lifecycle is true scratch (delete within seconds/minutes) or persistence-intent. **Fix**:

  • Downloads: move to `Caches/` with `isExcludedFromBackup = true`.
  • User content: move to `Documents/`.
  • App state: move to `Application Support/`.

Pattern 2: Large Files in Documents/ or App Support Without isExcludedFromBackup (HIGH/MEDIUM)

**Issue**: Files >1MB in backed-up locations consume the user's iCloud quota unnecessarily. Re-downloadable or regenerable content should be excluded. **Search**:

  • `\.documentDirectory.*write`, `\.applicationSupportDirectory.*write`
  • `URLResourceValues.*isExcludedFromBackup`

**Verify**: Read matching files; determine whether the data is regenerable (cache, downloads, derived) or original (user-created). **Fix**: Set `var values = URLResourceValues(); values.isExcludedFromBackup = true; try url.setResourceValues(values)` for regenerable content, OR move it to `Caches/` instead.

Pattern 3: Missing FileProtectionType (MEDIUM/MEDIUM)

**Issue**: Default file protection is `.completeUntilFirstUserAuthentication`. Sensitive data needs `.complete`; clearly-public data can be `.none` for performance. **Search**:

  • `\.write\(to:` and `Data\(contentsOf:` — write/read sites
  • `FileProtectionType`, `\.completeFileProtection`, `\.complete`, `\.completeUntilFirstUserAuthentication`, `\.none` — explicit protection

**Verify**: Read matching files; identify whether the data being written is sensitive (tokens, PII, financial) and whether explicit protection is set on the write call or the file's resource values. **Fix**: For sensitive data: `try data.write(to: url, options: [.atomic, .completeFileProtection])`. Better: move secrets to Keychain entirely.

Pattern 4: Wrong Storage Location for Content Type (HIGH/MEDIUM)

**Issue**: User-visible content hidden in Application Support/, regenerable content in Documents/ (backup bloat), app state in tmp/ (data loss), large data in UserDefaults (perf). **Search**:

  • `\.applicationSupportDirectory.*\.pdf|\.applicationSupportDire
Read more
Ships withaxiom

Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.

Get the whole plugin