agentleFS
jpoehneltjpoehnelt/skills/drizzle-postgres/SKILL.md

drizzle-postgres

Skill23 starsChanged 7 days agoMITView on GitHub

Change, generate, push, and verify PostgreSQL schemas managed with Drizzle ORM, including PostGIS exclusions and schema verification. Use when adding or altering tables, columns, enums, indexes, or foreign keys, or debugging drizzle-kit push or migration CI failures.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Treat the schema package as the single source of truth for tables, enums, constraints, and relations.

    line 8
  2. Very specific:

    When a transition cannot be expressed by drizzle-kit push (such as a column rename or adopting an existing constraint), add an idempotent …

    line 18
  3. Very specific:

    When PostGIS is installed, keep PostGIS system tables excluded via tablesFilter in drizzle.config.

    line 24
  4. Distinctive:

    Never renumber, edit, or delete an applied migration file, even when existing migration numbering has gaps or duplicates.

    line 25
  5. Very specific:

    Keep one scoped connection pool in the database service.

    line 26
  6. Distinctive:

    Check CI migration step summaries first when a remote migration fails.

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Database schema with Drizzle and PostgreSQL

Treat the schema package as the single source of truth for tables, enums, constraints, and relations.

Repo facts (from AGENTS.md): schema package path and entrypoints, build, generate, push, and migrate commands, post-push schema verification script, pre-push script path, secret-injection wrapper and env vars, PostGIS usage, and CI migration job.

Change the schema

  1. Edit or add the domain table file, re-export it from the package's schema entrypoint, and update relations when needed.
  2. Scope every tenant-owned table by its owning tenant identifier and index the columns queries filter on.
  3. Build the schema package first when drizzle.config reads compiled output (dist/), then generate the SQL migration file. Generation does not require a live database.
  4. Apply the change to a local database you own. Require explicit authorization before running migrations against shared or production databases.
  5. When a transition cannot be expressed by drizzle-kit push (such as a column rename or adopting an existing constraint), add an idempotent step to the repo's pre-push script with a TODO naming its removal condition.

Hazards

  • drizzle-kit push can exit 0 after SQL errors. Read its output, and run a post-push schema verification check against the live catalog so any missing table, column, key, constraint, or index fails the migration. Extend that verification through the schema, never by hand-editing expectations.
  • A composite foreign key must reference a unique() constraint rather than a uniqueIndex(). drizzle-kit push creates indexes after foreign keys, so referencing a unique index fails on fresh databases.
  • When PostGIS is installed, keep PostGIS system tables excluded via tablesFilter in drizzle.config. Generated columns and PostGIS column types can re-diff on every push, so a type diff alone does not prove a failure.
  • Never renumber, edit, or delete an applied migration file, even when existing migration numbering has gaps or duplicates.
  • Keep one scoped connection pool in the database service. Keep DATABASE_URL in the secret store, never print or commit it, and redact connection URLs in logs.

Verify

  • Type check the schema package and every app that imports it.
  • Push to a fresh local database and confirm schema verification passes with no missing objects.
  • Inspect the generated SQL migration so it matches the schema change and nothing else.
  • Check CI migration step summaries first when a remote migration fails; verification errors name the exact missing objects.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.