Auto-activate for .sql files with MySQL syntax, mysql connection strings, mysqldump. Produces MySQL/MariaDB queries, stored procedures, performance tuning, and connection patterns. Use when: writing MySQL queries, optimizing slow queries, configuring InnoDB, setting up replication, using mysql CLI, or working with MySQL connectors (Python, Node, Java). Not for PostgreSQL (see postgres), SQLite, or other databases.
From flownpx claudepluginhub cofin/flow --plugin flowThis skill uses the workspace's default tool permissions.
references/admin.mdreferences/connections.mdreferences/innodb.mdreferences/json.mdreferences/mysql_cli.mdreferences/performance.mdreferences/replication.mdreferences/security.mdreferences/sql_patterns.mdreferences/stored_procedures.mdSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
MySQL is the world's most popular open-source relational database, powering applications from small web apps to large-scale internet services. This skill covers MySQL 8.0+ (and MariaDB where noted).
# Python (PyMySQL) -- always parameterized, always utf8mb4
import pymysql
conn = pymysql.connect(
host="localhost",
user="app_user",
password="secret",
database="mydb",
charset="utf8mb4",
cursorclass=pymysql.cursors.DictCursor,
)
with conn:
with conn.cursor() as cursor:
cursor.execute("SELECT * FROM users WHERE id = %s", (42,))
user = cursor.fetchone()
conn.commit()
-- CTE (8.0+)
WITH active_users AS (
SELECT id, name FROM users WHERE status = 'active'
)
SELECT au.name, COUNT(o.id) AS order_count
FROM active_users au
JOIN orders o ON o.user_id = au.id
GROUP BY au.name;
-- Window function
SELECT customer_id, order_date, total,
ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY order_date DESC) AS rn
FROM orders;
-- Upsert
INSERT INTO counters (key_name, value)
VALUES ('page_views', 1)
ON DUPLICATE KEY UPDATE value = value + VALUES(value);
UUID_TO_BIN(UUID(), 1) for ordered UUIDs in MySQL 8.0+.Choose InnoDB (always). Use AUTO_INCREMENT integer PKs unless UUIDs are required (then use ordered UUID v7). Set CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci at the database and table level.
Use parameterized queries in application code -- never string interpolation. Use CTEs for readability. Use window functions instead of self-joins for ranking/running totals.
Create indexes to support WHERE, JOIN, and ORDER BY clauses. Use composite indexes following the leftmost-prefix rule. Check coverage with EXPLAIN.
Run EXPLAIN ANALYZE on slow queries. Check the slow query log (long_query_time = 1). Tune buffer pool size, redo log size, and innodb_flush_log_at_trx_commit for the workload.
Confirm query plans use indexes (no unexpected full table scans). Verify utf8mb4 encoding. Test with realistic data volumes.
%s placeholders (Python) or ? (Node/Java).charset=utf8mb4 in connections and CHARACTER SET utf8mb4 in DDL. Plain utf8 is a 3-byte subset that cannot store emoji or some CJK characters.UUID_TO_BIN(UUID(), 1) for ordered storage.Before delivering MySQL code, verify:
Task: Parameterized query with index creation for an orders lookup.
-- Create table with proper encoding and engine
CREATE TABLE orders (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
user_id BIGINT NOT NULL,
status ENUM('pending', 'shipped', 'delivered', 'cancelled') NOT NULL DEFAULT 'pending',
total DECIMAL(10, 2) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_orders_user_status (user_id, status),
INDEX idx_orders_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Verify index usage
EXPLAIN SELECT id, total, created_at
FROM orders
WHERE user_id = 42
AND status = 'shipped'
ORDER BY created_at DESC
LIMIT 20;
# Application code -- parameterized query
async def get_user_orders(conn, user_id: int, status: str) -> list[dict]:
async with conn.cursor() as cursor:
await cursor.execute(
"SELECT id, total, created_at FROM orders "
"WHERE user_id = %s AND status = %s "
"ORDER BY created_at DESC LIMIT 20",
(user_id, status),
)
return await cursor.fetchall()
</example>
For detailed guides and code examples, refer to the following documents in references/: