agentleFS
Konadu-Akwasi-AkuokoKonadu-Akwasi-Akuoko/katto/.claude/skills/add-db-migration/SKILL.md

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.

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
  1. Very specific:

    Repository layer: Add/adjust the query functions in src-tauri/src/db/<aggregate>.rs (functions take &Connection, return typed rows).

    line 15
  2. Distinctive:

    Bindings ripple: If row types cross IPC, follow the add-tauri-command skill from step 5 (regenerate specta bindings, update wrappers).

    line 17
  3. Very specific:

    No score/rank/grade columns on ideas — AI suggests, the human decides.

    line 23

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add a DB migration

Migrations are numbered, embedded, and forward-only. Shipped migrations are immutable.

Checklist (todo per item)

  1. New migration, never an edit. Append the next M::up(...) to the migrations list in src-tauri/src/db/migrations.rs. Never modify an existing entry — even a typo ships as a new migration.
  2. Column additions are a plain ALTER. ALTER TABLE <t> ADD COLUMN <c> …; in the .sql file — no presence guard. rusqlite_migration tracks user_version and applies each entry exactly once, so a guard protects against nothing. It is also not expressible: PRAGMA table_info returns rows and plain SQLite cannot branch on them, so a guard would force M::up_with_hook and Rust-side logic for no gain. Follow 002_last_touched.sql / 003_priority.sql. (hyper-frames' ensureColumns is the right pattern there — it has no migration ladder, so nothing else guarantees once-only. Do not port it here.)
  3. Validate test. The mandatory migrations test (migrations_apply_on_fresh_memory_db) must still pass — it runs the full ladder on Connection::open_in_memory().
  4. Repository layer. Add/adjust the query functions in src-tauri/src/db/<aggregate>.rs (functions take &Connection, return typed rows). No SQL anywhere else.
  5. Tests. New/changed repository functions get in-memory DB tests via the shared test_db() helper (all migrations applied, production pragmas minus WAL).
  6. Bindings ripple. If row types cross IPC, follow the add-tauri-command skill from step 5 (regenerate specta bindings, update wrappers).
  7. Gate. just check.

Hard rules

  • ideas and raw_signal keep column parity with hyper-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.
  • events is append-only: no UPDATE or DELETE paths on it (pruning by age is the one exception and lives in a single housekeeping function).

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.