dev-mysql

Guides MySQL and MariaDB schema design, indexing, transactions, and production operations.

Updated Aug 10, 2026
One-click install
npx skills add https://github.com/Choi-Keith/skill-arsenal-ultra --skill dev-mysql-choi-keith
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dev-mysql
Source: https://github.com/Choi-Keith/skill-arsenal-ultra/tree/main/plugins/dev-skills/dev-backend/skills/dev-mysql
Command: npx skills add https://github.com/Choi-Keith/skill-arsenal-ultra --skill dev-mysql-choi-keith

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Backend engineers often write SQL that works in development but fails in production: slow queries from missing indexes, deadlocks from inconsistent lock ordering, stale reads from replicas, and connection pool exhaustion. This Skill encodes production-grade MySQL and MariaDB patterns so an AI agent reviews and writes database code with the correct engine-specific syntax and operational safeguards. ## Core Features & Use Cases - Schema and Index Design: Provides table defaults (BIGINT UNSIGNED keys, DECIMAL for money, utf8mb4), composite index ordering rules, and EXPLAIN review signals. - Query Patterns: Covers upserts with cross-engine syntax, keyset pagination, indexed JSON generated columns, and full-text search. - Transactions and Operations: Documents deadlock prevention, SKIP LOCKED queue claiming, connection pool sizing for SQLAlchemy and mysql2, replication lag handling, security hardening, and my.cnf starting points. - Use Case: Before running a migration on a large production orders table, ask the agent to review the SQL; it will check index coverage, lock risk, MySQL versus MariaDB syntax differences, and produce a verification plan with EXPLAIN and rollback criteria. ## Quick Start Ask the agent to review your MySQL schema migration or slow query using the dev-mysql skill and return the risky issues with corrected SQL.

Frequently Asked Questions about dev-mysql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design indexes for MySQL queries?

Place equality predicate columns first in composite indexes, followed by range or sort columns, such as (account_id, status, created_at). Always run EXPLAIN before adding indexes and watch for type=ALL, NULL key, or Using filesort signals.

How to implement pagination in MySQL without slow OFFSET?

Use keyset pagination: filter with WHERE (created_at, id) < (?, ?) and order by the same columns, backed by a matching composite index. Deep OFFSET forces the server to scan and discard rows, slowing linearly with page depth.

What is the difference between MySQL and MariaDB upsert syntax?

MySQL supports row aliases like VALUES (...) AS new for ON DUPLICATE KEY UPDATE and deprecates VALUES(col), while MariaDB supports VALUES(col) as the standard form. Use VALUES(col) for cross-engine compatibility in mixed deployments.

When should I use SKIP LOCKED in MySQL?

Use SKIP LOCKED only for queue-style workloads where workers claim pending jobs and skipping locked rows is acceptable. It can return inconsistent views, so never use it for accounting reads or integrity-sensitive queries.

Why does my application get stale reads after writes?

Read replicas lag behind the primary, so read-your-writes flows, checkout, and permission checks routed to replicas may see old data. Pin these paths to the primary and monitor replica SQL thread health and lag.

How do I configure a MySQL connection pool in SQLAlchemy?

Set pool_size, max_overflow, pool_timeout, and pool_recycle below the server's wait_timeout (for example 240 seconds when wait_timeout is 300), and enable pool_pre_ping to recover from stale connections after network failures or failovers.