add-db-migration
Skill2 starsChanged 5 months agoMITView on GitHub
Use when changing the SQLite schema — adding a table, column, or index, or altering how existing data is stored in katto's app database.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- hyper-frames/CLAUDE.mdCLAUDE.md
- add-feature-surfaceSkill
- add-tauri-commandSkill
- emitter-snapshot-changeSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Repository layer: Add/adjust the query functions in src-tauri/src/db/<aggregate>.rs (functions take &Connection, return typed rows).
- Distinctive: line 17
Bindings ripple: If row types cross IPC, follow the add-tauri-command skill from step 5 (regenerate specta bindings, update wrappers).
- Very specific: line 23
No score/rank/grade columns on ideas — AI suggests, the human decides.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Add a DB migration
Migrations are numbered, embedded, and forward-only. Shipped migrations are immutable.
Checklist (todo per item)
- New migration, never an edit. Append the next
M::up(...)to the migrations list insrc-tauri/src/db/migrations.rs. Never modify an existing entry — even a typo ships as a new migration. - Column additions are a plain
ALTER.ALTER TABLE <t> ADD COLUMN <c> …;in the.sqlfile — no presence guard.rusqlite_migrationtracksuser_versionand applies each entry exactly once, so a guard protects against nothing. It is also not expressible:PRAGMA table_inforeturns rows and plain SQLite cannot branch on them, so a guard would forceM::up_with_hookand Rust-side logic for no gain. Follow002_last_touched.sql/003_priority.sql. (hyper-frames'ensureColumnsis the right pattern there — it has no migration ladder, so nothing else guarantees once-only. Do not port it here.) - Validate test. The mandatory migrations test (
migrations_apply_on_fresh_memory_db) must still pass — it runs the full ladder onConnection::open_in_memory(). - Repository layer. Add/adjust the query functions in
src-tauri/src/db/<aggregate>.rs(functions take&Connection, return typed rows). No SQL anywhere else. - Tests. New/changed repository functions get in-memory DB tests via the shared
test_db()helper (all migrations applied, production pragmas minus WAL). - Bindings ripple. If row types cross IPC, follow the add-tauri-command skill from step 5 (regenerate specta bindings, update wrappers).
- Gate.
just check.
Hard rules
ideasandraw_signalkeep column parity withhyper-frames/tools/studio/server/lib/db.ts— external tools (studio-discover, the curation pattern) write to them directly. Renaming their columns is a breaking change to tools we don't own here.- No score/rank/grade columns on
ideas— AI suggests, the human decides. If a change adds a numeric judgment column, it's wrong by design. eventsis append-only: no UPDATE or DELETE paths on it (pruning by age is the one exception and lives in a single housekeeping function).
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
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.

