Command Palette

Search for a command to run...

Назад к скиллам
скилл № 79905

axiom-storage-management-ref

Use when asking about 'purge files', 'storage pressure', 'disk space iOS', 'isExcludedFromBackup', 'URL resource values', 'volumeAvailableCapacity', 'low…

БесплатноБез исполняемых скриптов
ComeOnOliverот ComeOnOliver★ 67 звёзд на GitHub

Установить axiom-storage-management-ref в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

iOS Storage Management Reference

Purpose: Comprehensive reference for storage pressure, purging policies, disk space, and URL resource values Availability: iOS 5.0+ (basic), iOS 11.0+ (modern capacity APIs) Context: Answer to "Does iOS provide any way to mark files as 'purge as last resort'?"

When to Use This Skill

Use this skill when you need to:

  • Understand iOS file purging behavior
  • Check available disk space correctly
  • Set purge priorities for cached files
  • Exclude files from backup
  • Monitor storage pressure
  • Mark files as purgeable
  • Understand volume capacity APIs
  • Handle "low storage" scenarios

The Core Question

"Does iOS provide any way to mark files as 'purge as last resort'?"

Answer: Not directly, but iOS provides two approaches:

  1. Location-based purging (implicit priority):

    • tmp/ → Purged aggressively (anytime)
    • Library/Caches/ → Purged under storage pressure
    • Documents/, Application Support/ → Never purged
  2. Capacity checking (explicit strategy):

    • volumeAvailableCapacityForImportantUsage — For must-save data
    • volumeAvailableCapacityForOpportunisticUsage — For nice-to-have data
    • Check before saving, choose location based on available space

URL Resource Values for Storage

Complete Reference Table

Resource Key Type Purpose Availability
volumeAvailableCapacityKey Int64 Total available space iOS 5.0+
volumeAvailableCapacityForImportantUsageKey Int64 Space for essential files iOS 11.0+
volumeAvailableCapacityForOpportunisticUsageKey Int64 Space for optional files iOS 11.0+
volumeTotalCapacityKey Int64 Total volume capacity iOS 5.0+
isExcludedFromBackupKey Bool Exclude from iCloud/iTunes backup iOS 5.1+
isPurgeableKey Bool System can delete under pressure iOS 9.0+
fileAllocatedSizeKey Int64 Actual disk space used iOS 5.0+
totalFileAllocatedSizeKey Int64 Total allocated (including metadata) iOS 5.0+

Checking Available Space (Modern Approach)

// ✅ CORRECT: Check appropriate capacity before saving
func checkSpaceBeforeSaving(fileSize: Int64, isEssential: Bool) -> Bool {
    let homeURL = FileManager.default.homeDirectoryForCurrentUser

    do {
        let values = try homeURL.resourceValues(forKeys: [
            .volumeAvailableCapacityForImportantUsageKey,
            .volumeAvailableCapacityForOpportunisticUsageKey
        ])

        if isEssential {
            // For must-save data (user-created content, critical app data)
            let importantCapacity = values.volumeAvailableCapacityForImportantUsage ?? 0
            return fileSize < importantCapacity
        } else {
            // For nice-to-have data (caches, thumbnails)
            let opportunisticCapacity = values.volumeAvailableCapacityForOpportunisticUsage ?? 0
            return fileSize < opportunisticCapacity
        }
    } catch {
        print("Error checking capacity: \(error)")
        return false
    }
}

// Usage
if checkSpaceBeforeSaving(fileSize: imageData.count, isEssential: true) {
    try imageData.write(to: documentsURL.appendingPathComponent("photo.jpg"))
} else {
    showLowStorageAlert()
}

Important vs Opportunistic Capacity

volumeAvailableCapacityForImportantUsage:

  • Space reserved for essential operations
  • Use for: User-created content, must-save data
  • System reserves this space more aggressively
  • Higher threshold

volumeAvailableCapacityForOpportunisticUsage:

  • Space available for optional operations
  • Use for: Caches, thumbnails, pre-fetching
  • Lower threshold (system may already be under pressure)
  • Indicates "go ahead if you want, but system is getting full"
// ✅ CORRECT: Different thresholds for different data types
func shouldDownloadThumbnail(size: Int64) -> Bool {
    let capacity = try? FileManager.default.homeDirectoryForCurrentUser
        .resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey])
        .volumeAvailableCapacityForOpportunisticUsage ?? 0

    // Only download optional content if there's plenty of space
    return size < capacity
}

func canSaveUserDocument(size: Int64) -> Bool {
    let capacity = try? FileManager.default.homeDirectoryForCurrentUser
        .resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey])
        .volumeAvailableCapacityForImportantUsage ?? 0

    // User documents are essential
    return size < capacity
}

Backup Exclusion

isExcludedFromBackup

Files in Caches/ are automatically excluded from backup, but you should explicitly mark re-downloadable files in other directories.

// ✅ CORRECT: Exclude large re-downloadable files from backup
func markExcludedFromBackup(url: URL) throws {
    var resourceValues = URLResourceValues()
    resourceValues.isExcludedFromBackup = true
    try url
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл axiom-storage-management-ref?

Use when asking about 'purge files', 'storage pressure', 'disk space iOS', 'isExcludedFromBackup', 'URL resource values', 'volumeAvailableCapacity', 'low storage', 'file purging priority', 'cache management' - comprehensive reference for iOS storage management and URL resource value APIs

Как установить скилл axiom-storage-management-ref?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл axiom-storage-management-ref запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить axiom-storage-management-ref с