feat(marketplace): command consolidation + 8 new plugins (v8.1.0 → v9.0.0) [BREAKING]

Phase 1b: Rename all ~94 commands across 12 plugins to /<noun> <action>
sub-command pattern. Git-flow consolidated from 8→5 commands (commit
variants absorbed into --push/--merge/--sync flags). Dispatch files,
name: frontmatter, and cross-reference updates for all plugins.

Phase 2: Design documents for 8 new plugins in docs/designs/.

Phase 3: Scaffold 8 new plugins — saas-api-platform, saas-db-migrate,
saas-react-platform, saas-test-pilot, data-seed, ops-release-manager,
ops-deploy-pipeline, debug-mcp. Each with plugin.json, commands, agents,
skills, README, and claude-md-integration. Marketplace grows from 12→20.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 14:52:11 -05:00
parent 5098422858
commit 2d51df7a42
321 changed files with 13582 additions and 1019 deletions

View File

@@ -0,0 +1,125 @@
---
name: db-migrate generate
description: Generate migration from model diff
agent: migration-planner
---
# /db-migrate generate - Migration Generator
## Skills to Load
- skills/orm-detection.md
- skills/naming-conventions.md
- skills/visual-header.md
## Visual Output
Display header: `DB-MIGRATE - Generate`
## Usage
```
/db-migrate generate <description> [--auto] [--empty]
```
**Arguments:**
- `<description>`: Short description of the change (e.g., "add_orders_table", "add_email_to_users")
- `--auto`: Auto-detect changes from model diff (Alembic/Prisma only)
- `--empty`: Generate empty migration file for manual editing
## Prerequisites
Run `/db-migrate setup` first. Reads `.db-migrate.json` for tool and configuration.
## Process
### 1. Read Configuration
Load `.db-migrate.json` to determine:
- Migration tool (Alembic, Prisma, raw SQL)
- Migration directory path
- Model directory path (for auto-detection)
- Naming convention
### 2. Detect Schema Changes (--auto mode)
**Alembic:**
- Compare current SQLAlchemy models against database schema
- Identify new tables, dropped tables, added/removed columns, type changes
- Detect index additions/removals, constraint changes
- Generate `upgrade()` and `downgrade()` functions
**Prisma:**
- Run `prisma migrate diff` to compare schema.prisma against database
- Identify model additions, field changes, relation updates
- Generate migration SQL and Prisma migration directory
**Raw SQL:**
- Auto-detection not available; create empty template
- Include commented sections for UP and DOWN operations
### 3. Generate Migration File
Create migration file following the naming convention:
| Tool | Format | Example |
|------|--------|---------|
| Alembic | `{revision}_{description}.py` | `a1b2c3d4_add_orders_table.py` |
| Prisma | `{timestamp}_{description}/migration.sql` | `20240115120000_add_orders_table/migration.sql` |
| Raw SQL | `{sequence}_{description}.sql` | `003_add_orders_table.sql` |
### 4. Include Safety Checks
Every generated migration includes:
- Transaction wrapping (BEGIN/COMMIT or framework equivalent)
- Data preservation warnings for destructive operations
- Rollback function/section (downgrade in Alembic, DOWN in raw SQL)
- Comments explaining each operation
### 5. Validate Generated Migration
Run safety checks from `skills/migration-safety.md` on the generated file before presenting to user.
## Output Format
```
+----------------------------------------------------------------------+
| DB-MIGRATE - Generate |
+----------------------------------------------------------------------+
Tool: Alembic
Mode: auto-detect
Description: add_orders_table
Changes Detected:
[+] Table: orders (5 columns)
[+] Column: orders.user_id (FK -> users.id)
[+] Index: ix_orders_user_id
Files Created:
[+] alembic/versions/a1b2c3d4_add_orders_table.py
Migration Preview:
upgrade():
- CREATE TABLE orders (id, user_id, total, status, created_at)
- CREATE INDEX ix_orders_user_id ON orders(user_id)
- ADD FOREIGN KEY orders.user_id -> users.id
downgrade():
- DROP INDEX ix_orders_user_id
- DROP TABLE orders
Safety Check: PASS (no destructive operations)
Next Steps:
- Review generated migration file
- Run /db-migrate validate for safety analysis
- Run /db-migrate plan to see execution plan
```
## Important Notes
- Auto-detection works best with Alembic and Prisma
- Always review generated migrations before applying
- Destructive operations (DROP, ALTER TYPE) are flagged with warnings
- The `--empty` flag is useful for data migrations that cannot be auto-detected

