mysql-tuner

mysql-tuner is a skill for Claude Code, Codex from khalilbenaz/claude-skills-collection. It costs 85 tokens per session (2,338 once invoked), scanned A, original, MIT.

A guide to diagnosing and tuning MySQL and MariaDB databases, including slow queries, indexes, memory settings, storage, replication, and monitoring.

In plain words
What is it for?
Use it to inspect slow-query logs, analyze execution plans, find unused or duplicate indexes, and tune InnoDB and replication settings.
Why use it?
It helps identify why database requests are slow and whether the cause is a missing index, inefficient query, storage setting, or server configuration.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect slow-query logs, analyze execution plans, find unused or duplicate indexes, and tune InnoDB and replication settings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/khalilbenaz/claude-skills-collection/mysql-tuner
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add khalilbenaz/claude-skills-collection --skill mysql-tuner
Clone the repo
git clone --depth 1 https://github.com/khalilbenaz/claude-skills-collection

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mysql-tuner

README.md
[![agentmods](https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/mysql-tuner/github.svg)](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/mysql-tuner)
Your own site
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/mysql-tuner"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/mysql-tuner/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mysql-tuner

Your own site · 80×15
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/mysql-tuner"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/mysql-tuner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,338 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium MCP Rug Pull · line 204
    Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.
    Fix: Pin the image: image:tag or image@sha256:abc123
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00085 $0.02338
Opus 5 $0.00043 $0.01169
Sonnet 5 $0.00017 $0.00468
Haiku 4.5 $0.00009 $0.00234

Measured 8d ago against content hash 37aa89028454, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

mysql-tuner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

database-skills/mysql-tuner/SKILL.md · 249 lines

How it starts

The opening of the file, as written. The whole thing — 249 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MySQL Tuner

Workflow

1. Activer et analyser le slow query log

# my.cnf / my.ini
slow_query_log        = 1
slow_query_log_file   = /var/log/mysql/slow.log
long_query_time       = 1        # secondes ; descendre à 0.5 en prod chargée
log_slow_extra        = 1        # MySQL 8.0.14+ : rows_examined, tmp_tables…
log_queries_not_using_indexes = 1

Analyser avec pt-query-digest (Percona Toolkit) :

pt-query-digest /var/log/mysql/slow.log \
  --limit 20 \
  --output report \
  > /tmp/digest.txt

Critères de triage : rank par rows_examined / rows_sent (ratio > 100 = suspect), puis par durée totale cumulée.


2. Auditer les index existants

-- Requêtes sans index en production (MySQL 8+)
SELECT * FROM sys.statements_with_full_table_scans
ORDER BY no_index_used_count DESC LIMIT 20;

-- Index jamais utilisés
SELECT * FROM sys.schema_unused_indexes
WHERE object_schema NOT IN ('mysql','information_schema','performance_schema');

-- Doublons d'index
SELECT * FROM sys.schema_redundant_indexes;

EXPLAIN ANALYZE sur toute requête suspecte (MySQL 8.0.18+) :

EXPLAIN ANALYZE
SELECT u.id, o.total
FROM users u
JOIN orders o ON o.user_id = u.id
WHERE u.status = 'active' AND o.created_at > '2026-01-01';

Signaux d'alerte dans le plan : Full table scan, Using filesort, Using temporary, rows_examined >> rows_returned.


3. Concevoir la stratégie d'indexation

Règle du leftmost prefix — l'index (a, b, c) couvre WHERE a=?, WHERE a=? AND b=?, mais pas WHERE b=?.

Critères de décision :

Cas Solution
Filtre sur colonne haute cardinalité Index simple
Filtre multi-colonnes fréquent Index composite (sélectivité décroissante en tête)
SELECT ne lit que quelques colonnes Covering index (col_filtre, col1_select, col2_select)
LIKE 'prefix%' Index B-Tree classique (OK)
LIKE '%suffix' Full-text index ou Elasticsearch
JSON path fréquent Generated column + index

Read the full file on GitHub · 249 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 249 lines · 85 tokens per session scan A 37aa89028454

Subscribe to this mod's changes

mysql-tuner is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (22 stars, last pushed 18d ago), licensed MIT. It adds 85 tokens to every session and 2,338 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

frappe-errors-database

Use when handling database errors in Frappe/ERPNext. Covers DuplicateEntryError, LinkValidationError, MandatoryError, TimestampMismatchError, CharacterLengthExceededError, InReadOnlyMode, QueryTimeoutError, SQL injection errors, frappe.db.sql parameter format (% vs %s), getvalue returning None, transaction deadlocks…

Impertio-Studio/Frappe_Claude_Skill_Package · 142 tokens

sql-optimization-patterns

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

wshobson/agents · 44 tokens

database-patterns

DB schema design and query tuning: normalization, indexing, N+1, transactions, EXPLAIN. Triggers: schema, index, slow query, N+1, PostgreSQL, MySQL, EXPLAIN, deadlock, query plan.

softspark/ai-toolkit · 55 tokens

debug

Systematic debugging via logs, health checks, hypothesis-driven investigation. Triggers: debug, error, trace root cause, fix bug, reproduce symptom, investigation.

softspark/ai-toolkit · 34 tokens

migration-patterns

Zero-downtime DB migrations: expand-contract, double-write, backfill, blue-green. Triggers: migration, schema change, backfill, ALTER TABLE, online DDL.

softspark/ai-toolkit · 41 tokens

introspect

Agent self-debugging and recovery. Use when stuck in loops, making repeated errors, or quality degrades. Triggers: introspect, self-debug, stuck, loop, why failing.

softspark/ai-toolkit · 42 tokens