core-data

core-data is a skill for Claude Code, OpenCode from ahmed3elshaer/everything-claude-code-mobile. It costs 24 tokens per session (1,965 once invoked), scanned A, original, MIT.

Guidance for using Core Data and SwiftData to store application data on iOS. Core Data is Apple's system for saving, querying, and managing structured local data, including background work and data-model migrations.

In plain words
What is it for?
Use it to set up a persistence stack, define data models, fetch records, perform background updates, connect stored data to SwiftUI, and plan migrations.
Why use it?
It helps organize persistent data and database-like operations in an iOS app. It also covers keeping saved data synchronized with SwiftUI and moving between model versions.

Skill for Claude CodeOpenCode

Written for Claude Code and OpenCode: shipped in a Claude Code plugin, but also installed under .opencode/. Also seen: positional $N argument.

Part of the everything-claude-code-mobile plugin — 46 skills, 35 commands, 27 agents, 2 hooks, 3 MCP servers shipped together

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.

agentmods
npx agentmods add skills/ahmed3elshaer/everything-claude-code-mobile/core-data
Any agent
npx skills add ahmed3elshaer/everything-claude-code-mobile --skill core-data
Clone the repo
git clone --depth 1 https://github.com/ahmed3elshaer/everything-claude-code-mobile

Made for: Claude Code, OpenCode.

Or install everything-claude-code-mobile, the plugin that ships this one along with the rest of its 46 skills, 35 commands, 27 agents, 2 hooks, 3 MCP servers.

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 core-data

README.md
[![agentmods](https://agentmods.dev/badge/skills/ahmed3elshaer/everything-claude-code-mobile/core-data.svg)](https://agentmods.dev/skills/ahmed3elshaer/everything-claude-code-mobile/core-data)
Your own site
<a href="https://agentmods.dev/skills/ahmed3elshaer/everything-claude-code-mobile/core-data"><img src="https://agentmods.dev/badge/skills/ahmed3elshaer/everything-claude-code-mobile/core-data.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,965 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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.00024 $0.01965
Opus 5 $0.00012 $0.00983
Sonnet 5 $0.00005 $0.00393
Haiku 4.5 $0.00002 $0.00197

Measured 6d ago against content hash 5ef53c80810f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

core-data scanned grade A with 1 finding 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 6d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

return try viewContext.fetch(request)
.opencode/skills/core-data/SKILL.md · 384 lines

How it starts

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

Core Data

iOS persistence with Core Data and SwiftData.

Core Data Stack

Basic Setup

// ✅ Core Data stack
class PersistenceController {
    static let shared = PersistenceController()

    let container: NSPersistentContainer

    init(inMemory: Bool = false) {
        container = NSPersistentContainer(name: "DataModel")

        if inMemory {
            container.persistentStoreDescriptions.first?.url = URL(fileURLWithPath: "/dev/null")
        }

        container.loadPersistentStores { description, error in
            if let error = error {
                fatalError("Core Data store failed to load: \(error)")
            }
        }

        container.viewContext.automaticallyMergesChangesFromParent = true
        container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
    }

    var viewContext: NSManagedObjectContext {
        container.viewContext
    }

    func backgroundContext() -> NSManagedObjectContext {
        container.newBackgroundContext()
    }
}

SwiftUI Integration

// ✅ @FetchRequest in SwiftUI
struct UserListView: View {
    @Environment(\.managedObjectContext) private var viewContext

    @FetchRequest(
        sortDescriptors: [NSSortDescriptor(keyPath: \User.name, ascending: true)],
        animation: .default)
    private var users: FetchedResults<User>

    var body: some View {
        List {
            ForEach(users) { user in
                Text(user.name ?? "Unknown")
            }
            .onDelete(perform: deleteUsers)
        }
    }

    private func deleteUsers(offsets: IndexSet) {
        withAnimation {
            offsets.map { users[$0] }.forEach(viewContext.delete)

            do {
                try viewContext.save()
            } catch {
                print("Failed to save: \(error)")
            }
        }
    }
}

Fetch Requests

Basic Fetch

// ✅ Simple fetch
func fetchUsers() -> [User] {
    let request: NSFetchRequest<User> = User.fetchRequest()
    request.sortDescriptors = [NSSortDescriptor(key: "name", ascending: true)]

    do {
        return try viewContext.fetch(request)
    } catch {
        print("Fetch error: \(error)")
        return []
    }
}

// ✅ With predicate
func fetchUsers(named name: String) -> [User] {
    let request: NSFetchRequest<User> = User.fetchRequest()
    request.predicate = NSPredicate(format: "name == %@", name)
    request.fetchLimit = 1

    do {
        return try viewContext.fetch(request)
    } catch {
        return []
    }
}

// ✅ Complex predicate
func searchUsers(query: String) -> [User] {
    let request: NSFetchRequest<User> = User.fetchRequest()
    request.predicate = NSPredicate(
        format: "name CONTAINS[cd] %@ OR email CONTAINS[cd] %@",
        query, query
    )
    request.sortDescriptors = [NSSortDescriptor(key: "name", ascending: true)]

    do {
        return try viewContext.fetch(request)
    } catch {
        return []
    }
}

Read the full file on GitHub · 384 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. 6d ago First seen · 384 lines · 24 tokens per session scan A 5ef53c80810f

Subscribe to this mod's changes

core-data is a skill published in the GitHub repository ahmed3elshaer/everything-claude-code-mobile (65 stars, last pushed 2mo ago), licensed MIT. It adds 24 tokens to every session and 1,965 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

SKILL

This document provides a comprehensive technical reference for KSensor, a Kotlin Multiplatform (KMP) library designed for observing device sensors and system states on Android and iOS.

ShadAdman/KSensor · 0 tokens

mobile-mcp

Mobile automation and debugging for Android and iOS apps via accessibility snapshots. Use when asked to test, debug, inspect, screenshot, tap, swipe, type, navigate, or crash-report on the Livtet mobile apps. Triggers on "screen", "tap", "click", "screenshot", "debug on device", "what's on screen", "launch the app"…

olamaelcu/livtet-mobile · 98 tokens

compose-animations

Use when writing or reviewing Jetpack Compose motion: visibility enter/exit, animating one property toward a target, color or size transitions, multiple properties from one state, switching composable content, or choosing between AnimatedVisibility, animateAsState, rememberTransition, AnimatedContent, and Crossfade.

chrisbanes/skills · 64 tokens

compose-focus-navigation

Use when writing or reviewing Jetpack Compose UI for TV, keyboard, desktop, accessibility focus, D-pad navigation, FocusRequester, focusProperties, key events, or initial focus behavior.

chrisbanes/skills · 41 tokens

compose-state-and-effects

Use when writing or reviewing Jetpack Compose state ownership, remember state, state hoisting, screen state holders, LaunchedEffect, DisposableEffect, SideEffect, Flow collection, navigation, snackbar, analytics, or focus requests.

chrisbanes/skills · 50 tokens

compose-component-design

Use when designing or reviewing reusable Jetpack Compose component APIs with modifier parameters, root layout placement, caller-provided variable content, primitive content parameters, optional content, or boolean shape flags.

chrisbanes/skills · 41 tokens