View File

@@ -0,0 +1,122 @@
---
name: db-migrate history
description: Display migration history and current state
agent: migration-planner
---
# /db-migrate history - Migration History
## Skills to Load
- skills/orm-detection.md
- skills/visual-header.md
## Visual Output
Display header: `DB-MIGRATE - History`
## Usage
```
/db-migrate history [--limit=<n>] [--status=applied|pending|all] [--verbose]
```
**Arguments:**
- `--limit`: Number of migrations to show (default: 20)
- `--status`: Filter by status (default: all)
- `--verbose`: Show full migration details including SQL operations
## Prerequisites
Run `/db-migrate setup` first. Reads `.db-migrate.json` for tool and configuration.
## Process
### 1. Read Migration Source
Depending on the detected tool:
**Alembic:**
- Read `alembic_version` table for applied migrations
- Scan `alembic/versions/` directory for all migration files
- Cross-reference to determine pending migrations
**Prisma:**
- Read `_prisma_migrations` table for applied migrations
- Scan `prisma/migrations/` directory for all migration directories
- Cross-reference applied vs available
**Raw SQL:**
- Read migration tracking table (if exists) for applied migrations
- Scan migration directory for numbered SQL files
- Determine state from sequence numbers
### 2. Build Timeline
For each migration, determine:
- Migration identifier (revision hash, timestamp, sequence number)
- Description (extracted from filename or metadata)
- Status: Applied, Pending, or Failed
- Applied timestamp (if available from tracking table)
- Author (if available from migration metadata)
### 3. Detect Anomalies
Flag unusual states:
- Out-of-order migrations (gap in sequence)
- Failed migrations that need manual intervention
- Migration files present in directory but not in tracking table
- Entries in tracking table without corresponding files (deleted migrations)
### 4. Display History
Present chronological list with status indicators.
## Output Format
```
+----------------------------------------------------------------------+
| DB-MIGRATE - History |
+----------------------------------------------------------------------+
Tool: Alembic
Database: PostgreSQL (myapp_production)
Total Migrations: 8 (6 applied, 2 pending)
MIGRATION HISTORY
# Status Timestamp Description
-- -------- -------------------- ----------------------------------------
1 [applied] 2024-01-05 10:30:00 initial_schema
2 [applied] 2024-01-12 14:15:00 add_users_table
3 [applied] 2024-01-20 09:45:00 add_products_table
4 [applied] 2024-02-01 11:00:00 add_orders_table
5 [applied] 2024-02-15 16:30:00 add_user_roles
6 [applied] 2024-03-01 08:20:00 add_order_status_column
7 [pending] -- add_order_items_table
8 [pending] -- add_payment_tracking
Current Head: migration_006_add_order_status_column
Pending Count: 2
No anomalies detected.
```
### Verbose Mode
With `--verbose`, each migration expands to show:
```
4 [applied] 2024-02-01 11:00:00 add_orders_table
Operations:
[+] CREATE TABLE orders (id, user_id, total, status, created_at)
[+] CREATE INDEX ix_orders_user_id
[+] ADD FOREIGN KEY orders.user_id -> users.id
Rollback: Available (DROP TABLE orders)
```
## Important Notes
- History reads from both the database tracking table and the filesystem
- If database is unreachable, only filesystem state is shown (no applied timestamps)
- Anomalies like missing files or orphaned tracking entries should be resolved manually

View File

