Use when debugging 'files disappeared', 'data missing after restart', 'backup too large', 'can't save file', 'file not found', 'storage full error', 'file inaccessible when locked' - systematic local file storage diagnostics
View on GitHubSelect agents to install to:
npx add-skill https://github.com/CharlesWiltgen/Axiom/blob/main/.claude-plugin/plugins/axiom/skills/axiom-storage-diag/SKILL.md -a claude-code --skill axiom-storage-diagInstallation paths:
.claude/skills/axiom-storage-diag/# Local File Storage Diagnostics
## Overview
**Core principle** 90% of file storage problems stem from choosing the wrong storage location, misunderstanding file protection levels, or missing backup exclusions—not iOS file system bugs.
The iOS file system is battle-tested across millions of apps and devices. If your files are disappearing, becoming inaccessible, or causing backup issues, the problem is almost always in storage location choice or protection configuration.
## Red Flags — Suspect File Storage Issue
If you see ANY of these:
- Files mysteriously disappear after device restart
- Files disappear randomly (weeks after creation)
- App backup size unexpectedly large (>500 MB)
- "File not found" after app background/foreground cycle
- Files inaccessible when device is locked
- Users report lost data after iOS update
- Background tasks can't access files
❌ **FORBIDDEN** "iOS deleted my files, the file system is broken"
- iOS file system handles billions of files daily across all apps
- System behavior is documented and predictable
- 99% of issues are location/protection mismatches
## Mandatory First Steps
**ALWAYS check these FIRST** (before changing code):
```swift
// 1. Check WHERE file is stored
func diagnoseFileLocation(_ url: URL) {
let path = url.path
if path.contains("/tmp/") {
print("⚠️ File in tmp/ - system purges aggressively")
} else if path.contains("/Caches/") {
print("⚠️ File in Caches/ - purged under storage pressure")
} else if path.contains("/Documents/") {
print("✅ File in Documents/ - never purged, backed up")
} else if path.contains("/Library/Application Support/") {
print("✅ File in Application Support/ - never purged, backed up")
}
}
// 2. Check file protection level
func diagnoseFileProtection(_ url: URL) throws {
let attrs = try FileManager.default.attributesOfItem(atPath: url.path)
if let protection = attrs[.protectionKey] as? FileProtectionType {
print("P