All loops
Claude CodeHard 16 min· claude-opus-4
Schema diff → migrations bot
Claude Code reads schema.prisma diffs, writes safe SQL with rollback notes.
NOT DEPLOYEDNOT DEPLOYED
0140ms
Trigger
cron(0 7 * * *) fired · every day · 07:00
02800ms
Agent
claude-opus-4 · in 900 tok · out 230 tok
03190ms
Tools
postgres-mcp/github:issues.createComment → 200 OK · 220ms
0430ms
Verify
schema check · pydantic v2 passed
0560ms
Output
changelog updated · v1.4.2
0620ms
Notify
audit log written · runbook link attached
SUCCESS
0%
0 runs
P50
0ms
median
P95
0ms
tail
AVG COST
—
per run
LAST OK
never
—
LAST FAIL
never
none
Latency · last 30 runs0 samples
no runs yet
Latest output · what your users see
Openacme/api #2120
fix: retry 429s from Anthropic with jitter
9 files+280-10
- ✓ Ran full test suite → 218 passed, 0 failed (12.3s)
- ✓ Coverage delta: +0.4% on `src/lib/*`
- ✓ No breaking changes detected in public API
// press Test to run once · Watch live to keep streaming · Deploy to make it real
The problem
Auto-generated migrations are unsafe on prod tables: renames become drop+add, large tables block on indexes.
The outcome
Every schema PR has a `migrations/NNNN_…sql`, a `down.sql`, and a comment listing every destructive op with a Yes/No recommendation.
Ingredients & skills
Secrets
- ANTHROPIC_API_KEY
- GITHUB_TOKEN
- DATABASE_URL
Providers
- Anthropic
- GitHub
- Postgres
MCP servers
- postgres-mcp
- github-mcp
#claude code#sql#prisma
How it works
When `schema.prisma` changes, Claude Code generates a forward migration, a rollback, and a destructive-change report posted in the PR.
Step 1
1 — Detect schema change
Only run when `schema.prisma` is in the diff. Cheap path otherwise.
.github/workflows/migrations.yml
on:
pull_request:
paths: ['prisma/schema.prisma']
jobs:
migrate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: claudeloops/action@v1
with: { locker: migrations, agent: .claude/agents/migrate.md, model: claude-opus-4 }Step 2
2 — Safe-migration rules
Every rule is non-negotiable. Make them explicit.
.claude/agents/migrate.md
# Migration generator
Rules:
- Add columns nullable, backfill, then set NOT NULL in a separate migration.
- For renames: add new column, dual-write, backfill, drop old later.
- Indexes on tables > 1M rows: use `CREATE INDEX CONCURRENTLY` and skip the implicit lock.
- Always emit `down.sql`.
- Output a `DESTRUCTIVE_OPS.md` listing every drop or rename with a 'Safe? Y/N' header.One-line deploy
The button above runs the same command with your saved config. This is the raw CLI form.
bash
gh locker apply migrations-botRelated loops
Claude Code
PR review → risk-tagged comment
Claude Code reviews every PR and posts a risk-banded comment with suggested tests.
Claude Code
Test synthesizer for changed files
Claude Code writes Vitest + Playwright tests for every file touched in a PR.
Claude Code
GitHub issue auto-triage
New issue → labeled, assigned, and linked to similar issues in 8 seconds.