
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 driftpostgres and package:postgres, writing type-safe tables, queries, writes, streams, and migrations, resolving buildrunner or driftdev failures, or validating Dart database code with code generation, analysis, tests, and migration checks.
- Installs
- 467
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/madteacher/mad-agents-skills --skill dart-drift- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads dart-drift automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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:postgresand 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, run
dart 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 add
StreamBuilder, 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.
FAQ
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 driftpostgres and package:postgres, writing type-safe tables, queries, writes, streams, and migrations, resolving buildrunner or driftdev failures, or validating Dart database code with code generation, analysis, tests, and migration checks.
How do I install dart-drift?
Run npx skills add https://github.com/madteacher/mad-agents-skills --skill dart-drift in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/dart-drift/ (personal) or .claude/skills/dart-drift/ (project).
Which AI agents can use dart-drift?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is dart-drift safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains dart-drift?
It is published by madteacher in madteacher/mad-agents-skills. It has 467 recorded installs.
More from madteacher/mad-agents-skills
flutter-animations
madteacher/mad-agents-skills
Add, fix, refactor, debug, test, or explain Flutter animations and motion effects. Use when working with implicit animations such as AnimatedContainer, AnimatedOpacity, AnimatedSwitcher, and TweenAnimationBuilder; explicit animations using AnimationController, Tween, CurvedAnimation, AnimatedWidget, AnimatedBuilder, and built-in transitions; Hero/shared-element route transitions; staggered or sequenced animations; physics-based motion, gestures, springs, flings, scroll physics, curves, performance, accessibility, reduced motion, and animation lifecycle bugs.
flutter-adaptive-ui
madteacher/mad-agents-skills
Build, fix, review, and validate adaptive or responsive Flutter UIs for mobile, tablet, desktop, web, large screens, foldables, and mixed input devices. Use when creating breakpoint-driven layouts, responsive navigation, adaptive dialogs/lists/grids, keyboard/mouse/touch behavior, window-size decisions with MediaQuery or LayoutBuilder, or Capability and Policy patterns for platform-specific behavior.
flutter-architecture
madteacher/mad-agents-skills
Design, refactor, review, or implement Flutter app architecture using MVVM, layered UI/Data/optional Domain boundaries, feature-first or layer-first project structure, repositories, services, dependency injection, Result and Command patterns, offline-first or optimistic UI flows. Use when asked to add a Flutter feature, audit layer dependencies, fix cross-feature imports, migrate to feature-first, choose architecture for a Flutter project, or create scalable maintainable Flutter code organization.
flutter-testing
madteacher/mad-agents-skills
Write, fix, review, debug, and validate Flutter tests for apps, packages, and plugins. Use when adding unit tests, widget tests, integration tests, MethodChannel or plugin mocks, Mockito or mocktail test doubles, golden or accessibility checks, CI test commands, test failures, MissingPluginException, pump or pumpAndSettle problems, finder errors, buildrunner mock generation, device integration testing, web integration testing, or flaky Flutter tests.
flutter-networking
madteacher/mad-agents-skills
Implement, fix, debug, review, or refactor Flutter networking code for HTTP/REST APIs, WebSocket realtime flows, authentication and token refresh, request headers, timeouts, retries, JSON parsing, caching, background isolates, repositories, services, and adaptation to existing http, Dio, Retrofit, Chopper, or custom API clients. Use when asked to add network requests, investigate network errors, harden API clients, handle auth, or validate Flutter network behavior.
flutter-drift
madteacher/mad-agents-skills
Implement, fix, review, migrate, test, or debug Drift persistence in Flutter apps using SQLite, driftflutter, type-safe Dart queries, generated tables, StreamBuilder or Riverpod StreamProvider UI, write operations, transactions, schema migrations, web assets, isolate sharing, and local database testing. Use when a Flutter task mentions drift, local database storage, SQLite, reactive database streams, CRUD, schemaVersion, buildrunner, driftdev make-migrations, migration tests, or Flutter-specific database setup across mobile, web, or desktop.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.