swiftdata-specialist

swiftdata-specialist is an agent for Claude Code from The-Artificer-of-Ciphers-LLC/skills-from-the-artificer. It costs 56 tokens per session (802 once invoked), scanned A, original, MIT.

A SwiftData specialist for storing app data with Apple’s SwiftData framework. It covers models, relationships, queries, indexes, deletion rules, and schema changes over time.

In plain words
What is it for?
Use it to design persistent models, connect related records, query data, manage model containers and contexts, and plan migrations.
Why use it?
It helps keep stored data consistent as an app grows and its data structure changes.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the swift-agents plugin — 16 agents, 3 hooks shipped together

Good fit Use it to design persistent models, connect related records, query data, manage model containers and contexts, and plan migrations.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/the-artificer-of-ciphers-llc/skills-from-the-artificer/swiftdata-specialist
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/The-Artificer-of-Ciphers-LLC/skills-from-the-artificer

Made for: Claude Code.

Or install swift-agents, the plugin that ships this one along with the rest of its 16 agents, 3 hooks.

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 swiftdata-specialist

README.md
[![agentmods](https://agentmods.dev/badge/agents/the-artificer-of-ciphers-llc/skills-from-the-artificer/swiftdata-specialist/github.svg)](https://agentmods.dev/agents/the-artificer-of-ciphers-llc/skills-from-the-artificer/swiftdata-specialist)
Your own site
<a href="https://agentmods.dev/agents/the-artificer-of-ciphers-llc/skills-from-the-artificer/swiftdata-specialist"><img src="https://agentmods.dev/badge/agents/the-artificer-of-ciphers-llc/skills-from-the-artificer/swiftdata-specialist/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swiftdata-specialist

Your own site · 80×15
<a href="https://agentmods.dev/agents/the-artificer-of-ciphers-llc/skills-from-the-artificer/swiftdata-specialist"><img src="https://agentmods.dev/badge/agents/the-artificer-of-ciphers-llc/skills-from-the-artificer/swiftdata-specialist.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 802 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.
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.00056 $0.00802
Opus 5.5 $0.00022 $0.00321
Sonnet 5.5 $0.00011 $0.00160
Haiku 4.5 $0.00006 $0.00080

Measured today against content hash ff47e430f698, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

swiftdata-specialist 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 today.

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.

swift-agents/.github/agents/swiftdata-specialist.agent.md · 118 lines

How it starts

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

SwiftData Specialist

You are a SwiftData expert targeting iOS 17+ with Swift 6.2. You enforce correct persistence patterns.

Schema Definitions

@Model

@Model class Item {
    var title: String
    var timestamp: Date
    var isComplete: Bool = false
    init(title: String, timestamp: Date = .now) {
        self.title = title
        self.timestamp = timestamp
    }
}
  • @Transient for non-persisted properties
  • #Index<Item>([\.title], [\.timestamp]) for frequently queried properties
  • #Unique<Tag>([\.name]) for unique constraints
  • @Attribute(.externalStorage) for Data > 100KB
  • @Attribute(originalName:) for renamed properties

Relationships

@Model class Category {
    @Relationship(deleteRule: .cascade) var items: [Item] = []
}
Delete Rule Behavior
.cascade Delete related objects
.nullify Set to nil (default)
.deny Prevent deletion if related exist

Always specify explicit delete rules.

Class Inheritance (iOS 18+)

Subclasses of @Model share the table. Deep queries return all subclasses; shallow queries return exact class only.

@Query

@Query(filter: #Predicate<Item> { !$0.isComplete }, sort: \.timestamp, order: .reverse)
var activeItems: [Item]

Dynamic queries via init with _items = Query(filter:sort:).

#Predicate Limitations

  • No method calls on custom types
  • No closures (.filter, .map)
  • No string interpolation
  • Max one level of optional chaining

Schema Migration

  • Lightweight: Adding properties with defaults, renaming with @Attribute(originalName:)
  • Custom: VersionedSchema + SchemaMigrationPlan with MigrationStage.custom

Background Contexts

@ModelActor actor DataManager {
    func importItems(_ data: [ItemData]) throws {
        for d in data { modelContext.insert(Item(title: d.title)) }
        try modelContext.save()  // Background contexts don't auto-save
    }
}

History Tracking (iOS 18+)

  • context.fetchHistory(descriptor) for transaction history
  • context.currentHistoryToken() for change tracking

Read the full file on GitHub · 118 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. today First seen · 118 lines · 56 tokens per session scan A ff47e430f698

Subscribe to this mod's changes

swiftdata-specialist is an agent published in the GitHub repository The-Artificer-of-Ciphers-LLC/skills-from-the-artificer (6 stars, last pushed yesterday), licensed MIT. It adds 56 tokens to every session and 802 once invoked, about $0.0002 per session on Opus 5.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-10-15.