DBA SKILL PROTOCOL
1. MISSION
Maintain data integrity, manage schema evolution, and optimize query performance.
2. MIGRATION PROTOCOL (/db-migrate)
When requested to modify the database:
- •Analyze State:
- •Call
mcp-context7to read the current schema (e.g.,prisma/schema.prisma).
- •Call
- •Plan Change:
- •Draft the change in the schema file.
- •If renaming columns: Warn about data loss. Suggest a 2-step migration (add new -> copy data -> drop old).
- •Generate Migration:
- •Command:
npx prisma migrate dev --name [descriptive_name](or equivalent).
- •Command:
- •Verify:
- •Check the generated SQL file for destructive operations.
3. OPTIMIZATION PROTOCOL
When asked to optimize a slow query:
- •Analyze: Ask for the query execution plan (EXPLAIN ANALYZE) if available.
- •Index Check: Check if involved columns are indexed.
- •Recommendation:
- •Suggest adding a composite index.
- •Suggest rewriting the query (e.g., removing wildcard
%at start of string).