ecto-migration
Skill4 starsChanged 4 months agoMITView on GitHub
Safe migration playbook with hard gates and HITL for production risk: plan locks/rollback → implement schema-only migration → migrate/rollback/re-migrate → never mix backfill → expand-contract for NOT NULL → suite green. Trigger: migration, ecto.migrate, add column, index concurrently, expand-contract.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- blockscout/blockscouttheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- blockscout/blockscout★ 4.8ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apply-phoenix-controller-conventionsSkill
- ash-frameworkSkill
- benchee-profilingSkill
- broadway-data-pipelinesSkill
- cachex-cachingSkill
- code-qualitySkill
- code-reviewSkill
- deployment-gotchasSkill
- ecto-changeset-patternsSkill
- ecto-essentialsSkill
- ecto-nested-associationsSkill
- elixir-essentialsSkill
- gettext-i18nSkill
- liveview-streamsSkill
- mix-tasks-generatorsSkill
- oban-essentialsSkill
- otp-essentialsSkill
- phoenix-authenticationSkill
- phoenix-authorization-patternsSkill
- phoenix-channels-essentialsSkill
- phoenix-json-apiSkill
- phoenix-liveview-essentialsSkill
- phoenix-pubsub-patternsSkill
- phoenix-uploadsSkill
- property-based-testingSkill
- refactor-codeSkill
- req-http-clientSkill
- respond-to-reviewSkill
- security-essentialsSkill
- swoosh-emailsSkill
- telemetry-essentialsSkill
- testing-essentialsSkill
- typespec-dialyzerSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- Distinctive: line 106
Update schemas/typespecs if columns changed.
- Distinctive: line 114
If gate fails: Update schemas/typespecs, fix formatting, Credo, or test failures.
≈ “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.
Files
Ecto Migration Playbook
HARD-GATE
- A migration plan and rollback story are documented before any migration is written.
- Schema changes and data backfill are never combined in the same migration.
- A test that depends on the new schema/constraint fails before the migration is applied and passes after.
- The
mix ecto.migrate→mix ecto.rollback→mix ecto.migratecycle must succeed. mix format --check-formatted,mix credo --strict, and the fullmix testsuite are green.- HITL approval is obtained for production-impacting locks.
When to use
Any schema change: tables, columns, indexes, constraints.
Atomic skills this playbook loads
| Skill | Path | Role |
ecto-essentials | skills/ecto-essentials/ | Migrations/schemas |
apply-ecto-conventions | skills/apply-ecto-conventions/ | Repo/query conventions |
Flow
flowchart TD
A[Plan locks rollback impact] --> B[HITL if prod risk]
B --> C[Write schema migration]
C --> D[migrate rollback migrate]
D --> E[Suite green]
E --> F[Separate backfill migration if needed]Agent Phases
Phase 1 — Plan
Assess: lock risk, expand-contract need, rollback strategy, index concurrency.
Production authorization: prepare and test the migration and rollback locally within the authorized task. Before executing production-impacting locks or a production expand-contract rollout, confirm authorization for that concrete operation; preserve authorization already given.
HARD GATE — Plan and rollback documented:
- Lock risk and index concurrency are assessed.
- Rollback strategy is documented.
- For production-impacting locks, HITL approval is obtained.
If gate fails: Resolve the plan or rollback defect locally; block production execution until the operation is authorized.
Phase 2 — Implement
- Schema change or data backfill — never both in one migration
- Indexes on FKs; reversible
change/0when possible
HARD GATE — No combined schema and data migrations:
- The migration changes schema or performs a data backfill, not both.
- Indexes are added on foreign keys.
change/0is reversible or separateup/downfunctions are provided.
If gate fails: Split the migration into a schema migration and a separate backfill migration.
Phase 3 — Migrate cycle
mix ecto.migrate
mix ecto.rollback
mix ecto.migrateHARD GATE — Migrate-rollback-migrate cycle green:
mix ecto.migrate→mix ecto.rollback→mix ecto.migratesucceeds.
If gate fails: Fix the migration reversibility before proceeding.
Phase 4 — Verify
mix testUpdate schemas/typespecs if columns changed.
HARD GATE — Format Credo and full suite green:
- A test that depends on the new schema/constraint failed before the migration and passes after.
mix test,mix format --check-formatted, andmix credo --strictpass.- Schemas and typespecs are updated if columns changed.
If gate fails: Update schemas/typespecs, fix formatting, Credo, or test failures.
Verification checklist
- Plan + rollback noted
- No combined schema+backfill
- migrate/rollback/migrate OK
- Tests green
- HITL for high-risk prod steps
Error Recovery
Irreversible migration → stop; write compensating migration; do not force production.
Output Style
## Ecto Migration Report
**Plan:** <lock risk, rollback strategy, HITL status>
**Migration:** `<migration filename>`
**HARD-GATE results:**
- Plan and rollback documented: PASS / FAIL
- No combined schema and data migrations: PASS / FAIL
- Migrate-rollback-migrate cycle green: PASS / FAIL
- Format Credo and full suite green: PASS / FAIL
**Command results:**
- `mix ecto.migrate`: exit 0 / non-zero
- `mix ecto.rollback`: exit 0 / non-zero
- `mix test`: exit 0 / non-zero
**Verdict:** APPROVE / REQUEST_CHANGESDoes 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
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.

