Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

writing-migrations

Skill by marmelab

Generates Supabase SQL migrations at deploy time from a session branch diff. It is meant for a developer agent dispatched by an orchestrator to produce the schema counterpart of app changes.

  • Score 78
  • 1.5k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install writing-migrations

Built from the published package, never by AI.

git clone --depth 1 https://github.com/marmelab/atomic-crm /tmp/atomic-crm && mkdir -p ~/.claude/skills && cp -r /tmp/atomic-crm/.claude/skills/writing-migrations ~/.claude/skills/writing-migrations

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install writing-migrations in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill turns the code changes in a session branch into the minimal SQL migration that makes the Supabase schema match what the app expects. It computes the net diff from the session-base to session branch range, picks out schema-relevant changes such as entity types, fake-data generators and dataProvider resource registrations, and ignores CSS, layout, copy and tests.

The skill regenerates a single net migration on each run, replacing any migration the same session created earlier that has not been deployed. It writes idempotent SQL with IF NOT EXISTS guards, RLS for new tables, and grants for new objects. It also recreates views with CREATE OR REPLACE and places new columns last. It is written for the deploy-time migration round of a session, not for ordinary feature tickets.

Written from the project's SKILL.md and checked against it.

What it can do

  • Net session diffComputes the full session change from the session-base to session two-dot range.
  • Schema-relevant filterKeeps only changes that imply a database schema change and skips CSS, layout, copy and tests.
  • Single net migrationReplaces earlier unpushed migrations from the same session with one migration covering the whole net change.
  • Idempotent SQLWrites statements guarded with IF NOT EXISTS or IF EXISTS, with correct column types and foreign keys.
  • RLS and grantsEnables RLS with policies on new tables and adds GRANTs for new tables, views and sequences.
  • Safe view recreationRecreates affected views with CREATE OR REPLACE and appends new columns at the end of the select list.

What you need

  • A Supabase project with supabase/migrations and supabase/schemas directories
  • A git repository with session branches and a session-base anchor
  • Git worktree access for the session branch

Try asking

  • Generate the deploy-time Supabase migration from this session's branch diff.
  • Check whether this session's diff needs any schema migration or report no migration.
  • Recreate the companies_summary view with a new importance column at the end.

Good to know

  • Only for the deploy-time migration round, dispatched by the orchestrator, not ad hoc feature work.
  • Does not edit TS, TSX or CSS files; it only writes SQL under supabase/migrations/.
  • Once a migration is pushed or promoted it is immutable, so later changes need a new forward migration.
  • Dropping a view with CASCADE is reserved for column removal or rename cases.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: .claude/skills/writing-migrations/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to writing-migrations

All alternatives →
hugging-face-datasetssickn33
94

Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.

AAA Skill 50k
db-repairgarrytan
94

Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.

AAA Skill 34k
alloydb-basicsgoogle
94

Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.

AAA Skill 26k
clickhouse-logs-queriessupabase
94

Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.

AAA Skill 116k
fix-slow-queriespaperclipai
94

Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.

AAA Skill 119k
prisma-8prisma
94

Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.

AAA Skill 48k

Compare with hugging-face-datasets, db-repair or alloydb-basics

writing-migrations: common questions

When should the writing-migrations skill be used?

The source says it is loaded when a developer dispatch asks for the deploy-time migration after a session's app changes have merged to the session branch. Per-ticket feature developers do not write SQL with it.

What happens if the session has no schema changes?

The skill writes no file and reports NO_MIGRATION_NEEDED. The source says an empty migration should not be written.

Why does the skill regenerate one migration instead of adding new ones?

The source says the user does not want to push N migrations per change, so each session carries one migration covering the net change from session-base.

How do I install writing-migrations?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is writing-migrations free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is writing-migrations safe to use?

It scores 78 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to writing-migrations?

Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.

writing-migrations Install

Add to stack

Loading.