Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

swift-security

БесплатноБез исполняемых скриптовНе проверен

Use when working with iOS/macOS Keychain Services (SecItem queries, kSecClass, OSStatus errors), biometric authentication (LAContext, Face ID, Touch ID)…

dpearson2699от dpearson2699★ 1 335 звёзд на GitHub

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

Swift Security

Use this skill for client-side Apple platform security work: Keychain Services, access control, biometric-gated secrets, CryptoKit, Secure Enclave keys, credential storage, certificate trust, keychain sharing, legacy secret migration, security testing, and OWASP mobile compliance mapping.

Default to iOS 17+ and Swift concurrency examples when the deployment target is unknown. Keep iOS 13+ compatibility notes when the user asks for older targets. Treat iOS 26 CryptoKit post-quantum APIs as availability-gated.

Contents

Workflow

Classify the request before loading references.

  1. Review existing code: run the Review Checklist, then load common-anti-patterns.md plus the domain reference for each failing area. Report severity, evidence, and the corrected pattern.
  2. Improve or migrate code: identify the migration type, load the migration and target-domain references, preserve existing data, verify the new item, then remove legacy storage only after success.
  3. Implement new security code: load the minimum domain references, use the provided correct patterns, include OSStatus handling and tests, then run the relevant checklist.

Do not load every reference file by default. This skill is intentionally split for progressive disclosure; load only the files needed by the user's task.

Minimum Safe Keychain Write

Use separate add, identity, and update dictionaries; handle every OSStatus:

func saveSecret(_ data: Data, account: String) throws {
    let identity: [CFString: Any] = [
        kSecClass: kSecClassGenericPassword,
        kSecAttrService: "com.example.app",
        kSecAttrAccount: account,
    ]
    var add = identity
    add[kSecValueData] = data
    add[kSecAttrAccessible] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly

    switch SecItemAdd(add as CFDictionary, nil) {
    case errSecSuccess:
        return
    case errSecDuplicateItem:
        let status = SecItemUpdate(
            identity as CFDictionary,
            [kSecValueData: data] as CFDictionary
        )
        guard status == errSecSuccess else { throw KeychainError(status: status) }
    case let status:
        throw KeychainError(status: status)
    }
}

Load keychain-fundamentals.md for read, delete, access-control, locked-device, and test patterns.

Reference Loading

If the task involves Load
General keychain CRUD or OSStatus handling keychain-fundamentals.md
Choosing kSecClass or item identity keychain-item-classes.md
Accessibility classes or SecAccessControl keychain-access-control.md
Face ID, Touch ID, or biometric-gated secrets biometric-authentication.md
Secure Enclave keys secure-enclave.md
Hashing, HMAC, AES-GCM, ChaChaPoly, HKDF, PBKDF2 cryptokit-symmetric.md
Signing, ECDH, HPKE, ML-KEM, ML-DSA cryptokit-public-key.md
OAuth tokens, API keys, logout, refresh rotation credential-storage-patterns.md
App/extension keychain sharing keychain-sharing.md
Certificate trust, SPKI pinning, mTLS certificate-trust.md
UserDefaults/plist/NSCoding migration migration-legacy-stores.md
Unit, integration, simulator, device, or CI tests testing-security-code.md
OWASP MASVS/MASTG or enterprise audit mapping compliance-owasp-mapping.md
Full security review common-anti-patterns.md, then each touched domain reference

Security Invariants

Use directive language only for these security invariants and the matching anti-patterns in common-anti-patterns.md. For architecture choices outside this list, use advisory language.

  • Never store tokens, passwords, API keys, signing keys, or refresh tokens in UserDefaults, Info.plist, .xcconfig, source code, logs, files, or NSCoding archives. Use Keychain or fetch secrets at runtime.
  • Never ignore OSStatus. Every SecItemAdd, SecItemCopyMatching, SecItemUpdate, and SecItemDelete path must handle success and expected failures such as `errSecDuplicate
Полный SKILL.md на GitHub

Установить swift-security в Claude Code и Claude Desktop

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

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

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

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

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

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

Вложенные файлы

evals/evals.jsonreferences/biometric-authentication.mdreferences/certificate-trust.mdreferences/common-anti-patterns.mdreferences/compliance-owasp-mapping.mdreferences/credential-storage-patterns.mdreferences/cryptokit-public-key.mdreferences/cryptokit-symmetric.mdreferences/keychain-access-control.mdreferences/keychain-fundamentals.mdreferences/keychain-item-classes.mdreferences/keychain-sharing.mdreferences/migration-legacy-stores.mdreferences/secure-enclave.mdreferences/testing-security-code.md

FAQ

Что делает скилл swift-security?

Use when working with iOS/macOS Keychain Services (SecItem queries, kSecClass, OSStatus errors), biometric authentication (LAContext, Face ID, Touch ID), CryptoKit (AES-GCM, ChaChaPoly, ECDSA, ECDH, HPKE, ML-KEM), Secure Enclave, secure credential storage (OAuth tokens, API keys), certificate pinning (SecTrust, SPKI), keychain sharing across apps/extensions, migrating secrets from UserDefaults or plists, or OWASP MASVS/MASTG mobile compliance on Apple platforms.

Как установить скилл swift-security?

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

Скилл swift-security запускает скрипты?

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

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

Сравнить swift-security с