Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

mysql-sql-doctor

Skill by eosphoros-ai

Diagnoses one slow SQL or a batch of slow MySQL queries using execution plans, index analysis and table statistics. Returns a rewritten SQL and index design with expected effects. Aimed at developers and DBAs who need to fix slow queries.

  • Score 91
  • 20k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install mysql-sql-doctor

Built from the published package, never by AI.

git clone --depth 1 https://github.com/eosphoros-ai/DB-GPT /tmp/DB-GPT && mkdir -p ~/.claude/skills && cp -r /tmp/DB-GPT/assets/suites/mysql-ops-expert/skills/mysql-sql-doctor ~/.claude/skills/mysql-sql-doctor

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install mysql-sql-doctor in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

SQL Doctor is a skill for diagnosing a single slow SQL statement or a batch of them in MySQL. It reads EXPLAIN and EXPLAIN ANALYZE output, index and table statistics, and slow-log or digest exports. It locates the main cost driver and returns a rewritten SQL, an index design and expected effects stated as ranges.

Each conclusion is tied to measured numbers, such as the ratio of rows examined to rows sent. The skill gives a verification method, side effects and a risk level with rollback commands for each change. It is aimed at developers and DBAs. When row counts are missing, it marks results as pending instead of guessing.

Written from the project's SKILL.md and checked against it.

What it can do

  • Single SQL diagnosisReads EXPLAIN output and finds the cost driver of one query.
  • Batch slow query reviewRanks slow queries by total time and diagnoses the top 3 to 5.
  • Index analysisChecks missing, unused, covering or misused indexes against a checklist.
  • Query rewriteShows before and after SQL with changed lines marked.
  • Index DDL proposalSuggests index column order, size impact and online DDL considerations.
  • Expected effect and verificationGives expected ranges and the commands to confirm them.
  • Risk and rollbackLabels each change with risk levels L0 to L3 and gives rollback commands.
  • Database connectorWith a read-only account, collects EXPLAIN and SHOW INDEX directly.

What you need

  • A MySQL database, or pasted SQL with EXPLAIN output
  • A read-only database account, for direct collection (optional)
  • MySQL version and table size details, asked once if unknown

Try asking

  • Diagnose this slow SQL and its EXPLAIN output, then suggest an index.
  • Review this slow query log and rank the top queries by total time.
  • Rewrite this query with deep pagination fixed and show the expected effect.

Good to know

  • Does not run write operations itself.
  • Does not draw conclusions from made-up row counts; marks them as pending.
  • Stored procedures, triggers, foreign key cascades and partitioned tables need extra checks.
  • DDL output defaults to replica verification and change review.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: assets/suites/mysql-ops-expert/skills/mysql-sql-doctor/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md7 KB
  • references/explain-reading.md5 KB
  • references/index-playbook.md6 KB
  • references/sql-doctor-report-template.md4 KB

Alternatives to mysql-sql-doctor

All alternatives →
hugging-face-datasetssickn33
94

Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.

AAA Skill 50k
db-repairgarrytan
94

Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.

AAA Skill 34k
alloydb-basicsgoogle
94

Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.

AAA Skill 26k
clickhouse-logs-queriessupabase
94

Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.

AAA Skill 116k
fix-slow-queriespaperclipai
94

Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.

AAA Skill 119k
prisma-8prisma
94

Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.

AAA Skill 48k

Compare with hugging-face-datasets, db-repair or alloydb-basics

mysql-sql-doctor: common questions

Can it diagnose a slow MySQL query from the SQL text alone?

It can run a static review against an index playbook. It then lists the data to collect, such as SHOW INDEX and EXPLAIN output.

Does it change my database?

It does not perform write operations. DDL output defaults to replica verification and change review.

Can it work with a batch of slow queries?

Yes. It accepts slow-log snippets, pt-query-digest reports and digest summary exports, and ranks queries by total time.

How do I install mysql-sql-doctor?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is mysql-sql-doctor free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is mysql-sql-doctor safe to use?

It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to mysql-sql-doctor?

Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.

mysql-sql-doctor Install

Add to stack

Loading.