원클릭으로
generate-migration
Generate an Alembic database migration for schema changes, with rollback procedure — requires admin approval before applying
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate an Alembic database migration for schema changes, with rollback procedure — requires admin approval before applying
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Generate a sprint retrospective with KPI dashboard and action decision records
Generate a risk register PM block with probability, impact, and mitigation strategies
Generate downloadable Markdown or HTML files (reports, summaries, styled docs)
Conversational skill creator — build, test, and refine skills in chat
Generate a lightweight Architecture Decision Record as a Decision block
Creates a structured note from a homepage chat conversation
| name | generate-migration |
| description | Generate an Alembic database migration for schema changes, with rollback procedure — requires admin approval before applying |
| approval | require |
| model | sonnet |
| tools | ["write_to_note","insert_block","ask_user"] |
| required_approval_role | admin |
Generate a complete, reversible Alembic migration for proposed database schema changes. Always requires admin approval before the migration can be applied, as schema changes are irreversible without a rollback procedure.
Use this skill when:
/generate-migration)Example:
User: "Generate a migration to add a 'priority' column (integer) to the issues table"
AI generates:
- Alembic migration file with upgrade() and downgrade()
- upgrade(): ALTER TABLE issues ADD COLUMN priority INTEGER DEFAULT 0
- downgrade(): ALTER TABLE issues DROP COLUMN priority
- Index if cardinality warrants it
Gather Schema Context
ask_user to clarify ambiguous column types, constraints, or nullabilityDesign Migration
upgrade(): forward schema changes using op.add_column, op.create_table, etc.downgrade(): exact reversal of every change in upgrade()Validate Safety
server_default (zero-downtime rule)DROP TABLE or DROP COLUMN in upgrade without explicit user confirmationask_user confirmation before generatingInsert to Note
insert_block to add the migration code block with file path headerwrite_to_note to add rollback instructions and deployment stepspending_approval — admin must review before alembic upgrade headReturn Approval-Required Status
status: pending_approval with required_approval_role: admin{
"status": "pending_approval",
"skill": "generate-migration",
"required_approval_role": "admin",
"note_id": "note-uuid",
"blocks_inserted": 1,
"summary": "Migration to add priority column to issues — requires admin approval before alembic upgrade head",
"migration_file": "backend/alembic/versions/038_add_priority_to_issues.py",
"rollback_command": "alembic downgrade -1",
"deployment_checklist": [
"Backup database before applying",
"Test on staging first: alembic upgrade head",
"Verify rollback: alembic downgrade -1 on staging",
"Apply to production during maintenance window"
]
}
Input: "Add a priority integer column to issues table with default 0"
Output: Inserts into note:
## Generated Migration: 038_add_priority_to_issues
<!-- File: backend/alembic/versions/038_add_priority_to_issues.py -->
<!-- REQUIRES ADMIN APPROVAL BEFORE APPLYING -->
\`\`\`python
"""Add priority column to issues.
Revision ID: 038_add_priority_to_issues
Revises: 037_previous_migration
Create Date: 2026-02-19
"""
from alembic import op
import sqlalchemy as sa
revision = "038_add_priority_to_issues"
down_revision = "037_previous_migration"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column(
"issues",
sa.Column("priority", sa.Integer(), server_default="0", nullable=False),
)
op.create_index("ix_issues_priority", "issues", ["priority"])
def downgrade() -> None:
op.drop_index("ix_issues_priority", table_name="issues")
op.drop_column("issues", "priority")
\`\`\`
### Deployment Checklist
1. Backup: `pg_dump $DATABASE_URL > backup_pre_038.sql`
2. Staging: `alembic upgrade head` → verify columns with `\d issues`
3. Rollback test: `alembic downgrade -1` → verify clean
4. Production: Apply during maintenance window
5. Rollback command: `alembic downgrade -1`
Input: "Create a workspace_events table for audit logging"
Output: Generates op.create_table(...) with full column spec, primary key, indexes, and RLS note.
search_note_content: Read schema requirements and existing migration patternsask_user: Clarify column types, constraints, nullability, or confirm destructive operationsinsert_block: Write migration code block to the notewrite_to_note: Add rollback instructions and deployment checklist/generate-migration commandnote_write_lock:{note_id} mutex before writes (C-3)required_approval_role: admin (DD-003, C-7)docs/dev-pattern/07-repository.md