plugins/powerups/skills/database-branching/SKILL.md
Use when building any feature that involves database changes (new table, new column, alter column, etc.) — fork the database like a git branch. Only applies to projects using Ghost DB.
npx skillsauth add jackyliang/powerups database-branchingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Treat database forks like git branches. Never make schema changes directly on the production database. Fork it, develop against the fork, merge migrations back when ready, then delete the fork.
This skill only applies to projects using Ghost DB (TimescaleDB Cloud). If the project uses Supabase, local Postgres, or another database service, this skill does not apply.
Any time a feature involves database changes:
Even for "small" changes. A single ALTER TABLE ADD COLUMN still gets a fork. The cost of forking is low (2 minutes). The cost of breaking production is high.
ghost_sql directly)Check for these signals:
mcp__ghost__ tools are available.env or CLAUDE.md references a Ghost database ID (10-char alphanumeric, e.g., r7mf0mo24b)CLAUDE.md mentions Ghost, TimescaleDB, or ghost_listIf none of these are present, this skill does not apply.
Like git checkout -b feature/my-feature, but for the database.
mcp__ghost__ghost_list # Find your source DB ID
mcp__ghost__ghost_fork
id: "{source_db_id}"
name: "{project}-{feature}" # e.g., "sync-hq-auth", "sync-hq-webhooks"
Forking takes 90-120 seconds. Poll with ghost_list every 15-20 seconds until the fork shows as running. Do not give up early.
mcp__ghost__ghost_connect
id: "{fork_id}"
Update .env to point to the fork:
# Comment out production URL
# DATABASE_URL=postgresql://...production...
# Use fork for development
DATABASE_URL=postgresql://...fork...
Before making any schema changes, check if the project uses a migration tool:
| Tool | How to Detect | Migration Command |
|------|--------------|-------------------|
| Alembic (Python) | alembic.ini or alembic/ directory exists | alembic revision --autogenerate -m "description" |
| Prisma (Node.js) | prisma/schema.prisma exists | npx prisma migrate dev --name description |
| Drizzle (Node.js) | drizzle.config.ts exists | npx drizzle-kit generate |
| Django | manage.py exists | python manage.py makemigrations |
| Raw SQL | No migration tool found | Track changes manually in SQL files |
All schema changes must go through the migration tool. Never run raw DDL (CREATE TABLE, ALTER TABLE) directly against the database unless the project has no migration tool. Migrations are how changes get tracked, reviewed, and applied consistently.
This is where you spend most of your time:
models.py, schema.prisma)alembic upgrade head # or equivalent
mcp__ghost__ghost_schema id: "{fork_id}" # Check schema looks right
mcp__ghost__ghost_sql id: "{fork_id}" query: "SELECT ..." # Spot-check data
Iterate freely. If a migration is wrong, you can rollback (alembic downgrade -1), fix it, and re-apply. The fork is disposable.
sqlmodel.sql.sqltypes.AutoString without importing it — always add import sqlmodel to migration files or replace with sa.VARCHAR()ALTER TYPE ... ADD VALUE) require manual SQL in the migration — Alembic can't autogenerate theseWhen the feature is complete and tested:
Merge the git branch (PR, merge to main, etc.)
Switch .env back to production:
DATABASE_URL=postgresql://...production...
Run migrations on production:
alembic upgrade head # or equivalent
Verify production — spot-check the schema:
mcp__ghost__ghost_schema id: "{production_db_id}"
Delete the fork:
mcp__ghost__ghost_delete id: "{fork_id}"
Do not skip the delete. Forks consume resources. Clean up after yourself.
If the feature is cancelled or the approach didn't work:
mcp__ghost__ghost_delete id: "{fork_id}"
.env to productionWhen the app is deployed (e.g., Render, Railway, Fly.io):
DATABASE_URL environment variable pointing to productionalembic upgrade headThis skill complements:
Ownership boundaries:
| Action | Tool | Key Parameter |
|--------|------|---------------|
| List DBs | mcp__ghost__ghost_list | — |
| Fork | mcp__ghost__ghost_fork | id (source DB) |
| Connect | mcp__ghost__ghost_connect | id (fork) |
| Query | mcp__ghost__ghost_sql | id, query |
| Schema | mcp__ghost__ghost_schema | id |
| Delete | mcp__ghost__ghost_delete | id (fork) |
development
Run PM-grade discovery before building any user-facing feature — problem statement, jobs-to-be-done, core flow, decision matrix. Output is a short brief with open decisions surfaced as explicit questions. Invoked by plan-driven-development and give-me-five.
testing
Ultra-short replies — answer a quick question, draft a short text/social post, or draft a short email. No preamble, no offers to elaborate, drafts under 480 characters (280 for X), never em-dashes.
development
Reconcile shipped code with the plan in both directions — additive drift (unplanned work that landed) and subtractive drift (dead files, stale TODOs, completed deferred items). Run as part of PDD's post-completion audit, before /simplify.
data-ai
Generate 5 meaningfully distinct UI/UX variants of the same screen in parallel (one subagent each), reachable via ?style=1...5, so the user can compare and pick. Calling again on a chosen style refines within that direction.