axiom-file-protection-ref

charleswiltgen/axiom · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/charleswiltgen/axiom --skill axiom-file-protection-ref
0 commentsdiscussion
summary

Purpose: Comprehensive reference for file encryption and data protection APIs

  • Availability: iOS 4.0+ (all protection levels), latest enhancements in iOS 26
  • Context: Built on iOS Data Protection architecture using hardware encryption
skill.md

iOS File Protection Reference

Purpose: Comprehensive reference for file encryption and data protection APIs Availability: iOS 4.0+ (all protection levels), latest enhancements in iOS 26 Context: Built on iOS Data Protection architecture using hardware encryption

When to Use This Skill

Use this skill when you need to:

  • Protect sensitive user data at rest
  • Choose appropriate FileProtectionType for files
  • Understand when files are accessible/encrypted
  • Debug "file not accessible" errors after device lock
  • Implement secure file storage
  • Compare Keychain vs file protection approaches
  • Handle background file access requirements

Overview

iOS Data Protection provides hardware-accelerated file encryption tied to the device passcode. When a user sets a passcode, every file can be encrypted with keys protected by that passcode.

Key concepts:

  • Files are encrypted automatically when protection is enabled
  • Encryption keys are derived from device hardware + user passcode
  • Files become inaccessible when device is locked (depending on protection level)
  • No performance cost (hardware AES encryption)

Protection Levels Comparison

Level Encrypted Until Accessible When Use For Background Access
complete Device unlocked Only while unlocked Sensitive data (health, finances) ❌ No
completeUnlessOpen File closed After first unlock, while open Large downloads, videos ✅ If already open
completeUntilFirstUserAuthentication First unlock after boot After first unlock Most app data ✅ Yes
none Never Always Public caches, temp files ✅ Yes

Detailed Level Descriptions

.complete

Full Description:

"The file is stored in an encrypted format on disk and cannot be read from or written to while the device is locked or booting."

Use For:

  • User health data
  • Financial information
  • Password vaults
  • Sensitive documents
  • Personal photos (if app requires maximum security)

