sql-review
Installation
SKILL.md
SQL Review - Index Analysis & Recommendations
Scan codebase for DDL and SQL queries, create tables on a PolarDB-X test instance, populate mock data, analyze index usage via EXPLAIN, and output optimization recommendations.
Prerequisites
curlmust be available (for PolarDB-X Zero API calls to create/destroy instances)mysqlCLI client must be available (to connect and execute SQL)- If
mysqlis not available, prompt the user to install it (brew install mysql-client / apt install mysql-client / scoop install mysql) - If user chooses Aliyun instance mode,
aliyunCLI must be available and configured with valid credentials (aliyun configure list) - All temporary files use the
sql_review_prefix.$TMPDIRin this document refers to a writable temp directory — determine the appropriate path for the current OS (e.g./tmpon Linux/macOS,%TEMP%on Windows)
Progress File
Critical for long sessions: Initialize $TMPDIR/sql_review_progress.md at the start of Step 2 and append incrementally throughout the entire workflow.
- After scanning each mapper/table (Step 2): append that table's SQL inventory immediately.
- After EXPLAIN analysis per table (Step 5): append that table's EXPLAIN results and recommended DDL immediately.
- In Step 6 (Report): read the progress file as the single source of truth to assemble the final report.
Related skills