Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
madteacher avatar

Dart Drift

  • 426 installs
  • 105 repo stars
  • Updated May 1, 2026
  • madteacher/mad-agents-skills

dart-drift is an agent skill that models local SQLite schemas, type-safe Drift queries, and migrations in Dart apps for developers building offline-first CLI, server, or desktop persistence without Flutter UI assumptions

About

dart-drift is a madteacher/mad-agents-skills agent skill (version 2.0) for Drift persistence in Dart CLI, server-side, and non-Flutter desktop apps—not Flutter UI projects, which should use flutter-drift instead. It routes tasks across seven reference files for setup, tables, queries, writes, streams, migrations, and PostgreSQL configuration with drift_postgres and package:postgres. Mandatory validation runs dart pub get, dart run build_runner build, dart analyze, dart test, and dart run drift_dev make-migrations after schema changes. The skill warns against deprecated PostgreSQL APIs and SQLite-only date helpers on Postgres backends. Developers reach for dart-drift when adding type-safe SQLite to a Dart CLI tool, fixing build_runner codegen failures, or writing guided schema migrations with generated migration tests.

  • Drift table and DAO design
  • Type-safe SQL queries
  • Migration versioning
  • Flutter repository patterns
  • Offline sync considerations

Dart Drift by the numbers

  • 426 all-time installs (skills.sh)
  • +6 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #329 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/madteacher/mad-agents-skills --skill dart-drift

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs426
repo stars105
Last updatedMay 1, 2026
Repositorymadteacher/mad-agents-skills

How do you add Drift SQLite to Dart apps?

Model local SQLite schemas, write type-safe Drift queries, and manage migrations in Flutter or Dart apps needing offline-first persistence.

Who is it for?

Dart developers adding Drift persistence to CLI, server-side, or desktop Dart apps targeting SQLite or PostgreSQL without Flutter widgets.

Skip if: Flutter mobile or web UI apps needing StreamBuilder or Riverpod patterns—use the flutter-drift skill instead of dart-drift.

When should I use this skill?

Adding Drift to a Dart project, writing migrations, configuring drift_postgres, or debugging build_runner and drift_dev codegen failures.

What you get

Drift database classes, generated .g.dart parts, migration files, and analyzed type-safe query and write APIs.

  • Drift database class
  • generated .g.dart parts
  • migration test files

By the numbers

  • Skill metadata version 2.0 from madteacher/mad-agents-skills
  • Bundles 7 reference files for setup through PostgreSQL configuration
  • Mandates 4 validation commands: pub get, build_runner build, analyze, and drift_dev make-migrations

Files

SKILL.mdMarkdownGitHub ↗

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

1. 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. 2. 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_postgres with package:postgres

and enable the Postgres SQL dialect in build.yaml.

  • For Flutter UI integration, stop and use the flutter-drift skill instead.

3. Read only the reference files needed for the requested task. 4. Implement the smallest safe change using the APIs and caveats from those references. 5. Run mandatory validation. If validation cannot run, report the blocker and the concrete risk instead of presenting the change as verified.

Resource Routing

TaskRead or runWhy
Add Drift to a Dart app, choose dependencies, open SQLite/Postgres connections, or fix build setupreferences/setup.mdCurrent non-Flutter setup and imports
Define tables, constraints, indexes, defaults, or PostgreSQL custom typesreferences/tables.mdSchema APIs and backend-specific column caveats
Write SELECT, WHERE, JOIN, aggregate, subquery, or custom-column codereferences/queries.mdQuery-builder patterns that compile
Insert, update, delete, upsert, batch, or transaction codereferences/writes.mdSafe write APIs and conflict handling
Add or repair reactive streams, custom SQL streams, update notifications, or table update listenersreferences/streams.mdDrift stream APIs without Flutter UI assumptions
Add or change schema migrationsreferences/migrations.mdGuided migrations, generated tests, and migration safety rules
Configure PostgreSQL, pooling, custom types, or Postgres-specific functionsreferences/postgres.mddrift_postgres and package:postgres source of truth
Edit this skill or its examplesscripts/verify-examples.shDeterministic 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 build and dart analyze.

  • After changing behavior, run the narrowest relevant dart test target. If no

tests exist, add or describe a focused smoke test for the database operation.

  • After migration changes, run dart run drift_dev make-migrations and the

generated migration tests from the configured test_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, or gen_random_uuid.

  • For PostgreSQL, avoid SQLite-only helpers such as currentDateAndTime and

most dateTime() convenience APIs. Use PgTypes.date, PgTypes.timestampWithTimezone, PgTypes.timestampNoTimezone, and now().

  • 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.

Related skills

How it compares

Use dart-drift for non-Flutter Dart persistence with codegen; use flutter-drift when the app needs Flutter widget integration patterns.

FAQ

Should Flutter apps use dart-drift or flutter-drift?

dart-drift is scoped to Dart CLI, server-side, and non-Flutter desktop apps. Flutter UI projects with StreamBuilder, Riverpod, or drift_flutter patterns should use the flutter-drift skill instead of dart-drift.

What validation does dart-drift require after schema changes?

dart-drift mandates dart pub get, dart run build_runner build, dart analyze, targeted dart test runs, and dart run drift_dev make-migrations with generated migration tests after any table, DAO, or migration edit.

Mobile Developmentfrontendbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.