Live survey304 models · 14 providers · 23,592 auditsAudited implement · SAFE →What changedHow we verifyllms.txt

Agent skill · Audited from source

Swift Actor Persistence

skill · affaan-m/ECCMIT licenceAudited 22 Sep 2026 · source fb3fb10d9622

★ 264,831pushed today
✓SAFEGrade B · 89/100 · 22 Sep 2026 · fb3fb10
264,831repo stars · whole affaan-m/ECC

Is it safe? Yes — SAFE, grade B (89/100). We read this skill's source at commit fb3fb10d9622 and found no filesystem, network or shell access and no hard-coded secrets. What it does: Swiftでactorを使用してスレッドセーフなデータ永続化を実装する——メモリキャッシュとファイルバックドストレージを組み合わせ、設計によってデータ競合を排除する。

Ask an AI about this pageGChatGPTCClaudePPerplexityGeGeminiXGrok
More
Cite

Cite this page

ModelsAtlas. “Swift Actor Persistence (affaan-m/ECC)”. Retrieved 22 Sep 2026. https://modelsatlas.com/skills/affaan-m/swift-actor-persistence

2 skills are called “Swift Actor Persistence”. You are viewing affaan-m/ECC.

Trust audit

Audit 0.4.1 · source read 22 Sep 2026

Trust score89/100✓SAFE B
0 critical0 high0 medium0 low0 info

SAFE means nothing in the source contradicts what the skill says it does. Grade B is shared by 17,406 of 18,389 audited skills.

What the source does

  • FilesystemNone observedNo reads or writes in the source
  • NetworkNone observedNo outbound calls in the source
  • ShellNone observedNo commands run in the source
  • DependenciesPinnedNothing floats
  • SecretsNone foundNo keys in source

Five audit layers

LayerWhat we checkResultFindings
L0 ProvenanceRepo owner, licence, archive status, activityPASS0
L1 Static sourceSecrets, path traversal, supply chain, hidden codeNA0
L2 InstructionsPrompt injection, authority framing, hidden directivesPASS0
L3 InventoryThe files and declarations match the sourcePASS0
L4 SandboxRun in isolation and watch behaviourSKIPPED why0

Gates applied: no behavioural pass.

Findings (0)

No findings at any severity. We re-audit when the source changes.

Audit 0.4.1 · source sha fb3fb10d9622 · 22 Sep 2026Report an issue or request a re-scan

Provenance

Who published it, and what the verdict is pinned to

  • Publisheraffaan-m GitHub userOwner of the repository this skill is read from
  • Source folderaffaan-m/ECC/docs/ja-JP/skills/swift-actor-persistenceThe exact folder we audited
  • LicenceMITAs the repository states it
  • Commit pinned for this verdictfb3fb10d9622A new audit runs when the source changes
  • Repository statusNot archivedPushed today
  • Sandboxed runNot runSkills are read, not executed; layer L4 is skipped

What it tells the agent

Full source on GitHub ↗

Its description: Swiftでactorを使用してスレッドセーフなデータ永続化を実装する——メモリキャッシュとファイルバックドストレージを組み合わせ、設計によってデータ競合を排除する。

---
name: swift-actor-persistence
description: Swiftでactorを使用してスレッドセーフなデータ永続化を実装する——メモリキャッシュとファイルバックドストレージを組み合わせ、設計によってデータ競合を排除する。
origin: ECC
---

# スレッドセーフな永続化のための Swift Actor

Swiftのactorを使用してスレッドセーフなデータ永続化レイヤーを構築するパターン。メモリキャッシュとファイルバックドストレージを組み合わせ、actorモデルを活用してコンパイル時にデータ競合を排除する。

## 起動条件

* Swift 5.5以降でデータ永続化レイヤーを構築する場合
* 共有可変状態へのスレッドセーフアクセスが必要な場合
* 手動の同期(ロック、DispatchQueue)を排除したい場合
* ローカルストレージを持つオフラインファースとアプリを構築する場合

## コアパターン

### Actorベースのリポジトリ

Actorモデルはシリアライズされたアクセスを保証する——コンパイラによって強制されるデータ競合なし。

```swift
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 {
        let previous = cache[item.id]
        cache[item.id] = item
        do {
            try persistToFile()
        } catch {
            // ディスク書き込み失敗時はキャッシュをロールバックして整合性を維持
            cache[item.id] = previous
            throw error
        }
    }

    public func delete(_ id: String) throws {
        let previous = cache[id]
        cache[id] = nil
        do {
            try persistToFile()
        } catch {
            // ディスク書き込み失敗時はキャッシュをロールバックして整合性を維持
            cache[id] = previous
            throw error
        }
    }

    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(uniqueKeysWithValues: items.map { ($0.id, $0) })
    }
}
```

### 使い方

Actorの分離により、すべての呼び出しは自動的に非同期になる:

```swift
let repository = LocalRepository<Question>()

// Read — fast O(1) lookup from in-memory cache
let question = await repository.find(by: "q-001")
let allQuestions = await repository.loadAll()

// Write — updates cache and persists to file atomically
try await repository.save(newQuestion)
try await repository.delete("q-001")
```

### @Observable ViewModel との組み合わせ

```swift
@Observable
final class QuestionListViewModel {
    private(set) var questions: [Question] = []
    private let repository: LocalRepository<Question>

    init(repository: LocalRepository<Question> = LocalRepository()) {
        self.repository = repository
    }

    func load() async {
        questions = await repository.loadAll()
    }

    func add(_ question: Question) async throws {
        try await repository.save(question)
        questions = await repository.loadAll()
    }
}
```