Behavior:

  • Encrypted: ✅ Always
  • Accessible: Only when device unlocked
  • Background access: ❌ No (app can't read while locked)
  • Available after boot: ❌ No (until user unlocks)

Code Example:

// ✅ CORRECT: Maximum security for sensitive data
func saveSensitiveData(_ data: Data, to url: URL) throws {
    try data.write(to: url, options: .completeFileProtection)
}

// Or set on existing file
try FileManager.default.setAttributes(
    [.protectionKey: FileProtectionType.complete],
    ofItemAtPath: url.path
)

Tradeoffs:

  • ✅ Maximum security
  • ❌ Can't access in background
  • ❌ User sees errors if app tries to access while locked

.completeUnlessOpen

Full Description:

"The file is stored in an encrypted format on disk after it is closed."

Use For:

  • Large file downloads (continue in background)
  • Video files being played
  • Documents being edited
  • Any file that needs background access while open

Behavior:

  • Encrypted: ✅ When closed
  • Accessible: After first unlock, remains accessible while open
  • Background access: ✅ Yes (if file was already open)
  • Available after boot: ❌ No (until first unlock)

Code Example:

// ✅ CORRECT: Download in background, but encrypted when closed
func startBackgroundDownload(url: URL, destination: URL) throws {
    try Data().write(to: destination, options: .completeFileProtectionUnlessOpen)

    // Open file handle for writing
    let fileHandle = try FileHandle(forWritingTo: destination)

    // Download continues in background
    // File remains accessible because it's open
    // When closed, file becomes encrypted

    // Later, when download complete:
    try fileHandle.close()  // Now encrypted until next unlock
}

Tradeoffs:

  • ✅ Good security (encrypted when not in use)
  • ✅ Background access (if already open)
  • ⚠️ Vulnerable while open

.completeUntilFirstUserAuthentication

Full Description:

"The file is stored in an encrypted format on disk and cannot be accessed until after the device has booted."

Use For:

  • Most application data
  • User preferences
  • Downloaded content
  • Database files
  • Anything that needs background access

Behavior:

  • Encrypted: ✅ Always
  • Accessible: After first unlock following boot
  • Background access: ✅ Yes (after first unlock)
  • Available after boot: ❌ No (until user unlocks once)

This is the recommended default for most files.

Code Example:

// ✅ CORRECT: Balanced security for most app data
func saveAppData(_ data: Data, to url: URL) throws {
    try data.write(
        to: url,
        options: .completeFileProtectionUntilFirstUserAuthentication
    )
}

// ✅ This file can be accessed in background after first unlock
func backgroundTaskCanAccessFile() {
    // This works even if device is locked (after first unlock)
    let data = try? Data(contentsOf: url)
}

Tradeoffs:

  • ✅ Protected during boot (device stolen while off)
  • ✅ Background access (normal operation)
  • ⚠️ Accessible while locked (less protection than .complete)

.none

Full Description:

"The file has no special protections associated with it."

Use For:

  • Public cache data
  • Temporary files
  • Non-sensitive downloads
  • Thumbnails
  • Only when absolutely necessary

Behavior:

  • Encrypted: ❌ Never
  • Accessible: ✅ Always
  • Background access: ✅ Always
  • Available after boot: ✅ Always

Code Example:

// ⚠️ USE SPARINGLY: Only for truly non-sensitive data
func cachePublicThumbnail(_ data: Data, to url: URL) throws {
    try data.write(to: url, options: .noFileProtection)
}

Tradeoffs:

  • ✅ Always accessible
  • ❌ No encryption
  • ❌ Vulnerable if device is stolen

Setting File Protection

At File Creation

// ✅ RECOMMENDED: Set protection when writing
let sensitiveData = userData.jsonData()
try sensitiveData.write(
    to: fileURL,
    options: .completeFileProtection
)

On Existing Files

// ✅ CORRECT: Change protection on existing file
try FileManager.default.setAttributes(
    [.protectionKey: FileProtectionType.complete],
    ofItemAtPath: fileURL.path
)

Default Protection for Directory

// ✅ CORRECT: Set default protection for directory
// New files inherit this protection
try FileManager.default.setAttributes(
    [.protectionKey: FileProtectionType.completeUntilFirstUserAuthentication],
    ofItemAtPath: directoryURL.path
)

Checking Current Protection

// ✅ Check file's current protection level
func checkFileProtection(at url: URL) throws -> FileProtectionType? {
    let attributes = try FileManager.default.attributesOfItem(atPath: url.path)
    return attributes[.protectionKey] as? FileProtectionType
}

// Usage
if let protection = try? checkFileProtection(at: fileURL) {
    switch protection {
    case .complete:
        print("Maximum protection")
    case .completeUntilFirstUserAuthentication:
        print("Standard protection")
    default:
        print("Other protection")
    }
}

File Protection vs Keychain

Decision Matrix

Use Case Recommended Why
Passwords, tokens, keys Keychain Designed for small secrets
Small sensitive values (<few KB) Keychain More secure, encrypted separately
Files >1 KB File Protection Keychain not designed for large data
User documents File Protection Natural file-based storage
Structured secrets Keychain Query by key, access control

Code Comparison

// ✅ CORRECT: Small secrets in Keychain
let passwordData = password.data(using: .utf8)!
let query: [String: Any] = [
    kSecClass as String: kSecClassGenericPassword,
    kSecAttrAccount as
how to use axiom-file-protection-ref

How to use axiom-file-protection-ref on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add axiom-file-protection-ref
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/charleswiltgen/axiom --skill axiom-file-protection-ref

The skills CLI fetches axiom-file-protection-ref from GitHub repository charleswiltgen/axiom and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/axiom-file-protection-ref

Reload or restart Cursor to activate axiom-file-protection-ref. Access the skill through slash commands (e.g., /axiom-file-protection-ref) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.655 reviews
  • Nia Kapoor· Dec 24, 2024

    We added axiom-file-protection-ref from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Anika Khan· Dec 16, 2024

    axiom-file-protection-ref reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Luis Martinez· Dec 8, 2024

    Registry listing for axiom-file-protection-ref matched our evaluation — installs cleanly and behaves as described in the markdown.

  • William Lopez· Dec 8, 2024

    axiom-file-protection-ref fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Ganesh Mohane· Dec 4, 2024

    axiom-file-protection-ref reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Sakura Abbas· Dec 4, 2024

    Useful defaults in axiom-file-protection-ref — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Soo Yang· Nov 27, 2024

    Useful defaults in axiom-file-protection-ref — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Sakshi Patil· Nov 23, 2024

    I recommend axiom-file-protection-ref for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Yuki Bansal· Nov 23, 2024

    Registry listing for axiom-file-protection-ref matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Sakura Okafor· Nov 7, 2024

    I recommend axiom-file-protection-ref for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 55

1 / 6