Use when working with SQLiteData library (@Table, @FetchAll, @FetchOne macros) for SQLite persistence, queries, writes, migrations, or CloudKit private database sync.
Type-safe SQLite persistence with Swift macros for tables, queries, and CloudKit sync. Use when defining database models with `@Table`, fetching data with `@FetchAll`/`@FetchOne`, or performing migrations and writes.
/plugin marketplace add johnrogers/claude-swift-engineering/plugin install swift-engineering@claude-swift-engineeringThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/advanced.mdreferences/cloudkit.mdreferences/dependencies.mdreferences/migrations.mdreferences/models.mdreferences/queries.mdreferences/schema-composition.mdreferences/testing.mdreferences/views.mdreferences/writes.mdSQLiteData provides type-safe SQLite access through Swift macros, simplifying database modeling and queries while handling CloudKit sync, migrations, and async patterns automatically.
| Reference | Load When |
|---|---|
| Table Models | Defining database tables with @Table macro, setting up primary keys, columns, or enums |
| Queries | Using @FetchAll, @FetchOne, @Fetch property wrappers, or building queries with joins/filters |
| Writes | Inserting, updating, upserting, or deleting records; managing transactions |
| Views | Integrating @FetchAll/@FetchOne with SwiftUI views, @Observable models, UIKit, or TCA @ObservableState |
| Migrations | Creating database migrations with DatabaseMigrator or #sql() macro |
| CloudKit Sync | Setting up CloudKit private database sync, sharing, or sync delegates |
| Dependencies | Injecting database/sync engine via @Dependency, bootstrap patterns, or TCA integration |
| Testing | Setting up test databases, seeding data, or writing assertions for SQLite code |
| Advanced | Implementing triggers, full-text search (FTS5), or custom database functions |
| Schema Composition | Using @Selection column groups, single-table inheritance, or database views |
When working with SQLiteData:
@Table macro@FetchAll/@FetchOne property wrappers in views or @Observable models@Dependency(\.defaultDatabase)database.write { } transactionsN+1 query patterns — Loading records one-by-one in a loop (e.g., fetching user then fetching all their posts separately) kills performance. Use joins or batch fetches instead.
Missing migrations on schema changes — Modifying @Table without creating a migration causes crashes at runtime. Always create migrations for schema changes before deploying.
Improper transaction handling — Long-running transactions outside of database.write { } block can cause deadlocks or data loss. Keep write blocks short and focused.
Ignoring CloudKit sync delegates — Setting up CloudKit sync without implementing SyncDelegate means you miss error handling and conflict resolution. Implement all delegate methods for production.
Over-fetching in SwiftUI views — Using @FetchAll without filtering/limiting can load thousands of records, freezing the UI. Use predicates, limits, and sorting to keep in-memory footprint small.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.