migration-judged-apply
БесплатноБез исполняемых скриптовНе проверенApply a merged migration SQL file to a product app's production database through its own /api/internal/migrations/apply endpoint — deploy gate first…
от cromford-ai★ 29 звёзд на GitHubОб этом скилле
migration-judged-apply
The fleet never holds a database credential. Every schema change is applied by the app itself, from the SQL already baked into its deployed bundle, triggered by a filename over an internal-token-gated endpoint. This skill is the procedure for driving that by hand, and for judging the cases the automation deliberately parks.
Spec: docs/MIGRATION_ENDPOINT_SPEC.html. Automation that already does this:
bin/migration-autopilot.sh (allowlisted files, post-deploy) and
bin/apply-migrations.sh (cron */15, pending-file sweep). Check whether the
autopilot already owns the file before doing anything by hand — see step 0.
Iron laws (these bind you, not just the scripts)
- Never apply before the deploy that carries the code serves. A file only becomes addressable once it is in the running bundle, so the schema can never land ahead of the code that reads it. Verify the serving sha contains the merge commit — do not infer it from "the PR merged a while ago" (TK-64: finance tables sat unapplied for days while deployed code threw on every load).
- Additive only.
ADD COLUMN IF NOT EXISTS, new tables, new named constraints, new indexes, new enum values. Re-running must be a no-op. - Every new table gets
ALTER TABLE … ENABLE ROW LEVEL SECURITYplusREVOKE ALL … FROM anon, authenticatedin the same migration. A wave that creates no table has no RLS step — say so rather than skipping silently. - A classifier-FLAGGED file is never auto-applied. Flagged means a human reads the SQL first. You may apply it by hand after reading it and judging it safe, and you say in the record that you did so and why.
- Verify after apply, against the app's own status ledger — never the apply
response.
{ok:true}is a claim; the ledger listing the filename is proof. - On failure: ONE actionable
ALERTS.logline, then stop. Never retry-loop. Migrations inside a project are order-dependent, so a failure stops the whole sequence, not just the failing file. A refusal is deterministic per checksum — re-POSTing an unchanged file can only re-fire the alert (the 2026-08-06 pb67 alert storm is exactly this). - You never touch a production database directly. No
prisma db push, nopsql, no Supabase SQL editor from this box. The endpoint or nothing.
Wiring (never guessed — read it, per project)
Env lives in /root/harness/env/global.env + /root/harness/env/<project>.env
(chmod 600, never in git; keys documented in env-templates/project.env.example).
Two separate least-privilege secrets:
MIGRATION_TOKEN— thestatus/applyendpoints.<PREFIX>_INTERNAL_API_TOKEN— the/api/internal/versionendpoint only.
App base URLs, as bin/migration-autopilot.sh maps them:
| project | base var | version token var |
|---|---|---|
| project-1 | PROJECT_1_API_BASE |
PROJECT_1_INTERNAL_API_TOKEN |
| project-2 | PROJECT_2_APP_BASE |
PROJECT_2_INTERNAL_API_TOKEN |
| project-3 | PROJECT_3_APP_BASE |
PROJECT_3_INTERNAL_API_TOKEN |
| project-4 | PROJECT_4_API_BASE |
PROJECT_4_INTERNAL_API_TOKEN |
A project not in that table has no wiring. Stop and say so; do not guess a base URL.
P=project-2 # the project
set -a; . /root/harness/env/global.env; . /root/harness/env/$P.env; set +a
BASE="$PROJECT_2_APP_BASE" # from the table above
MIG() { curl -sf -m 60 -H "Authorization: Bearer $MIGRATION_TOKEN" -H 'User-Agent: curl/8' "$@"; }
Procedure
0. Is this already owned by the automation?
( . /root/harness/bin/jobs-client.sh; job_ledger_get migration "$P <file>" ); echo "rc=$?" # rc 0 = row (status printed), 2 = none, 1 = could not ask
cat /root/harness/state/migrations-refused-$P.txt # terminal refusals
tail -30 /root/harness/logs/migrations.log
grep -i migration /root/harness/logs/ALERTS.log | tail -10
A file whose ledgers(kind=migration) row reads applied is done. A file whose
row reads flagged, or that is listed in migrations-refused-*, is parked on
purpose and is waiting for the judgement you are about to make. Never clear that
row or that file to "make it retry" without first establishing why it failed.
1. What does the app say is pending?
MIG "$BASE/api/internal/migrations/status" | jq '{applied: [.applied[]?.filename] | length, pending: [.pending[]? | {filename, statements}]}'
status compares the deployed bundle's scripts/migrations/ against the app's
MigrationApplied ledger. An empty pending list on an app you know has a new
file usually means the file is not in the bundle: Vercel serverless functions do
not include arbitrary repo files, so the app's next.config needs
outputFileTracingIncludes for scripts/migrations/**. That failure mode is
fail-safe (nothing to apply, nothing breaks) and it is a repo fix, not an apply.
project-4 answers a mu
Установить migration-judged-apply в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл migration-judged-apply?
Apply a merged migration SQL file to a product app's production database through its own /api/internal/migrations/apply endpoint — deploy gate first, classifier verdict respected, verified against the app's own ledger, one ALERT and stop on failure. Use when a migration is pending, an apply was refused or flagged, or someone asks to "apply the migration" / "why is this migration stuck".
Как установить скилл migration-judged-apply?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл migration-judged-apply запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic