mysql-patterns

mysql-patterns is a skill for Claude Code from shennawardana23/skillme. It costs 85 tokens per session (2,223 once invoked), scanned A, original, Apache-2.0.

A guide to designing queries, indexes, data types, keys, and concurrency rules for MySQL and MariaDB databases. It focuses on InnoDB, the storage engine commonly used for transactional tables.

In plain words
What is it for?
Choosing primary keys, designing schemas and indexes, writing upserts, selecting isolation levels, and porting PostgreSQL query patterns.
Why use it?
It explains where MySQL and MariaDB behave differently from PostgreSQL, preventing slow queries, fragmented indexes, and incorrect migrated assumptions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the skillme plugin — 137 skills, 2 commands shipped together

Good fit Choosing primary keys, designing schemas and indexes, writing upserts, selecting isolation levels, and porting PostgreSQL query patterns.

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

Made for: Claude Code.

Or install skillme, the plugin that ships this one along with the rest of its 137 skills, 2 commands.

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-patterns

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/shennawardana23/skillme/mysql-patterns"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/mysql-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,223 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.00085 $0.02223
Opus 5 $0.00043 $0.01111
Sonnet 5 $0.00017 $0.00445
Haiku 4.5 $0.00009 $0.00222

Measured 9d ago against content hash 3bc5d90116b7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

mysql-patterns 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 9d 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-patterns/SKILL.md · 190 lines

How it starts

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

MySQL / MariaDB Patterns

This is the query- and schema-design layer for MySQL (InnoDB) and MariaDB, written for a team whose default database is PostgreSQL (see postgres-patterns, postgres-hotel-partitioning) but that also operates MySQL/MariaDB-backed systems (commonly paired with CodeIgniter/Laravel legacy stacks — see php-codeigniter-patterns, laravel-patterns). Every section below calls out where MySQL's real, documented behavior differs from Postgres, because that difference — not the syntax — is where migrated assumptions actually break.

Primary keys: the clustered-index difference that changes everything else

InnoDB stores a table's rows physically ordered by primary key — the PK is the clustering key, and every secondary index stores the PK value as its row pointer (not a physical row address, the way Postgres's heap-based secondary indexes work). Two direct consequences:

  • A non-monotonic primary key (e.g. a random UUID) causes page splits and index fragmentation on every insert, because new rows aren't appended at the end of physical storage — they're inserted wherever the PK value's ordering says they belong. This is a far more serious performance concern in InnoDB than in Postgres, where a random UUID PK costs only a (already-real) B-tree-locality penalty on that one index, not the clustering order of the whole table.
  • Every secondary index lookup requires a second lookup by PK value (unless the query is covered), because a secondary index only stores the PK, not the full row — a wide/expensive PK type inflates every secondary index's storage cost, not just the primary key's own.

Prefer an auto-increment (or otherwise monotonically increasing) BIGINT primary key for InnoDB tables. If a UUID is required for external referencing, keep it as a separate unique-indexed column rather than the clustering PK, or use a time-ordered UUID variant (UUIDv7-style) specifically to preserve insertion order.

Charset: utf8mb4, never utf8

Read the full file on GitHub · 190 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. 9d ago First seen · 190 lines · 85 tokens per session scan A 3bc5d90116b7

Subscribe to this mod's changes

mysql-patterns is a skill published in the GitHub repository shennawardana23/skillme (2 stars, last pushed 15d ago), licensed Apache-2.0. It adds 85 tokens to every session and 2,223 once invoked, about $0.0004 per session on Opus 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-09-03.

Related

Other skills, from other repositories

postgresql-development-cloudbase

Use when building, debugging, or evaluating CloudBase PostgreSQL / CloudBase PG / PG mode apps, including Postgres schema setup, queryPgDatabase/managePgDatabase, JS SDK v3 app.rdb() CRUD/RPC, PG HTTP API fallback, RLS-style permissions, username-password auth, and Web CMS/admin CRUD flows backed by CloudBase PG.

sutchan/Agent-Skills-Hub · 77 tokens

cloudbase-document-database-web-sdk

Use CloudBase document database Web SDK only for confirmed NoSQL collection work. Query, create, update, and delete document data; if the task mentions PostgreSQL / CloudBase PG / app.rdb(), route to postgresql-development instead.

sutchan/Agent-Skills-Hub · 55 tokens

minimal-web-baas-demo

A quick setup path for a small CloudBase web application with a database. CloudBase is a backend service that provides hosting and data storage, while CRUD means creating, reading, updating, and deleting records.

sutchan/Agent-Skills-Hub · 144 tokens

data-model-creation

Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.

sutchan/Agent-Skills-Hub · 68 tokens

relational-database-web-cloudbase

Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.

sutchan/Agent-Skills-Hub · 68 tokens

relational-database-mcp-cloudbase

Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.

sutchan/Agent-Skills-Hub · 94 tokens