@@ -0,0 +1,136 @@
---
name: db-migrate plan
description: Show execution plan with rollback strategy
agent: migration-planner
---
# /db-migrate plan - Migration Execution Plan
## Skills to Load
- skills/rollback-patterns.md
- skills/migration-safety.md
- skills/visual-header.md
## Visual Output
Display header: `DB-MIGRATE - Plan`
## Usage
```
/db-migrate plan [--target=<migration>] [--include-rollback]
```
**Arguments:**
- `--target`: Plan up to specific migration (default: all pending)
- `--include-rollback`: Show rollback plan alongside forward plan
## Prerequisites
Run `/db-migrate setup` first. Pending migrations must exist.
## Process
### 1. Determine Current State
Query the migration history to find:
- Latest applied migration
- All pending (unapplied) migrations in order
- Any out-of-order migrations (applied but not contiguous)
### 2. Build Forward Plan
For each pending migration, document:
- Migration identifier and description
- SQL operations that will execute (summarized)
- Estimated lock duration for ALTER operations
- Dependencies on previous migrations
- Expected outcome (tables/columns affected)
### 3. Build Rollback Plan (if --include-rollback)
For each migration in reverse order, document:
- Rollback/downgrade operations
- Data recovery strategy (if destructive operations present)
- Point-of-no-return warnings (migrations that cannot be fully rolled back)
- Recommended backup steps before applying
### 4. Risk Assessment
Evaluate the complete plan:
- Total number of operations
- Presence of destructive operations (DROP, ALTER TYPE)
- Estimated total lock time
- Data migration volume (if data changes included)
- Recommended maintenance window duration
### 5. Present Plan
Display ordered execution plan with risk indicators.
## Output Format
```
+----------------------------------------------------------------------+
| DB-MIGRATE - Plan |
+----------------------------------------------------------------------+
Current State: migration_005_add_user_roles (applied)
Pending: 3 migrations
FORWARD PLAN
Step 1: migration_006_add_orders_table
Operations:
[+] CREATE TABLE orders (5 columns)
[+] CREATE INDEX ix_orders_user_id
[+] ADD FOREIGN KEY orders.user_id -> users.id
Lock Impact: None (new table)
Risk: LOW
Step 2: migration_007_add_order_items
Operations:
[+] CREATE TABLE order_items (4 columns)
[+] CREATE INDEX ix_order_items_order_id
Lock Impact: None (new table)
Risk: LOW
Step 3: migration_008_add_status_to_orders
Operations:
[~] ADD COLUMN orders.status VARCHAR(20) DEFAULT 'pending'
[~] ADD CHECK CONSTRAINT valid_status
Lock Impact: ~2s (instant ADD COLUMN with DEFAULT in PostgreSQL 11+)
Risk: LOW
ROLLBACK PLAN
Step 3 (reverse): Undo migration_008
[~] DROP CONSTRAINT valid_status
[~] DROP COLUMN orders.status
Reversible: YES
Step 2 (reverse): Undo migration_007
[-] DROP TABLE order_items
Reversible: YES (but data is lost)
Step 1 (reverse): Undo migration_006
[-] DROP TABLE orders
Reversible: YES (but data is lost)
RISK SUMMARY
Total Operations: 9
Destructive: 0
Lock Time: ~2 seconds
Risk Level: LOW
Maintenance Window: Not required
RECOMMENDATION: Safe to apply without maintenance window.
```
## Important Notes
- The plan is informational; it does not apply any migrations
- Lock time estimates are approximate and depend on table size
- Always back up the database before applying destructive migrations
- Out-of-order migrations are flagged as warnings

View File

@@ -0,0 +1,130 @@
---
name: db-migrate rollback
description: Generate rollback migration for a previously applied migration
agent: migration-planner
---
# /db-migrate rollback - Rollback Generator
## Skills to Load
- skills/rollback-patterns.md
- skills/visual-header.md
## Visual Output
Display header: `DB-MIGRATE - Rollback`
## Usage
```
/db-migrate rollback [<migration>] [--steps=<n>] [--dry-run]
```
**Arguments:**
- `<migration>`: Specific migration to roll back to (exclusive — rolls back everything after it)
- `--steps`: Number of migrations to roll back from current head (default: 1)
- `--dry-run`: Show what would be rolled back without generating files
## Prerequisites
Run `/db-migrate setup` first. Target migrations must have rollback/downgrade operations defined.
## Process
### 1. Identify Rollback Target
Determine which migrations to reverse:
- If `<migration>` specified: roll back all migrations applied after it
- If `--steps=N`: roll back the last N applied migrations
- Default: roll back the single most recent migration
### 2. Check Rollback Feasibility
For each migration to roll back, verify:
| Check | Result | Action |
|-------|--------|--------|
| Downgrade function exists | Yes | Proceed |
| Downgrade function exists | No | FAIL: Cannot auto-rollback; manual intervention needed |
| Migration contains DROP TABLE | N/A | WARN: Data cannot be restored by rollback |
| Migration contains data changes | N/A | WARN: DML changes may not be fully reversible |
| Later migrations depend on this | Yes | Must roll back dependents first |
### 3. Generate Rollback
Depending on the tool:
**Alembic:**
- Generate `alembic downgrade <target_revision>` command
- Show the downgrade SQL that will execute
- If downgrade function is incomplete, generate supplementary migration
**Prisma:**
- Generate rollback migration SQL based on diff
- Create new migration directory with rollback operations
**Raw SQL:**
- Generate new numbered migration file with reverse operations
- Include transaction wrapping and safety checks
### 4. Data Recovery Plan
If rolled-back migrations included destructive operations:
- Recommend backup restoration for lost data
- Suggest data export before rollback
- Identify tables/columns that will be recreated empty
### 5. Present Rollback Plan
Show the complete rollback strategy with warnings.
## Output Format
```
+----------------------------------------------------------------------+
| DB-MIGRATE - Rollback |
+----------------------------------------------------------------------+
Mode: Roll back 2 steps
Tool: Alembic
ROLLBACK PLAN
Step 1: Undo migration_008_add_status_to_orders
Operations:
[-] DROP CONSTRAINT valid_status
[-] DROP COLUMN orders.status
Data Impact: Column data will be lost (12,450 rows)
Reversible: Partially (column recreated empty on re-apply)
Step 2: Undo migration_007_add_order_items
Operations:
[-] DROP TABLE order_items
Data Impact: Table and all data will be lost (3,200 rows)
Reversible: Partially (table recreated empty on re-apply)
WARNINGS
[!] 2 operations will cause data loss
[!] Back up affected tables before proceeding
COMMANDS TO EXECUTE
alembic downgrade -2
# Or: alembic downgrade migration_006_add_orders_table
Generated Files:
(No new files — Alembic uses existing downgrade functions)
RECOMMENDED PRE-ROLLBACK STEPS
1. pg_dump --table=order_items myapp > order_items_backup.sql
2. pg_dump --table=orders --column-inserts myapp > orders_status_backup.sql
3. Review downgrade SQL with /db-migrate plan --include-rollback
```
## Important Notes
- Rollback does NOT execute migrations; it generates the plan and/or files
- Always back up data before rolling back destructive migrations
- Some migrations are irreversible (data-only changes without backup)
- Use `--dry-run` to preview without creating any files
- After rollback, verify application compatibility with the older schema

