mysql
MySQL best practices for schema design, indexing, query optimization, transactions, and operations. Load when working with MySQL databases.
Works with
--- name: mysql description: MySQL best practices for schema design, indexing, query optimization, transactions, and operations. Load when working with MySQL databases. license: MIT --- # MySQL MySQL expertise module for safe, measurable database changes across schema design, indexing, query optimization, transactions, and operations. ## Core Workflow 1. Establish workload parameters and constraints 2. Consult only relevant reference materials 3. Propose minimal changes with trade-offs clearly stated 4. Validate findings with diagnostic output (`EXPLAIN`, metrics) 5. For production work, include rollback and verification procedures ## Schema Design | Topic | Reference | Use for | |-------|-----------|---------| | Primary Keys | [references/primary-keys.md](references/primary-keys.md) | Monotonic PKs, UUID anti-patterns, clustered key choice | | Data Types | [references/data-types.md](references/data-types.md) | Type selection, storage sizes, precision | | Character Sets | [references/character-sets.md](references/character-sets.md) | utf8mb4, collation, migration | | JSON Columns | [references/json-column-patterns.md](references/json-column-patterns.md) | JSON storage, generated columns, indexing | ## Indexing | Topic | Reference | Use for | |-------|-----------|---------| | Composite Indexes | [references/composite-indexes.md](references/composite-indexes.md) | Column ordering, equality-before-range, selectivity | | Covering Indexes | [references/covering-indexes.md](references/covering-indexes.md) | Index-only scans, INCLUDE columns | | Fulltext Indexes | [references/fulltext-indexes.md](references/fulltext-indexes.md) | Natural language search, boolean mode | | Index Maintenance | [references/index-maintenance.md](references/index-maintenance.md) | Unused index detection, performance_schema audit | ## Partitioning | Topic | Reference | Use for | |-------|-----------|---------| | Partitioning | [references/partitioning.md](references/partitioning.md) | Time-series, large tables (>50M rows), partition pruning | ## Query Optimization | Topic | Reference | Use for | |-------|-----------|---------| | EXPLAIN Analysis | [references/explain-analysis.md](references/explain-analysis.md) | Plan reading, red flags (filesort, temp tables) | | Query Pitfalls | [references/query-optimization-pitfalls.md](references/query-optimization-pitfalls.md) | OFFSET pagination, implicit conversions | | N+1 Queries | [references/n-plus-one.md](references/n-plus-one.md) | Detection, batching, eager loading | ## Transactions & Locking | Topic | Reference | Use for | |-------|-----------|---------| | Isolation Levels | [references/isolation-levels.md](references/isolation-levels.md) | REPEATABLE READ default, phantom reads | | Deadlocks | [references/deadlocks.md](references/deadlocks.md) | Consistent access order, lock analysis | | Row Locking | [references/row-locking-gotchas.md](references/row-locking-gotchas.md) | Gap locks, lock escalation, I/O outside transactions | ## Operations | Topic | Reference | Use for | |-------|-----------|---------| | Online DDL | [references/online-ddl.md](references/online-ddl.md) | Schema changes, ALGORITHM options | | Connection Mgmt | [references/connection-management.md](references/connection-management.md) | Pooling, max_connections tuning | | Replication Lag | [references/replication-lag.md](references/replication-lag.md) | Lag monitoring, read consistency | ## Guardrails - Prefer measured evidence over blanket rules of thumb. - Note MySQL-version-specific behavior when giving advice. - Ask for explicit human approval before destructive data operations (drops/deletes/truncates).
More Database skills
azure-upgrade
microsoft/azure-skills
Assess and upgrade Azure workloads between plans, tiers, or SKUs, or modernize Azure SDK dependencies in source code. WHEN: upgrade Consumption to Flex Consumption, upgrade Azure Functions plan, change hosting plan, function app SKU, migrate App Service to Container Apps, modernize legacy Azure Java SDKs (com.microsoft.azure to com.azure), migrate Azure Cache for Redis (ACR/ACRE) to Azure Managed Redis (AMR).
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-database-setup
prisma/skills
Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.). Use when setting up a new project, changing databases, or troubleshooting connection issues. Triggers on "configure postgres", "connect to mysql", "setup mongodb", "sqlite setup".

