Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add dirtybits/agent-skills --skill guarded-db-migrationgit clone --depth 1 https://github.com/dirtybits/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/dirtybits/agent-skills/guarded-db-migration)<a href="https://agentmods.dev/skills/dirtybits/agent-skills/guarded-db-migration"><img src="https://agentmods.dev/badge/skills/dirtybits/agent-skills/guarded-db-migration/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/dirtybits/agent-skills/guarded-db-migration"><img src="https://agentmods.dev/badge/skills/dirtybits/agent-skills/guarded-db-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00101 | $0.01531 |
| Opus 5.5 | $0.00040 | $0.00612 |
| Sonnet 5.5 | $0.00020 | $0.00306 |
| Haiku 4.5 | $0.00010 | $0.00153 |
Grade A, and why
guarded-db-migration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 87 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Guarded DB Migration
Why this skill exists
The two classic agent-caused database incidents are: (1) risky DDL placed in a request-time schema initializer, so the first failure takes down every route that touches the table; and (2) a migration script pointed at the wrong database — a legacy project, a teammate's branch, production instead of staging — because the connection string was ambient. Both are fully preventable with three habits: the additive/guarded split, the expected-host guard, and a rehearsal on a disposable copy of production.
1. The additive/guarded split (decide where the DDL lives)
Runtime schema initializers (code that runs CREATE TABLE IF NOT EXISTS on boot or first request) may contain only additive, race-tolerant, cannot-fail-on-live-data statements:
CREATE TABLE IF NOT EXISTS,CREATE INDEX IF NOT EXISTS(non-unique),ADD COLUMN IF NOT EXISTS- Idempotent backfills that tolerate concurrent execution
Everything that can fail on live data goes in a guarded one-shot script — never in the initializer:
CREATE UNIQUE INDEX(fails on existing duplicates)DROPanything,ALTER ... DROP CONSTRAINT, primary-key swaps- Backfills that assume exclusive access or specific data shape
- Anything requiring a duplicate scan or data repair first
Rule of thumb: if the statement could throw because of the data (not just the schema), it is one-shot-script material.
2. The guarded one-shot script pattern
Write the migration as a standalone script (e.g. scripts/<name>-migration.ts) with two subcommands:
<script> preflight # read-only: reports duplicates/violations/row counts; exit nonzero if migrate would fail
<script> migrate # performs the DDL, in order, inside the smallest safe transaction scope
Non-negotiable guards in migrate:
- Expected-host guard. The script takes
EXPECTED_DATABASE_HOST(or equivalent) and refuses to run unless it matches the host parsed fromDATABASE_URL. This converts "wrong ambient connection string" from an incident into an error message. Never default it; never allow a bypass flag. - Preflight-first.
migratere-runs the preflight checks internally before DDL — the world may have changed since you ranpreflightmanually. - Idempotence or a clear refusal. Running
migratetwice must either be a no-op or fail loudly before touching anything. - Print everything. Target host, database, each statement as it runs, and a post-run verification summary. The transcript is the evidence.
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 87 lines · 101 tokens per session scan A 298197ca10a4
guarded-db-migration is a skill published in the GitHub repository dirtybits/agent-skills (2 stars, last pushed 2mo ago), licensed MIT. It adds 101 tokens to every session and 1,531 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
guarded-db-migration compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| guarded-db-migrationdirtybits/agent-skills | Skill | 2 | 2mo ago | MIT | A | 101 | Claude Code, Codex |
| postgresdbericrisco/rsc-harness | Skill | 682 | 5d ago | MIT | A | 91 | Claude Code, Codex |
| neonericrisco/rsc-harness | Skill | 682 | 5d ago | MIT | A | 93 | Claude Code, Codex |
| Drizzle ORM TestingPramodDutta/qaskills | Skill | 252 | 27d ago | MIT | A | 36 | Claude Code, Codex |
| srtd-clit1mmen/srtd | Skill | 105 | 26d ago | MIT | A | 75 | Claude Code |
| banco-de-dados-opsricneves-ai/flowgrammers-skills | Skill | 118 | 2mo ago | MIT | A | 55 | Claude Code, Codex |
| supabasemartineserios/thebrana | Skill | 3 | 9d ago | MIT | A | 58 | Claude Code |