View File

@@ -0,0 +1,92 @@
---
name: db-migrate setup
description: Setup wizard for migration tool detection and configuration
agent: migration-planner
---
# /db-migrate setup - Migration Platform Setup Wizard
## Skills to Load
- skills/orm-detection.md
- skills/visual-header.md
## Visual Output
Display header: `DB-MIGRATE - Setup Wizard`
## Usage
```
/db-migrate setup
```
## Workflow
### Phase 1: Migration Tool Detection
Scan the project for migration tool indicators:
| File / Pattern | Tool | Confidence |
|----------------|------|------------|
| `alembic.ini` in project root | Alembic | High |
| `alembic/` directory | Alembic | High |
| `sqlalchemy` in requirements | Alembic (likely) | Medium |
| `prisma/schema.prisma` | Prisma | High |
| `@prisma/client` in package.json | Prisma | High |
| `migrations/` with numbered `.sql` files | Raw SQL | Medium |
| `flyway.conf` | Flyway (raw SQL) | High |
| `knexfile.js` or `knexfile.ts` | Knex | High |
If no tool detected, ask user to select one.
### Phase 2: Configuration Mapping
Identify existing migration configuration:
- **Migration directory**: Where migration files live
- **Model directory**: Where ORM models are defined (for auto-generation)
- **Database URL**: Connection string location (env var, config file)
- **Naming convention**: How migration files are named
- **Current state**: Latest applied migration
### Phase 3: Database Connection Test
Attempt to verify database connectivity:
- Read connection string from detected location
- Test connection (read-only)
- Report database type (PostgreSQL, MySQL, SQLite)
- Report current schema version if detectable
### Phase 4: Validation
Display detected configuration summary and ask for confirmation.
## Output Format
```
+----------------------------------------------------------------------+
| DB-MIGRATE - Setup Wizard |
+----------------------------------------------------------------------+
Migration Tool: Alembic 1.13.1
ORM: SQLAlchemy 2.0.25
Database: PostgreSQL 16.1
Migration Dir: ./alembic/versions/
Model Dir: ./app/models/
DB URL Source: DATABASE_URL env var
Current State:
Latest Migration: 2024_01_15_add_orders_table (applied)
Pending: 0 migrations
Configuration saved to .db-migrate.json
```
## Important Notes
- This command does NOT run any migrations; it only detects and configures
- Database connection test is read-only (SELECT 1)
- If `.db-migrate.json` already exists, offer to update or keep
- All subsequent commands rely on this configuration

View File

