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.
npx skills add seed-forge/harness-ai-kit --skill diag-mysql-deadlockgit clone --depth 1 https://github.com/seed-forge/harness-ai-kitWrote 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.
[](https://agentmods.dev/skills/seed-forge/harness-ai-kit/diag-mysql-deadlock)<a href="https://agentmods.dev/skills/seed-forge/harness-ai-kit/diag-mysql-deadlock"><img src="https://agentmods.dev/badge/skills/seed-forge/harness-ai-kit/diag-mysql-deadlock/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.
<a href="https://agentmods.dev/skills/seed-forge/harness-ai-kit/diag-mysql-deadlock"><img src="https://agentmods.dev/badge/skills/seed-forge/harness-ai-kit/diag-mysql-deadlock.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00099 | $0.01806 |
| Opus 5.5 | $0.00040 | $0.00722 |
| Sonnet 5.5 | $0.00020 | $0.00361 |
| Haiku 4.5 | $0.00010 | $0.00181 |
Grade A, and why
diag-mysql-deadlock 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 3mo 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.
How it starts
The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MySQL Deadlock Full-Chain Diagnostics
用途
当用户报告 MySQL 死锁或怀疑锁竞争时触发。覆盖:
- 应用日志出现
Error: 1213 Deadlock found - 监控发现
Innodb_deadlocks计数器持续增长 - 高峰期锁竞争排查
- Schema 变更后可能影响锁行为
本技能是自包含诊断 Runbook——所有 SQL、模式分类、输出模板、告警阈值都在本文件内,不依赖外部 references。
输入
- MySQL 连接信息(host / port / user / password)
- 可选:应用日志中的死锁片段
- 可选:已知的表结构和索引信息
输出
- 结构化死锁分析报告(填充输出模板)
- 根因判定 + 修复建议(SQL / 代码 / 配置三级)
前置条件
| 项 | 要求 |
|---|---|
| MySQL 权限 | PROCESS(查看线程和 InnoDB 状态) |
| 版本 | MySQL 5.6+(5.7+ 使用 performance_schema,5.6 回退 information_schema) |
诊断步骤
Step 1: 捕获死锁计数与最近状态
-- 死锁计数与锁等待指标
SHOW GLOBAL STATUS LIKE 'Innodb_deadlocks';
SHOW GLOBAL STATUS LIKE 'Innodb_row_lock_waits';
SHOW GLOBAL STATUS LIKE 'Innodb_row_lock_time_avg';
-- 完整 InnoDB 状态(包含 LATEST DETECTED DEADLOCK 区块)
SHOW ENGINE INNODB STATUS;
Step 2: 检查当前锁等待(MySQL 5.7+)
-- 谁阻塞了谁
SELECT
waiting_trx.trx_id AS waiting_trx,
blocking_trx.trx_id AS blocking_trx,
waiting_trx.trx_state AS wait_state,
waiting_trx.trx_started AS wait_started,
LEFT(waiting_trx.trx_query, 200) AS wait_query,
LEFT(blocking_trx.trx_query, 200) AS block_query
FROM performance_schema.data_lock_waits w
JOIN information_schema.innodb_trx waiting_trx ON w.requesting_engine_transaction_id = waiting_trx.trx_id
JOIN information_schema.innodb_trx blocking_trx ON w.blocking_engine_transaction_id = blocking_trx.trx_id;
-- MySQL 5.6 回退:
SELECT * FROM information_schema.innodb_trx ORDER BY trx_started;
Step 3: 查找长事务
-- 运行超过 60 秒的事务
SELECT
trx_id, trx_state, trx_started,
TIMESTAMPDIFF(SECOND, trx_started, NOW()) AS duration_sec,
trx_tables_locked, trx_rows_locked,
LEFT(trx_query, 200) AS current_query
FROM information_schema.innodb_trx
WHERE TIMESTAMPDIFF(SECOND, trx_started, NOW()) > 60
ORDER BY trx_started;
Step 4: 判定死锁模式
从 SHOW ENGINE INNODB STATUS 的 LATEST DETECTED DEADLOCK 区块提取并分类:
| 模式 | 特征 | 典型修复 |
|---|---|---|
| AB-BA | 事务 A 锁行1→行2,B 锁行2→行1 | 统一访问顺序 |
| Gap Lock | Next-key lock 在索引间隙上 | 缩小扫描范围、使用 RC 隔离级别 |
| FK Cascade | 外键触发级联锁 | 在 FK 列上加索引 |
| Auto-Inc | 并发 insert 竞争自增锁 | innodb_autoinc_lock_mode=2 |
| Lock Upgrade | S-lock 升级为 X-lock | 缩小事务范围 |
What ships with it
3 files 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.
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.
- 3mo ago First seen · 203 lines · 99 tokens per session scan A 5403ace8f411
diag-mysql-deadlock is a skill published in the GitHub repository seed-forge/harness-ai-kit (26 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 99 tokens to every session and 1,806 once invoked, about $0.0004 per session on Opus 5.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-08-30.
diag-mysql-deadlock compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| diag-mysql-deadlockseed-forge/harness-ai-kit | Skill | 26 | 3mo ago | Apache-2.0 | A | 99 | Claude Code, Codex |
| sql-optimization-patternswshobson/agents | Skill | 43k | 2d ago | MIT | A | 44 | Claude Code |
| rescuesuboss87/FDEOps | Skill | 776 | yesterday | MIT | A | 48 | Claude Code, Codex |
| lcx-report-bugcode-yeongyu/oh-my-openagent | Skill | 71k | today | none | A | 85 | Codex |
| ast-grepcode-yeongyu/oh-my-openagent | Skill | 71k | today | none | A | 61 | Claude Code, Codex |
| debuggingcode-yeongyu/oh-my-openagent | Skill | 71k | today | none | A | 53 | Claude Code, Codex |
| lcx-doctorcode-yeongyu/oh-my-openagent | Skill | 71k | today | none | A | 93 | Codex |