* chore(stdlib): add conformance tooling for the skills library
The library had no gate that could express what a valid skill is, so
malformed frontmatter, over-budget files and credential literals went
unnoticed. These scripts define and enforce that contract.
- validate-skills.py: extend with Agent Skills v1.0 conformance -
naming rules and directory agreement, an explicit activation trigger
in the description, canonical layout, the 500-line SKILL.md budget,
relative-link integrity, and two security rules (no unrestricted
Bash(*) grant, no credential literals). Structural checks now read a
skill as a whole so material moved into references/ still counts.
- split-skill-references.py: move the heaviest sections of an oversized
SKILL.md into references/. Verifies line by line that every source
line lands in exactly one output and refuses to write otherwise.
- generate-skill-inventory.py: derive SKILLS_INVENTORY.md and
DIRECTORY_STRUCTURE.md from the tree so they cannot drift.
- generate-skill-catalog.py: index the canonical layout only, count
references/ toward a skill's size, and stop truncating descriptions
at 200 characters - the catalog is the discovery surface and must
carry the activation trigger.
- .gitignore: Python bytecode from these scripts, and local .pcl state.
Reviewed-by: Security Analyst, Compiler Engineer, DevX Engineer
* fix(stdlib): bring all 174 skills to Agent Skills v1.0 conformance
No skill in the library was conformant. 41 of 175 failed the existing
validator outright, and none satisfied the spec. This pass fixes the
tree and records the result. See stdlib/CHANGELOG.md for the per-skill
versioning and migration notes.
BREAKING CHANGE: one skill removed, five moved, seven with a capability
withdrawn. Library version 2.0.0 -> 3.0.0.
Structure
- Convert 71 skills stored as flat files to <category>/<name>/SKILL.md,
the layout the spec requires and the only one able to carry companion
resources.
- Rename 5 directories that disagreed with their declared name:, so
resolution by path and by name stop giving different answers. The
repository docs already referenced the corrected paths.
- Merge the duplicate legal-technology skills into legaltech-expert and
delete legal-tech-expert, carrying over everything the survivor
lacked.
Metadata
- Repair 20 unparseable frontmatters: an H1 preceded the --- block and
the key was skill_id: instead of name:, so any parser reading
frontmatter at offset 0 saw no metadata at all. The objectives,
prerequisites and outcome they carried become real body sections.
- Add the missing version: to 21 skills, fold keywords into tags, move
expertise_level under metadata, and align 10 category: values with
their directory.
Discoverability
- Give all 174 descriptions an explicit "Use when ..." trigger, built
from each skill's own tags and section headings. 152 previously said
only what the skill was about, leaving an agent nothing to match on.
Progressive disclosure
- Split 127 oversized skills, moving bulk material into references/ read
on demand and leaving an index behind. A SKILL.md now averages 277
lines instead of 644 and none exceeds 500. Verified lossless line by
line against the previous revision.
Security
- Withdraw the unrestricted Bash(*) grant from 7 skills; none of the six
non-financial ones contained a single shell command. finance-expert
documents code that charges cards and reads bank accounts, so it now
grants no shell at all.
- Remove credential literals: Stripe keys, two JWT signing keys, an
Express session secret, a Redis password and WiFi credentials, all
inlined in examples. They load from the environment now.
- finance-expert: idempotency keys were documented but absent, so a
retry double-charged; webhook signature failures were not caught, so a
forged event raised uncaught instead of being rejected;
int(amount * 100) truncated fractions of a cent. All fixed, plus a
money-movement guardrails section.
- trading-expert: place_order routed without any pre-trade risk check
although a RiskManager sat unused in the next section. Risk validation
now runs before routing and raises rather than returning a boolean a
caller can ignore; live routing is opt-in.
- Correct an Ansible Vault example that showed plaintext under an
"encrypted" label.
Also fixes 8 broken documentation links and a prematurely closed code
fence in skill-creator-expert that leaked template content into prose.
Per the repository file-organization policy, four stale progress reports
(SKILLS_MANIFEST, COMPLETE_SKILLS_LIBRARY, COMPLETE_LIBRARY_MANIFEST,
PHASE_3_DATA_ANALYTICS) move out of stdlib/ into the gitignored
.roadmap/status/stdlib/; they claimed 31 of 100 skills complete. They
appear here as deletions because .roadmap/ is not tracked.
Reviewed-by: Security Analyst, Language Designer, DevX Engineer,
Documentation Specialist
* fix(skills): resolve standard library skills from their real layout
No stdlib skill was resolvable. SkillResolver looked for
`<stdlibDir>/<name>.md` with stdlibDir defaulting to `stdlib/skills`, a
directory that does not exist, and the path ignored the category level
the library actually uses. The two LSP providers had the same wrong
directory and scanned only one level deep, so neither completion nor
go-to-definition could see a skill either.
- skill-discovery.ts: enumerate skill entry points across the shapes in
use - a flat `<name>.md`, `<name>/SKILL.md`, and
`<category>/<name>/SKILL.md` - while skipping references/, scripts/
and assets/, which hold supporting material rather than entry points.
- skill-resolver.ts: point stdlibDir at `stdlib`, and look the name up
as a directory under any category as well as the two legacy shapes, so
existing custom stdlib directories keep working. The name is used as a
single path segment and rejected if it contains a separator or
traversal, so a reference cannot escape the stdlib root.
- Rewire both LSP providers onto the shared discovery helper.
Tests: 13 new cases covering the layouts, ordering, the references/
exclusion, path-traversal rejection, and an integration test that
resolves real shipped skills by bare name.
Reviewed-by: Compiler Engineer, Runtime Architect, Security Analyst
* feat(stdlib): add 17 skills covering the library's largest gaps
Selection was driven by cross-referencing coverage against observed usage
rather than by intuition: Stack Overflow and GitHub Octoverse data for
which technologies matter, and install rankings on public agent-skill
registries for the shape of skills people actually use.
That comparison found a mismatch of form, not only of coverage. The
most-installed skills in the ecosystem are procedures - tdd, refactoring,
frontend design, browser automation - while all 174 existing skills were
domain knowledge shaped as <domain>-expert. The new workflows/ category
closes that gap and introduces the <activity>-workflow convention.
New category workflows/ (4)
- tdd-workflow, refactoring-workflow, debugging-workflow,
code-review-workflow. code-review-workflow complements rather than
replaces code-review-expert: procedure versus judgement. Merge them if
the split proves confusing in use.
Applied AI (3) - the largest coverage gap
- llm-engineering-expert, rag-expert, agent-engineering-expert.
The library referenced LLMs in tags but covered none of it: pgvector
appeared zero times across 174 skills, LangChain once, MCP twice
despite the repository shipping an MCP integration guide.
Capabilities (2)
- document-processing-expert (PDF, DOCX, XLSX, PPTX in one skill),
browser-automation-expert (a client against third-party sites,
distinct from playwright-expert which tests your own application).
Data (3)
- mysql-expert, the second most used database and previously absent
while rarer stores had skills; analytical-databases-expert;
stream-processing-expert.
Security (3)
- secrets-management-expert, supply-chain-security-expert (OWASP A03
2025), identity-access-expert (OWASP A01).
Interface and meta (2)
- accessibility-expert: design/ held only design-expert, which despite
its name covers software architecture, so WCAG had no home.
- skill-router: find and compose skills across 191, with a
disambiguation table for overlapping pairs.
Grouping by decision context rather than by technology keeps the growth
to 17 skills for roughly 50 topics. Five vector stores live inside
rag-expert; four document formats inside document-processing-expert.
Per-tool depth sits in references/, which the progressive-disclosure work
in 3.0.0 made cheap.
Four further gaps are better served by extending existing skills -
PyTorch and TensorFlow in ml-expert, OpenTelemetry in monitoring-expert,
Pulumi and Crossplane in terraform-expert - and are not in this change.
Library 3.0.0 -> 3.1.0, additive only. Adds the workflows label to the
inventory generator; catalogue, inventory, structure and CHANGELOG
regenerated.
Reviewed-by: Product Strategist, Security Analyst, DevX Engineer,
Documentation Specialist
* fix(test): create test directories with mkdtempSync
CodeQL flagged js/insecure-temporary-file (CWE-377) on both suites.
`join(tmpdir(), <predictable name>)` followed by mkdirSync creates a
world-readable directory at a guessable path, so another local user can
pre-create it or plant a symlink between the name being computed and the
directory being created.
mkdtempSync creates the directory atomically with a random suffix and
0700 permissions, which closes both the disclosure and the race.
One occurrence is new in this branch (skill-discovery); the other
pre-dates it in skill-resolver and is fixed in the same pass rather than
left as a known finding in a file this branch already touches.
10 KiB
name, version, description, category, tags, allowed-tools, metadata
| name | version | description | category | tags | allowed-tools | metadata | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mysql-expert | 1.0.0 | MySQL and MariaDB administration and development: InnoDB internals, indexing, query tuning, replication, and online schema change. Use when the user mentions MySQL, MariaDB, InnoDB, `my.cnf`, slow queries, `EXPLAIN`, binlog or replication lag, gtid, Percona or pt-online-schema-change, or when the task involves designing a MySQL schema, diagnosing lock contention, or migrating a large table without downtime. | data |
|
|
|
MySQL Expert
MySQL differs from PostgreSQL in ways that matter for design, not just syntax: the clustered primary key, the storage-engine boundary, and a replication model built on the binary log.
Core Concepts
InnoDB Is the Database
Everything below assumes InnoDB. Rows are stored inside the primary key index — the table is the primary key B-tree. Three consequences drive most design decisions:
- The primary key is present in every secondary index, so a wide primary key inflates every index on the table.
- A secondary index lookup costs two traversals: the index, then the primary key. Unless the index covers the query.
- Inserts in primary key order are cheap; random primary keys cause page splits and fragmentation.
This is why a BIGINT AUTO_INCREMENT or a time-ordered UUID (UUIDv7) beats a
random UUIDv4 primary key by a wide margin on large tables.
Character Sets
Use utf8mb4 and nothing else. MySQL's utf8 is a three-byte subset that cannot
store emoji or some CJK characters, and it fails by truncating or erroring at
insert time.
CREATE TABLE orders (…) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Collation determines comparison and sorting. utf8mb4_0900_ai_ci is
accent-insensitive and case-insensitive; use utf8mb4_0900_as_cs or _bin when
you need exact matching, for example on tokens or hashes.
Isolation and Locking
The default is REPEATABLE READ, which is stricter than PostgreSQL's default and
uses gap locks that surprise people migrating across.
SELECT @@transaction_isolation;
SET SESSION transaction_isolation = 'READ-COMMITTED'; -- often the better default
READ COMMITTED reduces gap locking and deadlocks for typical OLTP workloads.
Change it deliberately and test — it also changes replication semantics for
statement-based binlog formats.
Schema Design
CREATE TABLE orders (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
public_id BINARY(16) NOT NULL, -- UUID stored compactly
customer_id BIGINT UNSIGNED NOT NULL,
status ENUM('pending','paid','shipped','cancelled') NOT NULL,
total_minor BIGINT NOT NULL, -- money as integer minor units
currency CHAR(3) NOT NULL,
created_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (id),
UNIQUE KEY uk_orders_public_id (public_id),
KEY idx_orders_customer_created (customer_id, created_at),
CONSTRAINT fk_orders_customer FOREIGN KEY (customer_id) REFERENCES customers(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Decisions worth defending:
- Surrogate
BIGINTprimary key, with the externally visible identifier as a separate unique column. Keeps the clustered index narrow and sequential. BINARY(16)for UUIDs, notCHAR(36): a quarter of the size, and it propagates into every secondary index.- Money as integer minor units.
DECIMALis acceptable;FLOATandDOUBLEare not, ever. TIMESTAMPin UTC, with fractional seconds where ordering matters.DATETIMEdoes not carry a time zone conversion; be deliberate about which you want.- Explicit
NOT NULL. MySQL is permissive by default; strict mode andNOT NULLcatch problems at write time.
Verify strict mode is on — without it, MySQL silently truncates data:
SELECT @@sql_mode; -- must include STRICT_TRANS_TABLES and NO_ENGINE_SUBSTITUTION
Indexing
The leftmost-prefix rule governs composite indexes: an index on (a, b, c)
serves a, (a, b) and (a, b, c), but not b alone.
-- Covering index: the query never touches the table
ALTER TABLE orders ADD KEY idx_cover (customer_id, created_at, status, total_minor);
EXPLAIN SELECT status, total_minor FROM orders
WHERE customer_id = 42 ORDER BY created_at DESC LIMIT 20;
-- Extra: Using index <- no lookup to the clustered index
Order composite index columns by: equality predicates first, then the range or sort column, then columns needed only for covering.
Things that silently disable an index:
WHERE DATE(created_at) = '2026-01-31' -- function on the column
WHERE customer_id = '42' -- string compared to an integer column
WHERE name LIKE '%dupont' -- leading wildcard
WHERE status != 'paid' -- low selectivity negation
Rewrite the first as a range: created_at >= '2026-01-31' AND created_at < '2026-02-01'.
Read plans with EXPLAIN ANALYZE (MySQL 8.0.18+), which reports actual rows and
time rather than estimates:
EXPLAIN ANALYZE SELECT … ;
EXPLAIN FORMAT=JSON SELECT … ; -- cost details, used keys, filtering ratios
Finding Slow Queries
-- Enable capture
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 0.5;
SET GLOBAL log_queries_not_using_indexes = 'ON';
-- Or query performance_schema, which needs no log parsing
SELECT DIGEST_TEXT,
COUNT_STAR AS calls,
ROUND(SUM_TIMER_WAIT/1e12, 2) AS total_s,
ROUND(AVG_TIMER_WAIT/1e9, 2) AS avg_ms,
SUM_ROWS_EXAMINED / NULLIF(SUM_ROWS_SENT, 0) AS examined_per_row
FROM performance_schema.events_statements_summary_by_digest
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 20;
examined_per_row is the most useful single number: a high ratio means the query
is scanning to produce few rows, which is an index problem.
Locking and Deadlocks
SHOW ENGINE INNODB STATUS\G -- LATEST DETECTED DEADLOCK section
SELECT r.trx_id, r.trx_mysql_thread_id, r.trx_query AS waiting_query,
b.trx_id AS blocking_trx, b.trx_query AS blocking_query
FROM performance_schema.data_lock_waits w
JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_engine_transaction_id
JOIN information_schema.innodb_trx b ON b.trx_id = w.blocking_engine_transaction_id;
Deadlocks are normal under concurrency; the application must retry them. Reduce
their frequency by acquiring locks in a consistent order, keeping transactions
short, and avoiding a SELECT … FOR UPDATE that scans more rows than it needs.
Online Schema Change
ALTER TABLE on a large table can block writes for a long time. Check the
algorithm before running it in production.
ALTER TABLE orders ADD COLUMN note VARCHAR(255),
ALGORITHM=INPLACE, LOCK=NONE; -- fails loudly if it cannot be online
Specifying ALGORITHM and LOCK explicitly is the safety mechanism: MySQL
refuses rather than silently falling back to a blocking copy.
For operations MySQL cannot do online, use a copy tool:
pt-online-schema-change \
--alter "MODIFY COLUMN total_minor BIGINT NOT NULL" \
--max-lag 2 --critical-load Threads_running=64 \
--chunk-time 0.5 --execute \
D=shop,t=orders
These tools create a shadow table, copy in chunks with triggers keeping it
current, then swap. Always run with --dry-run first, and confirm foreign keys
are handled the way you expect.
Replication
SHOW REPLICA STATUS\G
-- Seconds_Behind_Source, Replica_IO_Running, Replica_SQL_Running, Last_Error
Use GTID replication and row-based binary logging: together they make failover and position tracking tractable.
[mysqld]
gtid_mode = ON
enforce_gtid_consistency = ON
binlog_format = ROW
binlog_row_image = MINIMAL
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
The last two are the durability pair. Relaxing them improves write throughput and means a crash can lose committed transactions — a deliberate trade-off, never a default.
Replicas are asynchronous by default: a read immediately after a write may not see it. Route read-after-write to the primary, or use semi-synchronous replication when the application cannot tolerate the lag.
Best Practices
- Enable strict mode. Silent truncation is worse than an error.
utf8mb4everywhere — table, column, connection.- Narrow, monotonic primary keys. Random UUIDs as clustered keys fragment large tables badly.
- Read the plan before adding an index, and drop unused indexes; each one taxes every write.
- Keep transactions short. Long transactions hold undo history and bloat the tablespace.
- Retry deadlocks in the application with backoff.
- Test backups by restoring them. An untested backup is a hypothesis.
- Pin the SQL mode and time zone in configuration, not per session.
Anti-Patterns
utf8instead ofutf8mb4— the classic emoji-truncation bug.FLOATorDOUBLEfor money.- UUIDv4 as clustered primary key on a large, write-heavy table.
SELECT *— defeats covering indexes and breaks on schema change.- Functions on indexed columns in predicates.
ORDER BY RAND()— sorts the whole result set.- Offset pagination at depth —
LIMIT 20 OFFSET 100000scans 100 020 rows. Use keyset pagination. - Blocking
ALTERin production without checking the algorithm.
Reference Documentation
- Operations — configuration, backup and recovery, replication topologies, failover, monitoring queries and capacity signals
Resources
- MySQL 8.0 Reference Manual
- MariaDB Knowledge Base
- Percona Toolkit
- Baron Schwartz et al., High Performance MySQL (4th ed.)
- Use The Index, Luke