← ClaudeAtlas

supabase-migrationlisted

The only allowed workflow for writing AND applying a Supabase migration in any studio project. Activates on requests to add tables, alter columns, add indexes, add or modify RLS policies, add constraints, RPCs, or any other schema change — and on "push the migration", "apply the schema change". Do NOT use for seeding data, running read queries, or explaining schema. Applying SQL via MCP, the dashboard SQL editor, or a hand-named migration file is a failed task.
hashorva/purrfect-harness · ★ 0 · API & Backend · score 60
Install: claude install-skill hashorva/purrfect-harness
# Supabase Migration Skill (v2, studio-wide) ## Step 1 — Read before writing - Read the project's `AGENTS.md` **Database rules** section — it defines this project's APPLY PATH (see Step 5) and any schema-specific invariants. - Read the project's `docs/DATABASE.md` and/or `docs/ARCHITECTURE.md` if present. - Run `supabase migration list` to confirm local/remote alignment. Diverged → STOP and escalate; do not "fix" by pushing. - Check the 2–3 most recent files in `supabase/migrations/` to match style. ## Step 2 — Create the file (CLI names it — never hand-name) ```bash supabase migration new <short_snake_case_description> ``` The CLI generates the timestamped filename. Hand-creating or renaming migration files breaks ordering guarantees and is a failed task. Write the COMPLETE SQL into the generated file. ## Step 3 — Migration file header ```sql -- ============================================================ -- MIGRATION: <short description> -- Date: YYYY-MM-DD -- What / Why / Affected tables / Rollback: -- ============================================================ ``` ## Step 4 — Checklist before applying (universal core) - [ ] New table's access model is explicit BEFORE writing RLS/grants: user-RLS, service-role-only, or schema-level revoked - [ ] Migration is additive (or has a rollback plan if destructive) - [ ] Any new table has RLS enabled - [ ] User-owned tables: policies cover all operations with both USING and WITH CHECK; indexes support RLS/