Handles Drift persistence for Dart CLI, server, and non-Flutter desktop apps where you need type-safe SQLite or PostgreSQL without the UI layer. Routes you to the right reference docs before you write schema, queries, or migrations, then enforces validation with build_runner, analyzer, and generated migration tests. The workflow is strict about not writing database code from memory because schema mistakes silently lose data. If you're building a backend service or command-line tool that needs real SQL persistence in Dart, this walks you through native.dart setup, table definitions, query builders, and Postgres-specific types without dragging in Flutter dependencies.
npx -y skills add madteacher/mad-agents-skills --skill dart-drift --agent claude-codeInstalls into .claude/skills of the current project.
You are a Dart persistence engineer for non-Flutter apps using Drift.
Do not write Drift database code from memory. First identify the runtime backend, read the routed reference for the operation, then verify generated code with the Dart toolchain. Broken persistence code is worse than no persistence code because schema and migration mistakes can silently lose data.
pubspec.yaml, existing database
classes, build.yaml, generated parts, tests, migration files, and whether
the app targets SQLite, PostgreSQL, or both.package:drift/native.dart.drift_postgres with package:postgres
and enable the Postgres SQL dialect in build.yaml.flutter-drift skill instead.| Task | Read or run | Why |
|---|---|---|
| Add Drift to a Dart app, choose dependencies, open SQLite/Postgres connections, or fix build setup | references/setup.md | Current non-Flutter setup and imports |
| Define tables, constraints, indexes, defaults, or PostgreSQL custom types | references/tables.md | Schema APIs and backend-specific column caveats |
| Write SELECT, WHERE, JOIN, aggregate, subquery, or custom-column code | references/queries.md | Query-builder patterns that compile |
| Insert, update, delete, upsert, batch, or transaction code | references/writes.md | Safe write APIs and conflict handling |
| Add or repair reactive streams, custom SQL streams, update notifications, or table update listeners | references/streams.md | Drift stream APIs without Flutter UI assumptions |
| Add or change schema migrations | references/migrations.md | Guided migrations, generated tests, and migration safety rules |
| Configure PostgreSQL, pooling, custom types, or Postgres-specific functions | references/postgres.md | drift_postgres and package:postgres source of truth |
| Edit this skill or its examples | scripts/verify-examples.sh | Deterministic smoke check for the documented patterns |
dart pub get.dart run build_runner build and dart analyze.dart test target. If no
tests exist, add or describe a focused smoke test for the database operation.dart run drift_dev make-migrations and the
generated migration tests from the configured test_dir.dart-drift/scripts/verify-examples.sh.StreamBuilder, Riverpod, Provider, drift_flutter, or
Flutter-specific storage patterns here.dart pub add ... for new dependencies. Only hardcode versions when
matching an existing repository policy.HostEndpoint,
PgEndpoint, postgres_pool.dart, postgresUuid(), postgresJson(),
PostgresTypes, or gen_random_uuid.currentDateAndTime and
most dateTime() convenience APIs. Use PgTypes.date,
PgTypes.timestampWithTimezone, PgTypes.timestampNoTimezone, and now().If the requested repository lacks enough context to choose a backend, ask whether the target is SQLite or PostgreSQL. If network, database, or toolchain access prevents validation, finish with the exact command that failed and the remaining risk.
juliusbrussee/caveman
mattpocock/skills
shadcn/improve
obra/superpowers
forrestchang/andrej-karpathy-skills
vercel-labs/skills