mysql-problem-solver

mysql-problem-solver is a skill for Claude Code, Codex from pekral/cursor-rules. It costs 29 tokens per session (1,805 once invoked), scanned A, original, MIT.

A guide for investigating real MySQL database problems, including queries, table structure, indexes, and EXPLAIN results. MySQL is a relational database system, and EXPLAIN shows how it plans to run a query.

In plain words
What is it for?
Use it to find the actual SQL behind an application query, diagnose slow or poorly designed queries, and suggest safe, justified optimizations.
Why use it?
It replaces guesses with evidence from the application, schema, and query plan, while requiring reasons for proposed performance changes.

Skill for Claude CodeCodex

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

Good fit Use it to find the actual SQL behind an application query, diagnose slow or poorly designed queries, and suggest safe, justified optimizations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pekral/cursor-rules/mysql-problem-solver
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 pekral/cursor-rules --skill mysql-problem-solver
Clone the repo
git clone --depth 1 https://github.com/pekral/cursor-rules

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-problem-solver

README.md
[![agentmods](https://agentmods.dev/badge/skills/pekral/cursor-rules/mysql-problem-solver/github.svg)](https://agentmods.dev/skills/pekral/cursor-rules/mysql-problem-solver)
Your own site
<a href="https://agentmods.dev/skills/pekral/cursor-rules/mysql-problem-solver"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/mysql-problem-solver/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-problem-solver

Your own site · 80×15
<a href="https://agentmods.dev/skills/pekral/cursor-rules/mysql-problem-solver"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/mysql-problem-solver.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,805 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.
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.00029 $0.01805
Opus 5.5 $0.00012 $0.00722
Sonnet 5.5 $0.00006 $0.00361
Haiku 4.5 $0.00003 $0.00180

Measured 1mo ago against content hash 93ed5f83d1c7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mysql-problem-solver 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 1mo 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.

skills/mysql-problem-solver/SKILL.md · 143 lines

How it starts

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

MySQL Problem Solver

Purpose

Investigate real MySQL performance or query design problems in existing applications.

Focus on:

  • the actual query
  • real schema and index usage
  • EXPLAIN-based diagnosis when possible
  • safe, justified optimizations

Constraints

  • Apply @rules/sql.mdc
  • If the current project uses Laravel, also apply @rules/laravel/laravel.mdc, @rules/laravel/architecture.mdc, @rules/laravel/filament.mdc, and @rules/laravel/livewire.mdc
  • Be practical and direct
  • Prefer investigation over assumptions
  • Do not invent schema, indexes, or runtime behavior
  • Do not recommend index changes without explaining why they help
  • Apply @rules/sql/optimalize.mdc "Performance Non-Regression on Query Changes" — every proposed query rewrite must be at least as fast as the original (ideally faster); a proposal that is slower must carry the documented reason and the remaining optimization options
  • If DB access is unavailable, continue with static analysis and state the limitation clearly

Execution

1. Identify the Query

  • Find the actual SQL or reconstruct it from Laravel/Eloquent/query builder code
  • Include filters, joins, ordering, grouping, pagination, and subqueries

2. Inspect Schema

  • Inspect relevant tables and indexes using:
    • schema output
    • migrations
    • model relationships
    • DB tools when available

3. Run EXPLAIN

  • If MySQL access is available, run EXPLAIN
  • Review:
    • table
    • type
    • possible_keys
    • key
    • rows
    • filtered
    • Extra

4. Diagnose the Problem

Look for:

  • full scans
  • weak join strategy
  • existing index bypassed — query could hit a covering index already in the schema but the column order, a wrapping function, or extra projected columns prevent it. Preferred fix is a query rewrite (column re-ordering, SARGable rewrite, covering projection), not a new index (see @rules/sql/optimalize.mdc "Reuse existing indexes first").
  • missing or ineffective indexes
  • non-SARGable filters
  • poor sort/group plans
  • offset pagination on large datasets
  • N+1 behavior from application code
  • per-row queries inside loops — per-row update() / create() / delete() or single-row reads driven by a foreach (distinct from N+1 eager-loading: this is application code intentionally writing or reading row-by-row when a single batch query would suffice)
  • redundant or overlapping indexes
  • charset / collation mismatch between compared or joined columns — the implicit conversion makes the converted side non-SARGable (its index is skipped), and an ascii column compared against a non-ASCII value raises ERROR 1267 instead of returning no rows
  • schema-level causes of a slow plan (see @rules/sql/optimalize.mdc "Schema Design"): an oversized primary key copied into every secondary index, an unjustified VARCHAR(255) inflating sort buffers and temporary tables, TIMESTAMP columns converting per row by session time zone, or FLOAT / DOUBLE where DECIMAL belongs

Read the full file on GitHub · 143 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 143 lines · 29 tokens per session scan A 93ed5f83d1c7

Subscribe to this mod's changes

mysql-problem-solver is a skill published in the GitHub repository pekral/cursor-rules (11 stars, last pushed 19d ago), licensed MIT. It adds 29 tokens to every session and 1,805 once invoked, about $0.0001 per session on Opus 5.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-08-31.

Related

Other skills, from other repositories

laravel-eloquent

Eloquent and query-layer engineering rules for Laravel — eliminating N+1, choosing a pagination strategy, short atomic transactions, casts and scopes on the model, where raw SQL is allowed, and how migrations declare the schema those queries depend on. Use when writing or reviewing Eloquent models, migrations, query…

Foysal50x/skills · 93 tokens

Laravel Eloquent N+1 and Query Efficiency Review

Detects N+1 query patterns (relation access inside loops without eager loading), full-table get()/all() loads, and unsafe chunk()/cursor() usage in Laravel Eloquent code.

s977043/river-review · 48 tokens

Laravel Migration Safety Review

Reviews Laravel migrations for destructive operations, change() dropping modifiers, locking index creation on large tables (PostgreSQL), and asymmetric down().

s977043/river-review · 32 tokens

laravel-brain

Analyze a Laravel application for complexity hotspots, security surface, and database access patterns using laravel-brain. Activate when: the user asks what needs work, what should be improved, what to work on next, where to focus, what is the most complex code, what are the security issues, audit the codebase…

laramint/laravel-brain · 118 tokens

decide-casts

When to use Eloquent Cast vs Accessor. Value representation decisions.

attac-t/the-foundry · 19 tokens

projection-patterns

Build read models and projections from event streams. Use when implementing CQRS read sides, building materialized views, or optimizing query performance in event-sourced systems.

wshobson/agents · 36 tokens