AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Mysql Problem Solver

skill-pekral-cursor-rules-mysql-problem-solver · by pekral

Use when analyze real MySQL query and schema problems using code

No reviews yet
0 installs
29 views
0.0% view→install

Install

$ agentstack add skill-pekral-cursor-rules-mysql-problem-solver

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-pekral-cursor-rules-mysql-problem-solver)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Mysql Problem Solver? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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

5. Propose Optimizations

Before recommending any rewrite, capture the baseline of the original query (EXPLAIN / EXPLAIN ANALYZEtype, key, rows, filtered, Extra, measured latency when DB access is available). Every proposal must then be held against that baseline per @rules/sql/optimalize.mdc "Performance Non-Regression on Query Changes":

  • The rewritten query must be equal or better on rows examined, access type, index usage, filesort / temporary avoidance, and latency.
  • If a proposal is unavoidably slower than the original (e.g. a correctness fix that widens the row set), do not present it as a clean win — state why it is slower, list the remaining optimization options (or state that none exist and why), and the trade-off that justifies it.

Recommend only justified changes, such as:

  • query rewrite to reuse an existing schema index (preferred — verify which indexes already exist via migrations / SHOW INDEX before proposing a new one; reorder WHERE / JOIN / ORDER BY columns to match an existing composite index, drop functions wrapping indexed columns, and project only columns the index already covers)
  • query rewrite (general)
  • Eloquent/query builder rewrite
  • eager loading change
  • pagination change
  • batching per-row loops into a single bulk operation — ModelManager batch methods (batchUpdate, batchInsert), whereIn(...)->delete() for deletes, or one bulk read keyed in memory for lookups (see @rules/sql/optimalize.mdc "Batch over per-row operations")
  • index addition or replacement (only when the existing schema cannot cover the query and EXPLAIN confirms the gap after the rewrite alternative has been ruled out)
  • redundant index removal
  • splitting one query into smaller ones

Explain trade-offs:

  • write overhead
  • duplicate indexes
  • over-indexing
  • complexity vs benefit

Laravel-Specific Checks

When the input is Laravel code, also inspect:

  • with() / eager loading
  • whereHas() / nested filters
  • withCount()
  • chunk() vs cursor() vs pagination
  • scopes hiding query complexity
  • repeated queries in loops

Terminal Guidance

When terminal access is available, inspect DB connection details from:

  • .env
  • config/database.php
  • docker/dev setup

Use MySQL tools when possible for:

  • SHOW CREATE TABLE
  • SHOW INDEX
  • EXPLAIN

If access fails, continue statically and say so.

Output Format

Use the template defined in templates/analysis-report.md. ---

Principles

  • Focus on the real bottleneck, not generic SQL advice
  • Prefer evidence from EXPLAIN over assumptions
  • Validate schema and index usage before proposing changes
  • Avoid unnecessary or duplicate indexes
  • Explain trade-offs (read vs write cost, complexity vs benefit)
  • Be concise, practical, and explicit about limitations

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.