## 重要な設計上の決定

| 決定 | 理由 |
|----------|-----------|
| Actorを使用(クラス + ロックではなく) | コンパイラによって強制されるスレッド安全性、手動同期不要 |
| メモリキャッシュ + ファイル永続化 | キャッシュからの高速読み取り、ディスクへの永続的な書き込み |
| 初期化時の同期ロード | 非同期初期化の複雑さを回避 |
| IDをキーとする辞書 | 識別子によるO(1)検索 |
| ジェネリック `Codable & Identifiable` | あらゆるモデル型で再利用可能 |
| アトミックなファイル書き込み(`.atomic`) | クラッシュ時の部分書き込みを防ぐ |

## ベストプラクティス

* **Actorの境界を越えるすべてのデータに `Sendable` 型を使用する**
* **Actorのパブリックなアビリティを最小化する** —— 永続化の詳細ではなく、ドメイン操作のみを公開する
* **`.atomic` 書き込みを使用する** —— 書き込み中のアプリクラッシュによるデータ破損を防ぐ
* **`init` で同期的にロードする** —— 非同期イニシャライザはローカルファイルに対するわずかな利点のために複雑さが増す
* **`@Observable` ViewModelと組み合わせる** —— リアクティブなUI更新を実現する

## 避けるべきアンチパターン

* Swiftの新しい並行処理コードでActorの代わりに `DispatchQueue` または `NSLock` を使用する
* 内部のキャッシュ辞書を外部の呼び出し元に公開する
* 初期化後にファイルURLを外部から変更可能にする(初期化時のみ設定を許可すること)
* すべてのActor メソッド呼び出しが `await` であることを忘れる——呼び出し元は非同期コンテキストを処理する必要がある
* Actor の分離をバイパスするために `nonisolated` を使用する(本末転倒)

## 使用場面

* iOS/macOSアプリのローカルデータストレージ(ユーザーデータ、設定、キャッシュコンテンツ)
* 後でサーバーと同期するオフラインファーストアーキテクチャ
* アプリの複数の部分から並行アクセスされる共有可変状態
* `DispatchQueue` ベースのレガシーなスレッド安全機構を最新のSwift並行処理に置き換える

Excerpt, first 4,226 characters of SKILL.md, verbatim from the audited commit. It is text from someone else’s repository, quoted so you can judge it before your agent reads it.

Install

Pinned to the audited commit fb3fb10

Download folder ↗
git clone https://github.com/affaan-m/ECC
git -C ECC checkout fb3fb10d9622

The author documents no install command, so this uses the repository directly. Our verdict covers commit fb3fb10d9622 only.

Works in

The author has not said which agents this skill supports, and we have not tested it in any.

Audit history

Every audit, every source change

  1. ✓SAFE B 89 / 100

    first audit · source fb3fb10d9622

README badge

For maintainers · shows the latest audit

ModelsAtlas: SAFE BMODELSATLASSAFE · B
[![ModelsAtlas: SAFE B](https://modelsatlas.com/skills/affaan-m/swift-actor-persistence/badge.svg)](https://modelsatlas.com/skills/affaan-m/swift-actor-persistence/)

The badge shows our verdict and grade for this skill, and links back to this page. It changes when the audit does.

eval-harness✓SAFE

affaan-m/everything-claude-code

Eval-driven development (EDD) framework for AI coding sessions — define capability and regression evals before coding, grade with code-based, model-based, rule, or human graders, and track pass@k and pass^k reliability.…

★ 303kGrade B
ecc-recipes✓SAFE

affaan-m/everything-claude-code

Map a described workflow to the right ECC command group with run-order and stop condition, or browse all command-group recipe families read live from the commands directory. Advisory only — never executes. Use when…

★ 302kGrade B
dynamic-workflow-mode✓SAFE

affaan-m/everything-claude-code

Design task-local harnesses, eval gates, and reusable skill extraction for Claude dynamic workflow mode and other adaptive agent harnesses. Use when building a task-local harness, adding eval gates, or extracting a…

★ 302kGrade B
django-verification!CAUTION

affaan-m/everything-claude-code

Run the full Django verification loop — environment check, mypy/ruff/black linting, migration safety, pytest with coverage targets, pip-audit and bandit security scans, settings and logging review, and diff review —…

★ 294kGrade B
django-patterns✓SAFE

affaan-m/everything-claude-code

Django architecture patterns, REST API design with DRF, ORM best practices, caching, signals, middleware, and production-grade Django apps. Use when building or reviewing Django apps, DRF APIs, ORM queries, or caching.

★ 294kGrade B
django-security✓SAFE

affaan-m/everything-claude-code

Django security best practices, authentication, authorization, CSRF protection, SQL injection prevention, XSS prevention, and secure deployment configurations. Use when reviewing Django authentication, authorization,…

★ 294kGrade B

Add this badge to your README

[![ModelsAtlas: SAFE B](https://modelsatlas.com/skills/affaan-m/swift-actor-persistence/badge.svg)](https://modelsatlas.com/skills/affaan-m/swift-actor-persistence/)

Questions about Swift Actor Persistence

What does the Swift Actor Persistence skill do?
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Is Swift Actor Persistence safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can Swift Actor Persistence access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
How current is this page?
The grade is for one exact copy of the source (fb3fb10d9622), read on 2026-09-22. The repository is watched, and a new audit runs when it changes — this is the first audit.

Sources

Spotted something wrong? Report a correction · Methodology

Keep going in your AI

Opens with this page as the source. We add nothing else to the prompt.