Skip to content

Commit 797c783

Browse files
committed
docs: update migration-scripts skill
1 parent 0d9aaff commit 797c783

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

  • .agents/skills/migration-scripts

.agents/skills/migration-scripts/SKILL.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
name: migration-scripts
3-
description: Use when writing or reviewing database/config migration scripts. Enforces that migrations are frozen snapshots with no external imports.
3+
description: Use when writing or reviewing database/config migration scripts or migration registries. Enforces frozen-snapshot migrations, safe registration, and lean import boundaries.
44
metadata:
55
author: read-frog
6-
version: "1.0.0"
6+
version: "1.1.0"
77
---
88

99
# Migration Scripts
@@ -17,10 +17,28 @@ Migration scripts must NEVER import or reference:
1717

1818
**Why:** The codebase evolves. A migration written today references code that may change tomorrow. When that constant changes, the migration silently breaks — it now migrates to the *new* shape, not the shape that existed when the migration was written.
1919

20+
## Rule: Migration Registries Must Validate the Chain
21+
22+
In this repo, config migration registries should auto-discover migration files from `src/utils/config/migration-scripts/v*-to-v*.ts` (for example via `import.meta.glob`), and the registry must:
23+
- Parse both `fromVersion` and `toVersion` from the filename
24+
- Reject invalid steps like `v001-to-v003`
25+
- Reject duplicate target versions
26+
- Reject discontinuous chains
27+
28+
Do not silently map only the target version and assume filenames are correct.
29+
30+
## Rule: Keep Migration Imports Off Hot Paths
31+
32+
Do not let generic config read helpers or content-script paths import migration registries unless they really perform migration.
33+
34+
Prefer to isolate migration-aware reads/writes into dedicated modules for import/sync/restore flows, so normal runtime paths do not bundle all migration scripts unnecessarily.
35+
2036
## Checklist
2137

2238
- [ ] All values are hardcoded inline (no imports from `src/`)
2339
- [ ] Input and output typed as `any`
2440
- [ ] No calls to factory functions or helpers
2541
- [ ] Default values are literal objects, not references to constants
2642
- [ ] Migration is idempotent (safe to re-run)
43+
- [ ] Auto-discovered registries validate `from -> to` continuity and duplicate targets
44+
- [ ] Migration-aware storage logic is isolated from generic read paths

0 commit comments

Comments
 (0)