smithery.ai

grdb

Use when writing raw SQL with GRDB, complex joins across 4+ tables, window functions, ValueObservation for reactive queries, or dropping down from SQLiteData for performance. Direct SQLite access for iOS/macOS with type-safe queries and migrations.

First seen Mar 23, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,707 B
  • docs SUMMARY.md 260 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 2 installs

SKILL.md

GRDB

Direct SQLite access using GRDB.swift - type-safe Swift wrapper with full SQLite power when you need it.

Quick Reference

Reference Load When
[Getting Started](references/getting-started.md) Setting up DatabaseQueue or DatabasePool
[Queries](references/queries.md) Writing raw SQL, Record types, type-safe queries
[Value Observation](references/value-observation.md) Reactive queries, SwiftUI integration
[Migrations](references/migrations.md) DatabaseMigrator, schema evolution
[Performance](references/performance.md) EXPLAIN QUERY PLAN, indexing, profiling

When to Use GRDB vs SQLiteData

Scenario Use
Type-safe @Table models SQLiteData
CloudKit sync needed SQLiteData
Complex joins (4+ tables) GRDB
Window functions (ROW_NUMBER, RANK) GRDB
Performance-critical raw SQL GRDB
Reactive queries (ValueObservation) GRDB

Core Workflow

  1. Choose DatabaseQueue (single connection) or DatabasePool (concurrent reads)
  2. Define migrations with DatabaseMigrator
  3. Create Record types (Codable, FetchableRecord, PersistableRecord)
  4. Write queries with raw SQL or QueryInterface
  5. Use ValueObservation for reactive updates

Requirements

  • iOS 13+, macOS 10.15+
  • Swift 5.7+
  • GRDB.swift 6.0+

Common Mistakes

  1. Performance assumptions without EXPLAIN PLAN — Assuming your query is fast or slow without checking EXPLAIN QUERY PLAN is guessing. Always profile queries with EXPLAIN before optimizing.
  1. Missing indexes on WHERE clauses — Queries filtering on non-indexed columns scan the entire table. Index any column used in WHERE, JOIN, or ORDER BY clauses for large tables.
  1. Improper migration ordering — Running migrations out of order or skipping intermediate versions breaks schema consistency. Always apply migrations sequentially; never jump versions.
  1. Record conformance shortcuts — Not conforming Record types to PersistableRecord or FetchableRecord correctly leads to silent data loss or deserialization failures. Always implement all required protocols correctly.
  1. ValueObservation without proper cleanup — Forgetting to cancel ValueObservation when views disappear causes memory leaks and stale data subscriptions. Store the cancellable and clean up in deinit.