This skill may not reflect the latest upstream change
Next.js Releases update on 2026-11-09 may affect this skill Last checked Nov 25, 2026.
dart-drift
Build, fix, audit, and migrate Drift persistence in Dart CLI, server-side, and non-Flutter desktop apps. Use when adding SQLite with package:drift/native.dart, configuring PostgreSQL with drift_postgres and package:postgres, writing type-safe tables, queries, writes, streams, and migrations, resolving build_runner or drift_dev failures, or validating Dart database code with code generation, analysis, tests, and migration checks.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install flutter-dart-skills-dart-driftManual setup by platform
Claude Code
~/.claude/skills/flutter-dart-skills-dart-drift/SKILL.md
Signing
SignedSLSA L2- Signed by
- skills-hub.ai distributor
- Method
- Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
- Key
- skills-hub-ed25519-2026-11
- Signed
Instructions
Dart Drift
You are a Dart persistence engineer for non-Flutter apps using Drift.
Principle 0
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.
Workflow
- Inspect the project before changing code:
pubspec.yaml, existing database
classes,build.yaml, generated parts, tests, migration files, and whether
the app targets SQLite, PostgreSQL, or both. - Choose the backend path:
- For Dart CLI, server jobs, or native desktop local storage, use SQLite via
package:drift/native.dart. - For server-side PostgreSQL, use
drift_postgreswithpackage:postgres
and enable the Postgres SQL dialect inbuild.yaml. - For Flutter UI integration, stop and use the
flutter-driftskill instead.
- For Dart CLI, server jobs, or native desktop local storage, use SQLite via
- Read only the reference files needed for the requested task.
- Implement the smallest safe change using the APIs and caveats from those
references. - Run mandatory validation. If validation cannot run, report the blocker and
the concrete risk instead of presenting the change as verified.
Resource Routing
| 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 |
Mandatory Validation
- After dependency changes, run
dart pub get. - After changing Drift tables, database classes, DAOs, SQL files, or generated
parts, rundart run build_runner buildanddart analyze. - After changing behavior, run the narrowest relevant
dart testtarget. If no
tests exist, add or describe a focused smoke test for the database operation. - After migration changes, run
dart run drift_dev make-migrationsand the
generated migration tests from the configuredtest_dir. - After editing this skill, references, or reusable examples, run
dart-drift/scripts/verify-examples.sh.
Constraints
- Keep this skill scoped to Dart CLI, server-side, and non-Flutter desktop apps.
Do not addStreamBuilder, Riverpod, Provider,drift_flutter, or
Flutter-specific storage patterns here. - Prefer
dart pub add ...for new dependencies. Only hardcode versions when
matching an existing repository policy. - Do not use deprecated PostgreSQL examples based on
HostEndpoint,
PgEndpoint,postgres_pool.dart,postgresUuid(),postgresJson(),
PostgresTypes, orgen_random_uuid. - For PostgreSQL, avoid SQLite-only helpers such as
currentDateAndTimeand
mostdateTime()convenience APIs. UsePgTypes.date,
PgTypes.timestampWithTimezone,PgTypes.timestampNoTimezone, andnow(). - Do not replace code generation or migration validation with manual reasoning
unless the user explicitly waives the risk.
Fallback
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.
Security
Reviews (0)
Related skills
Browse all →More from Flutter/Dart Skills
View source →More Build skills
Browse category →Frequently asked questions about dart-drift
What does the dart-drift skill do?
Build, fix, audit, and migrate Drift persistence in Dart CLI, server-side, and non-Flutter desktop apps. Use when adding SQLite with package:drift/native.dart, configuring PostgreSQL with drift_postgres and package:postgres, writing type-safe tables, queries, writes, streams, and migrations, resolving build_runner or drift_dev failures, or validating Dart database code with code generation, analysis, tests, and migration checks. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the dart-drift skill?
Run `npx @skills-hub-ai/cli install flutter-dart-skills-dart-drift` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/flutter-dart-skills-dart-drift/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does dart-drift work with?
dart-drift runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the dart-drift skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use dart-drift after installing it?
In Claude Code, type `/flutter-dart-skills-dart-drift` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the dart-drift skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.