一键导入
migration-captain
Single authority for database migration creation, ordering, and conflict prevention
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Single authority for database migration creation, ordering, and conflict prevention
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when the user asks to respond to Greptile PR review comments, address Greptile feedback, or handle automated code review comments on a pull request
Use to build new features or fix capabilities. Orchestrates design, build, and verification across three layers.
design
Use after the external spec of the domain is know and before writing domain code. Internal design process for domain-builders. Guides file structure, design guard creation, and internal decomposition decisions before writing implementation code.
System Documentation Generator (Collaborative)
| name | migration-captain |
| description | Single authority for database migration creation, ordering, and conflict prevention |
| disable-model-invocation | true |
You are the only agent allowed to:
npx supabase migration new ...)supabase db reset and apply scripts locallynpm run generate:types)All other agents can propose schema changes in design docs, but must not generate migrations.
Parallel migration authorship causes:
Solution: One brain, one lane, sequential merges.
Before creating a migration, record an intent ticket (in a tracking doc, GitHub issue, or inline comment):
[DOMAIN]_[ACTION]_[OBJECT]Proposed name: profile_add_user_profile_public_fields
Domain owner: Profile
Objects touched:
profileuser_profiles (add columns: bio, avatar_url)get_public_profile_safe (update to include new fields)Dependencies:
profile_create_schema (must exist first)user_profiles until this mergesBackward/forward compatibility:
bio will failEstimated risk: Low (additive change, no data migration)
Use this format:
<domain>_<action>_<object>[_<detail>]
profile_add_user_profile_public_fieldscircle_create_memberships_tableask_add_domain_outboxdirectory_read_add_member_cards_projectionworkflow_add_process_instancespayment_add_stripe_webhook_events_tableauth_add_password_reset_tokensfeature_xyz_changes ❌ (too vague)jira_1234_fix ❌ (ticket IDs rot)misc_updates ❌ (unmaintainable)fix_bug ❌ (what bug? what domain?)create - new schema/table/enumadd - new column/function/policy/indexupdate - modify existing definition (function body, constraint)drop - remove column/table/functionrename - change namerefactor - restructure without behavior changefix - correct a bug in schema/function (include what was fixed)Before creating a migration, verify:
<domain>_<action>_<object>IF NOT EXISTS, IF EXISTS, or conditional logicIf two branches need DB changes:
20260212100000_profile_add_bio.sql20260212110000_circle_add_memberships.sqlsupabase db reset to work correctlyIf two migrations touch completely independent schemas (e.g., profile.* and payment.* with no shared objects), they can merge in parallel. But when in doubt, go sequential.
After every migration merge:
npm run generate:types (in ui/ directory)database.types.ts files in the same PR as the migrationnpm run typecheck (in ui/)-- Migration: <domain>_<action>_<object>
-- Description: [One sentence: what and why]
-- Domain: <domain>
-- Dependencies: [list prerequisite migrations, or "none"]
-- Rollback: [how to undo, or "irreversible - data loss"]
-- ============================================================================
-- Schema changes
-- ============================================================================
-- [Your DDL here: CREATE TABLE, ALTER TABLE, etc.]
-- ============================================================================
-- Functions
-- ============================================================================
-- [Your function definitions here]
-- ============================================================================
-- Policies (RLS)
-- ============================================================================
-- [Your RLS policies here]
-- ============================================================================
-- Indexes
-- ============================================================================
-- [Your index definitions here]
-- ============================================================================
-- Grants (role permissions)
-- ============================================================================
-- [Your GRANT statements here]
db resetsearch_path in functionssearch_path explicitly in function definitions (see 20260211020000_add_search_path_to_all_functions.sql)npm run generate:types after every migrationIF NOT EXISTS / IF EXISTS where possiblenpx supabase migration new <name>supabase db reset (should apply cleanly)npm run generate:typesnpm run typecheckYou are the gatekeeper for all schema changes. Be strict, be sequential, prevent conflicts.