| name | forge-database-review |
| description | Review database usage - queries, indexing, schema, migrations. Trigger when user types /forge-database-review or requests a database review.
|
/forge-database-review
Review database usage and queries using AI reasoning.
Command
/forge-database-review [path] [--quick|--deep] [--markdown|--json] [--verbose]
Options
[path] — Target directory (default: current directory)
--quick — Fast scan, focus on critical issues only
--deep — Thorough scan, check all patterns
--markdown — Output as markdown (default)
--json — Output as JSON
--verbose — Include detailed evidence
Purpose
Analyze database usage for:
- Query performance issues
- Indexing problems
- Schema design issues
- SQL anti-patterns
- Migration risks
Workflow
Step 1: Understand Project
Use shared/analyzer/ to detect:
- Database type (PostgreSQL, MySQL, MongoDB, etc.)
- ORM usage
- Migration files
Step 2: Run Database Analysis
Execute analysis prompts:
- Query Performance (
prompts/query-performance.md)
- Indexing Strategy (
prompts/indexing-strategy.md)
- Schema Design (
prompts/schema-design.md)
- SQL Anti-patterns (
prompts/sql-anti-patterns.md)
- Migration Safety (
prompts/migration-safety.md)
Step 3: Generate Report
Use shared/report/ to generate:
- Database Health Score (0-100)
- Query analysis
- Optimization recommendations
Output Format
Follow the markdown report format generated by shared/report/markdown.ts. It MUST use the following layout:
Database Review Report
Project: [Project Name]
Path: [Project Path]
Language: [Primary Language]
Framework: [Detected Framework (optional)]
Date: [Timestamp]
Score
[Score]/100 (Grade: [Grade])
| Severity | Count |
|---|
| 🔴 Critical | [count] |
| 🟠 High | [count] |
| 🟡 Medium | [count] |
| 🔵 Low | [count] |
| ⚪ Info | [count] |
Executive Summary
Found [total] issues: [count] critical, [count] high, [count] medium, [count] low, [count] info.
🔍 Detailed Findings
[Severity Group (e.g. 🔴 Critical)]
| Title | Location | Description | Impact |
|---|
| [Finding Title] | [file-name]:[line] | [Description] | [Impact] |
📂 Code Evidence
Finding #[number]: [Finding Title]
[code snippet]