agentleFS
charanjit-singhcharanjit-singh/lovable-skills/skills/migration-playbook/SKILL.md

migration-playbook

Skill10 starsChanged 6 months agoMITView on GitHub

Use when changing Supabase schema, adding columns, backfills, or production migrations that must not break existing apps. Not for client-only UI or seed data in local dev only.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never drop column/table in same release as code still reads it.

    line 14

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Migration playbook

Principles

  1. Backward compatible steps when app is live: add → backfill → switch → remove (later).
  2. Never drop column/table in same release as code still reads it.
  3. One migration per logical change; name clearly: 20240522_add_posts_status.sql.

Safe add column

ALTER TABLE public.posts ADD COLUMN status text DEFAULT 'draft';
-- backfill if needed
UPDATE public.posts SET status = 'draft' WHERE status IS NULL;
-- then NOT NULL if required, in later migration

RLS

  • New tables: enable RLS + policies in same migration.
  • Policy changes: test with two users before deploy.

Breaking changes

If unavoidable:

  1. Ship code that reads both old and new shapes.
  2. Migrate data.
  3. Deploy code using new only.
  4. Drop old in follow-up migration.

Client types

  • Regenerate TypeScript types after migration.
  • Fix compile errors before marking done.

Avoid

  • DROP COLUMN on day one of rename.
  • Destructive migrations without user confirmation in chat.
  • Editing applied migration files in prod — add new file instead.

Checklist

  • Migration SQL idempotent where possible.
  • RLS updated.
  • Types regenerated.
  • Rollback plan stated (even if "restore backup").

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.