Skip to content
Back to search

core-data-agent-skill

MarketplaceWorks with Claude CodeGitHub

An Agent Skill focused on Apple’s Core Data framework, helping with data modeling, fetch requests, performance, and common persistence patterns.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/avdlee-core-data-agent-skill/badge.svg)](/listings/avdlee-core-data-agent-skill)

HTML

<a href="/listings/avdlee-core-data-agent-skill"><img src="/api/listings/avdlee-core-data-agent-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 54 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
  3. "name": "core-data-agent-skill",
  4. "version": "1.0.0",
  5. "owner": {
  6. "name": "Antoine van der Lee",
  7. "email": "contact@avanderlee.com"
  8. },
  9. "metadata": {
  10. "description": "Expert guidance on Core Data: persistence, data modeling, threading, performance optimization, and CloudKit integration."
  11. },
  12. "plugins": [
  13. {
  14. "name": "core-data-expert",
  15. "description": "Expert guidance on Core Data persistence, data modeling, and performance. Covers NSPersistentContainer, fetch optimization, threading with NSManagedObjectID, batch operations, schema migration, and NSPersistentCloudKitContainer integration.",
  16. "repository": "https://github.com/AvdLee/Core-Data-Agent-Skill",
  17. "version": "1.0.0",
  18. "author": {
  19. "name": "Antoine van der Lee",
  20. "email": "contact@avanderlee.com"
  21. },
  22. "license": "MIT",
  23. "category": "development",
  24. "keywords": [
  25. "core-data",
  26. "coredata",
  27. "persistence",
  28. "database",
  29. "sqlite",
  30. "cloudkit",
  31. "nspersistentcontainer",
  32. "nsmanagedobject",
  33. "fetch-requests",
  34. "threading",
  35. "migration",
  36. "ios",
  37. "macos",
  38. "swift",
  39. "apple"
  40. ],
  41. "tags": [
  42. "core-data",
  43. "persistence",
  44. "database",
  45. "cloudkit",
  46. "ios",
  47. "macos",
  48. "swift",
  49. "apple-platforms"
  50. ],
  51. "source": "./"
  52. }
  53. ]
  54. }
