From oh-my-claudecode
Review database schemas, queries, and migrations for performance and safety
How this skill is triggered — by the user, by Claude, or both
Slash command
/oh-my-claudecode:db-reviewThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze database schemas, queries, migrations, and data access patterns for performance, safety, and operational excellence.
Analyze database schemas, queries, migrations, and data access patterns for performance, safety, and operational excellence.
This skill activates when:
Delegates to the db-reviewer agent (Opus model) for comprehensive database analysis:
Schema Review
Query Analysis
Migration Safety
Connection Management
Task(
subagent_type="oh-my-claudecode:db-reviewer",
model="opus",
prompt="DATABASE REVIEW TASK
Analyze database schemas, queries, and migrations for performance, safety, and reliability.
Scope: [specific files, tables, or entire data layer]
Review Checklist:
1. Schema design (indexes, constraints, data types)
2. Query patterns (N+1, SELECT *, unbounded queries)
3. Migration safety (locks, backward compat, rollback)
4. Connection management (pool size, timeouts)
5. Transaction handling (scope, isolation)
Output: Database review report with:
- Per-table schema assessment
- Query issues with file:line and performance impact
- Migration risk level per migration file
- Connection configuration recommendations
- Critical issues that must be fixed before deploy"
)
DATABASE REVIEW REPORT
======================
Risk Level: HIGH
Tables Analyzed: 12
Queries Scanned: 45
Migrations Reviewed: 3
SCHEMA ISSUES
-------------
1. Table: orders
Issue: Missing index on (user_id, created_at)
Impact: Query at orderRepo.ts:89 does full table scan (O(n) → O(log n))
Fix: CREATE INDEX idx_orders_user_created ON orders(user_id, created_at DESC);
2. Table: products
Issue: price column is FLOAT (floating-point arithmetic errors)
Impact: Financial calculations have rounding errors
Fix: ALTER TABLE products ALTER COLUMN price TYPE DECIMAL(10,2);
QUERY ISSUES
------------
1. src/services/userService.ts:67 — N+1 Query
Pattern: Loop fetching profiles individually
Impact: 1000 users = 1001 queries (~5 seconds)
Fix: Use eager loading or JOIN
2. src/repositories/orderRepo.ts:34 — Unbounded Query
Pattern: SELECT * FROM orders WHERE status = 'pending'
Impact: Returns all pending orders (could be millions)
Fix: Add LIMIT and cursor-based pagination
MIGRATION SAFETY
----------------
Migration: 20240115_add_email_unique.sql
⚠️ Lock Risk: HIGH — UNIQUE constraint on users table (5M rows)
⏱️ Estimated Time: ~30 seconds (table lock during index build)
🔄 Backward Compatible: YES
📋 Rollback: DROP INDEX idx_users_email_unique
💡 Recommendation: Use CREATE UNIQUE INDEX CONCURRENTLY (PostgreSQL)
CONNECTION CONFIG
-----------------
Pool Size: 5 (default) → Recommended: 20 (based on 50 concurrent requests)
Idle Timeout: Not set → Recommended: 10000ms
Connection Timeout: Not set → Recommended: 5000ms
CRITICAL ISSUES (MUST FIX)
--------------------------
1. Missing WHERE on UPDATE at adminService.ts:112 — can update ALL rows
2. No connection pool configured — each request creates new connection
With ops-check:
/db-review then /ops-check
Database + operational readiness review.
With Ralph:
/ralph db-review then fix all query issues
Review, fix N+1s and missing indexes, re-verify.
With Team:
/team 3:executor "fix all N+1 queries found in db-review"
Parallel fix of query issues.
npx claudepluginhub limzzum/oh-my-claudecodeCreates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.