@@ -0,0 +1,127 @@
---
name: db-migrate validate
description: Check migration safety before applying
agent: migration-auditor
---
# /db-migrate validate - Migration Safety Validator
## Skills to Load
- skills/migration-safety.md
- skills/visual-header.md
## Visual Output
Display header: `DB-MIGRATE - Validate`
## Usage
```
/db-migrate validate [<migration-file>] [--all] [--strict]
```
**Arguments:**
- `<migration-file>`: Specific migration to validate (default: latest unapplied)
- `--all`: Validate all unapplied migrations
- `--strict`: Treat warnings as errors
## Prerequisites
Run `/db-migrate setup` first. Migration files must exist in the configured directory.
## Process
### 1. Identify Target Migrations
Determine which migrations to validate:
- Specific file if provided
- All unapplied migrations if `--all`
- Latest unapplied migration by default
### 2. Parse Migration Operations
Read each migration file and extract SQL operations:
- Table creation/deletion
- Column additions, modifications, removals
- Index operations
- Constraint changes
- Data manipulation (INSERT, UPDATE, DELETE)
- Custom SQL blocks
### 3. Safety Analysis
Apply safety rules from `skills/migration-safety.md`:
| Check | Severity | Description |
|-------|----------|-------------|
| DROP TABLE | FAIL | Permanent data loss; requires explicit acknowledgment |
| DROP COLUMN | FAIL | Data loss; must confirm column is unused |
| ALTER COLUMN type (narrowing) | FAIL | Data truncation risk (e.g., VARCHAR(255) to VARCHAR(50)) |
| ALTER COLUMN type (widening) | WARN | Safe but verify application handles new type |
| ALTER COLUMN NOT NULL (existing data) | FAIL | May fail if NULLs exist; needs DEFAULT or backfill |
| RENAME TABLE/COLUMN | WARN | Application code must be updated simultaneously |
| Large table ALTER | WARN | May lock table for extended time; consider batching |
| Missing transaction wrapper | FAIL | Partial migrations leave inconsistent state |
| Missing rollback/downgrade | WARN | Cannot undo if problems occur |
| Data migration in schema migration | WARN | Should be separate migration |
| No-op migration | INFO | Migration has no effect |
### 4. Lock Duration Estimation
For ALTER operations on existing tables, estimate lock impact:
- Table size (if database connection available)
- Operation type (ADD COLUMN is instant in PostgreSQL, ALTER TYPE is not)
- Concurrent operation risk
### 5. Generate Report
Group findings by severity with actionable recommendations.
## Output Format
```
+----------------------------------------------------------------------+
| DB-MIGRATE - Validate |
+----------------------------------------------------------------------+
Target: alembic/versions/b3c4d5e6_drop_legacy_columns.py
Tool: Alembic
FINDINGS
FAIL (2)
1. DROP COLUMN users.legacy_email
Risk: Permanent data loss for 12,450 rows with values
Fix: Verify column is unused, add data backup step, or
rename column first and drop in a future migration
2. ALTER COLUMN orders.total VARCHAR(10) -> VARCHAR(5)
Risk: Data truncation for values longer than 5 characters
Fix: Check max actual length: SELECT MAX(LENGTH(total)) FROM orders
If safe, document in migration comment
WARN (1)
1. Missing downgrade for DROP COLUMN
Risk: Cannot rollback this migration
Fix: Add downgrade() that re-creates column (data will be lost)
INFO (1)
1. Migration includes both schema and data changes
Suggestion: Separate into two migrations for cleaner rollback
SUMMARY
Operations: 4 (2 DDL, 2 DML)
FAIL: 2 (must fix before applying)
WARN: 1 (should fix)
INFO: 1 (improve)
VERDICT: FAIL (2 blocking issues)
```
## Exit Guidance
- FAIL: Do not apply migration until issues are resolved
- WARN: Review carefully; proceed with caution
- INFO: Suggestions for improvement; safe to proceed
- `--strict`: All WARN become FAIL

View File

@@ -0,0 +1,19 @@
---
name: db-migrate
description: Database migration toolkit — generate, validate, and manage schema migrations
---
# /db-migrate
Database migration management for Alembic, Prisma, and raw SQL.
## Sub-commands
| Sub-command | Description |
|-------------|-------------|
| `/db-migrate setup` | Setup wizard for migration tool detection |
| `/db-migrate generate` | Generate migration from model diff |
| `/db-migrate validate` | Check migration safety |
| `/db-migrate plan` | Show execution plan with rollback strategy |
| `/db-migrate history` | Display migration history |
| `/db-migrate rollback` | Generate rollback migration |