agentleFS
developerz-aideveloperz-ai/db-mcp-gateway/.claude/skills/state-migrations/SKILL.md

state-migrations

Skill5 starsChanged 13 days agoMITView on GitHub

Add a state-DB or permissions-store migration and prove it applies. Use for migration, migrations, schema, sqlx, audit_calls, permissions table.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add a new file with the next zero-padded number: migrations/0010_<name>.sql (existing: 0001_sessions.sql … 0009_oauth_refresh_tokens.sql) …

    line 9
  2. Very specific:

    Write the SQL for the target engine: Postgres 16 for migrations/, MySQL 8 for migrations-mysql/.

    line 10
  3. Very specific:

    Update the spec in website/docs/initial-idea/ when the schema change is visible to an operator or an agent — same PR.

    line 13

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

House skill — established by dz-runner setup mode from this repo's own evidence, then owned by its maintainers. Correct it in place; setup never overwrites a skill that exists.

  1. Know which store you are changing: the gateway's own state DB (sessions, audit log, OAuth clients, permissions) is Postgres and lives in migrations/; the MySQL permissions store lives in migrations-mysql/ with its own numbering. Both are embedded by sqlx::migrate! in src/state/mod.rs and applied at boot — a failing migration refuses to start the process.
  2. Add a new file with the next zero-padded number: migrations/0010_<name>.sql (existing: 0001_sessions.sql … 0009_oauth_refresh_tokens.sql) or migrations-mysql/0004_<name>.sql (existing: 0001_permissions.sql … 0003_permissions_resolver_indexes.sql). Never edit a migration that has already been applied — its checksum changes and the migrator refuses to run.
  3. Write the SQL for the target engine: Postgres 16 for migrations/, MySQL 8 for migrations-mysql/; keep the existing table names (audit_calls, permissions, permissions_audit).
  4. Prove it on an empty database: bin/dev reset (removes the volumes), bin/dev up, then bin/test — the integration tests boot the gateway against the dev state DB and apply the pending migrations. fail -> "failed to run state DB migrations" means the statement was rejected; copy it into bin/dev psql state to see the server's own error.
  5. Name indexes the way the existing ones are named (e.g. audit_calls_user_occurred_idx from migration 0003) and add them in their own migration file.
  6. Update the spec in website/docs/initial-idea/ when the schema change is visible to an operator or an agent — same PR.

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.