ECC: Skill for Kiro

.kiro/skills/swift-actor-persistence/SKILL.md

swift-actor-persistence is a skill for Kiro from affaan-m/ECC. It costs 29 tokens per session (1,063 once invoked), scanned A, original, MIT.

A Swift data-storage pattern that keeps frequently used data in memory and saves it to files, while Swift actors serialize access to shared data. Swift is Apple's programming language for apps.

In plain words
What is it for?
Use it to build thread-safe local storage, in-memory caches with file backup, or offline-first Swift apps.
Why use it?
It prevents data races when multiple parts of an app read or change stored data at the same time and reduces the need for manual locks.

Skill for Kiro

Written for Kiro: installed under .kiro/. Also seen: positional $N argument.

This is affaan-m/ECC's own configuration. It tells Kiro how to work on ECC itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ECC configures →

Part of the ecc plugin — 70 skills, 58 commands, 68 agents, 1 MCP server shipped together

About the project

ECC is a toolkit that organizes and improves how coding agents work through skills, memory, security checks, research practices, and related extensions. It is for developers using agents such as Claude Code, Codex, OpenCode, and Cursor.

affaan-m/ECC · 253,158 stars · on GitHub · ecc.tools

Reuse

Borrowing it

Nothing to install: this file belongs to affaan-m/ECC. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/affaan-m/ECC/main/.kiro/skills/swift-actor-persistence/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/affaan-m/ECC

Made for: Kiro.

Or install ecc, the plugin that ships this one along with the rest of its 70 skills, 58 commands, 68 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-actor-persistence

README.md
[![agentmods](https://agentmods.dev/badge/skills/affaan-m/ecc/swift-actor-persistence.svg)](https://agentmods.dev/skills/affaan-m/ecc/swift-actor-persistence)
Your own site
<a href="https://agentmods.dev/skills/affaan-m/ecc/swift-actor-persistence"><img src="https://agentmods.dev/badge/skills/affaan-m/ecc/swift-actor-persistence.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,063 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. ✓ AI security review Fable 5.1 · 6 Sept 2026 📄 Read the review Third-party audits
  • Socket pass 12 Aug 2026
  • Snyk pass 12 Aug 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.01063
Opus 5 $0.00015 $0.00531
Sonnet 5 $0.00006 $0.00213
Haiku 4.5 $0.00003 $0.00106

Measured 4d ago against content hash f83d03866a68, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

swift-actor-persistence scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

5 near-identical copies found in the catalogue:

.kiro/skills/swift-actor-persistence/SKILL.md · 144 lines

How it starts

The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swift Actors for Thread-Safe Persistence

Patterns for building thread-safe data persistence layers using Swift actors. Combines in-memory caching with file-backed storage, leveraging the actor model to eliminate data races at compile time.

When to Activate

  • Building a data persistence layer in Swift 5.9+ (iOS 17+, macOS 14+)
  • Need thread-safe access to shared mutable state
  • Want to eliminate manual synchronization (locks, DispatchQueues)
  • Building offline-first apps with local storage

Core Pattern

Actor-Based Repository

The actor model guarantees serialized access — no data races, enforced by the compiler.

public actor LocalRepository<T: Codable & Identifiable> where T.ID == String {
    private var cache: [String: T] = [:]
    private let fileURL: URL

    public init(directory: URL = .documentsDirectory, filename: String = "data.json") {
        self.fileURL = directory.appendingPathComponent(filename)
        // Synchronous load during init (actor isolation not yet active)
        self.cache = Self.loadSynchronously(from: fileURL)
    }

    // MARK: - Public API

    public func save(_ item: T) throws {
        cache[item.id] = item
        try persistToFile()
    }

    public func delete(_ id: String) throws {
        cache[id] = nil
        try persistToFile()
    }

    public func find(by id: String) -> T? {
        cache[id]
    }

    public func loadAll() -> [T] {
        Array(cache.values)
    }

    // MARK: - Private

    private func persistToFile() throws {
        let data = try JSONEncoder().encode(Array(cache.values))
        try data.write(to: fileURL, options: .atomic)
    }

    private static func loadSynchronously(from url: URL) -> [String: T] {
        guard let data = try? Data(contentsOf: url),
              let items = try? JSONDecoder().decode([T].self, from: data) else {
            return [:]
        }
        return Dictionary(items.map { ($0.id, $0) }, uniquingKeysWith: { _, latest in latest })
    }
}

Read the full file on GitHub · 144 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 144 lines · 29 tokens per session scan A f83d03866a68

Subscribe to this mod's changes

swift-actor-persistence is a skill published in the GitHub repository affaan-m/ECC (253,158 stars, last pushed today), licensed MIT. It adds 29 tokens to every session and 1,063 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

axiom-core-data-diag

Use when debugging schema migration crashes, concurrency thread-confinement errors, N+1 query performance, SwiftData to Core Data bridging, or testing migrations without data loss - systematic Core Data diagnostics with safety-first migration patterns.

ComeOnOliver/skillshub · 50 tokens

axiom-swiftdata

Use when working with SwiftData - @Model definitions, @Query in SwiftUI, @Relationship macros, ModelContext patterns, CloudKit integration, iOS 26+ features, and Swift 6 concurrency with @MainActor — Apple's native persistence framework.

ComeOnOliver/skillshub · 56 tokens

axiom-realm-migration-ref

Use when migrating from Realm to SwiftData - comprehensive migration guide covering pattern equivalents, threading model conversion, schema migration strategies, CloudKit sync transition, and real-world scenarios.

ComeOnOliver/skillshub · 41 tokens

axiom-sqlitedata-ref

SQLiteData advanced patterns, @Selection column groups, single-table inheritance, recursive CTEs, database views, custom aggregates, TableAlias self-joins, JSON/string aggregation.

ComeOnOliver/skillshub · 42 tokens

axiom-sqlitedata

Use when working with SQLiteData @Table models, CRUD operations, query patterns, CloudKit SyncEngine setup, or batch imports. Covers model definitions, @FetchAll/@FetchOne, upsert patterns, database setup with Dependencies.

ComeOnOliver/skillshub · 53 tokens

axiom-swiftdata-migration

Use when creating SwiftData custom schema migrations with VersionedSchema and SchemaMigrationPlan - property type changes, relationship preservation (one-to-many, many-to-many), the willMigrate/didMigrate limitation, two-stage migration patterns, and testing migrations on real devices.

ComeOnOliver/skillshub · 61 tokens