README.md · README · 190 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Core Data Agent Skill
  2. Expert guidance for any AI coding tool that supports the [Agent Skills open format](https://agentskills.io/home) — safe persistence, performance optimization, and schema migration.
  3. Based on the [Core Data Best Practices](https://github.com/AvdLee/CoreDataBestPractices) repo, WeTransfer production apps, and WWDC sessions, distilled into actionable, concise references for agents.
  4. ## Who this is for
  5. - Teams working with Core Data who need safe defaults and quick triage
  6. - Developers debugging persistence issues, threading errors, or performance problems
  7. - Anyone migrating schemas or integrating CloudKit sync
  8. ## See also my other skills:
  9. - [Swift Concurrency Expert](https://github.com/AvdLee/Swift-Concurrency-Agent-Skill)
  10. - [SwiftUI Expert](https://github.com/AvdLee/SwiftUI-Agent-Skill)
  11. - [Swift Testing Expert](https://github.com/AvdLee/Swift-Testing-Agent-Skill)
  12. ## How to Use This Skill
  13. ### Option A: Using skills.sh (recommended)
  14. Install this skill with a single command:
  15. ```bash
  16. npx skills add https://github.com/avdlee/core-data-agent-skill --skill core-data-expert
  17. ```
  18. For more information, visit the [skills.sh platform page](https://skills.sh/avdlee/core-data-agent-skill/core-data-expert).
  19. Then use the skill in your AI agent, for example:
  20. > Use the core data skill and analyze the current project for Core Data improvements
  21. ### Option B: Claude Code Plugin
  22. #### Personal Usage
  23. To install this Skill for your personal use in Claude Code:
  24. 1. Add the marketplace:
  25. ```bash
  26. /plugin marketplace add AvdLee/Core-Data-Agent-Skill
  27. ```
  28. 2. Install the Skill:
  29. ```bash
  30. /plugin install core-data-expert@core-data-agent-skill
  31. ```
  32. #### Project Configuration
  33. To automatically provide this Skill to everyone working in a repository, configure the repository's `.claude/settings.json`:
  34. ```json
  35. {
  36. "enabledPlugins": {
  37. "core-data-expert@core-data-agent-skill": true
  38. },
  39. "extraKnownMarketplaces": {
  40. "core-data-agent-skill": {
  41. "source": {
  42. "source": "github",
  43. "repo": "AvdLee/Core-Data-Agent-Skill"
  44. }
  45. }
  46. }
  47. }
  48. ```
  49. When team members open the project, Claude Code will prompt them to install the Skill.
  50. ### Option C: Manual install
  51. 1) **Clone** this repository.
  52. 2) **Install or symlink** the `core-data-expert/` folder following your tool's official skills installation docs (see links below).
  53. 3) **Use your AI tool** as usual and ask it to use the "core-data-expert" skill for Core Data tasks.
  54. #### Where to Save Skills
  55. Follow your tool's official documentation, here are a few popular ones:
  56. - **Codex:** [Where to save skills](https://developers.openai.com/codex/skills/#where-to-save-skills)
  57. - **Claude:** [Using Skills](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview#using-skills)
  58. - **Cursor:** [Enabling Skills](https://cursor.com/docs/context/skills#enabling-skills)
  59. **How to verify**:
  60. Your agent should reference the triage/playbook in `core-data-expert/SKILL.md` and jump into the relevant reference file for your error or task.
  61. ## What This Skill Offers
  62. This skill gives your AI coding tool comprehensive Core Data guidance. It can:
  63. ### Guide Your Persistence Decisions
  64. - Choose the right stack setup (NSPersistentContainer vs NSPersistentCloudKitContainer)
  65. - Understand when to use view context vs background context
  66. - Navigate merge policies and conflict resolution
  67. - Apply proper context configuration for your use case
  68. ### Write Thread-Safe Code
  69. - Avoid common threading pitfalls with NSManagedObjectID
  70. - Prevent data races with proper context usage
  71. - Handle cross-context communication correctly
  72. - Use perform vs performAndWait appropriately
  73. ### Optimize Performance
  74. - Write efficient fetch requests with proper batching and property limiting
  75. - Reduce memory usage with context resets and faulting control
  76. - Use batch operations for large-scale data changes
  77. - Profile with Instruments to identify bottlenecks
  78. ### Migrate Schemas Safely
  79. - Use lightweight migration for common changes
  80. - Decompose complex migrations with staged migration (iOS 17+)
  81. - Defer expensive cleanup with deferred migration (iOS 14+)
  82. - Handle composite attributes and model versioning
  83. ### Integrate with CloudKit
  84. - Set up NSPersistentCloudKitContainer correctly
  85. - Design schemas within CloudKit limitations
  86. - Monitor sync with event notifications
  87. - Debug sync issues with system logs
  88. ## What Makes This Skill Different
  89. **Expert Knowledge**: Based primarily on the comprehensive [SwiftLee Core Data articles](https://www.avanderlee.com/category/core-data/) and the [Core Data Best Practices repository](https://github.com/AvdLee/CoreDataBestPractices), with additional insights from WWDC sessions. All content reflects real-world experience from production apps like Collect by WeTransfer.
  90. **Non-Opinionated**: Focuses on industry-standard best practices and compile-time safety, not architectural preferences. Works with any Swift project, coding style, or architecture.
  91. **Modern Core Data**: Covers the latest features including:
  92. - Composite attributes (iOS 17+)
  93. - Staged migration (iOS 17+)
  94. - Deferred migration (iOS 14+)
  95. - NSBatchInsertRequest improvements (iOS 14+)
  96. - NSPersistentCloudKitContainer patterns
  97. **Practical & Concise**: Assumes your AI agent is already smart. Focuses on what developers need to know, not what they already understand. Includes code examples for every pattern.
  98. ## Skill Structure
  99. ```
  100. core-data-expert/
  101. ├── SKILL.md # Main skill file with decision trees
  102. └── references/
  103. ├── _index.md # Navigation index
  104. ├── batch-operations.md # NSBatchInsertRequest, NSBatchDeleteRequest, NSBatchUpdateRequest
  105. ├── cloudkit-integration.md # NSPersistentCloudKitContainer, schema design, monitoring
  106. ├── fetch-requests.md # Query optimization, NSFetchedResultsController, aggregates
  107. ├── glossary.md # Core Data terminology and quick definitions
  108. ├── migration.md # Lightweight, staged, and deferred migration strategies
  109. ├── model-configuration.md # Constraints, derived attributes, transformables, validation
  110. ├── performance.md # Profiling with Instruments, memory management, optimization
  111. ├── persistent-history.md # History tracking setup, Observer/Fetcher/Merger/Cleaner
  112. ├── project-audit.md # Checklist to discover a project's Core Data setup
  113. ├── saving.md # Conditional saving, hasPersistentChanges, save timing
  114. ├── stack-setup.md # NSPersistentContainer setup, merge policies, contexts
  115. ├── testing.md # In-memory stores, shared models, data generators
  116. └── threading.md # NSManagedObjectID, perform vs performAndWait, concurrency
  117. ```
  118. ## Resources
  119. This skill is based primarily on:
  120. - **[SwiftLee Core Data Articles](https://www.avanderlee.com/category/core-data/)** - Comprehensive articles covering Core Data best practices, performance optimization, and real-world implementations
  121. - **[Core Data Best Practices GitHub Repository](https://github.com/AvdLee/CoreDataBestPractices)** - Working code examples demonstrating Core Data best practices
  122. Additional resources:
  123. - **[WWDC 2022-10119: Optimize your use of Core Data and CloudKit](https://developer.apple.com/videos/play/wwdc2022/10119/)** - Performance optimization and CloudKit integration
  124. - **[WWDC 2022-10120: Evolve your Core Data schema](https://developer.apple.com/videos/play/wwdc2022/10120/)** - Schema migration strategies
  125. - **[WWDC 2023-10186: What's new in Core Data](https://developer.apple.com/videos/play/wwdc2023/10186/)** - Composite attributes, staged migration, and deferred migration
  126. ## Contributing
  127. Contributions are welcome! This repository follows the [Agent Skills open format](https://agentskills.io/home), which has specific structural requirements.
  128. **We strongly recommend using AI assistance for contributions:**
  129. - Use the [skill-creator skill](https://github.com/anthropics/skills/tree/main/skills/skill-creator) with Claude to ensure proper formatting
  130. - This helps maintain the Agent Skills format and ensures your contribution works correctly with AI agents
  131. **Please read [CONTRIBUTING.md](CONTRIBUTING.md) for:**
  132. - How to use the skill-creator skill for contributions
  133. - Agent Skills format requirements
  134. - Quality standards and best practices
  135. - Pull request process
  136. This skill is maintained to reflect the latest Core Data best practices and will be updated as the framework evolves.
  137. ## About the Author
  138. Created by [Antoine van der Lee](https://www.avanderlee.com), a Swift expert with years of experience building production apps with Core Data. He developed the Collect by WeTransfer app for over four years and has [published numerous articles on Core Data](https://www.avanderlee.com/category/core-data/) on his blog called SwiftLee.
  139. ## License
  140. This skill is open-source and available under the MIT License. See [LICENSE](LICENSE) for details.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.