diag-mysql-replication

diag-mysql-replication is a skill for Claude Code, Codex from seed-forge/harness-ai-kit. It costs 70 tokens per session (1,347 once invoked), scanned A, original, Apache-2.0.

A diagnostic runbook for MySQL replication, where one server copies data from another. It checks asynchronous, semi-synchronous, and GTID-based replication.

In plain words
What is it for?
Use it to investigate replication lag, read/write-splitting inconsistencies, or routine replication health checks. It produces a structured report with likely causes and repair suggestions.
Why use it?
It helps explain why a replica falls behind or shows different data from the primary. It traces delays to transactions, networks, server load, binary-log format, or parallel-replication settings.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to investigate replication lag, read/write-splitting inconsistencies, or routine replication health checks. It produces a structured report with likely causes and repair suggestions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/seed-forge/harness-ai-kit/diag-mysql-replication
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 seed-forge/harness-ai-kit --skill diag-mysql-replication
Clone the repo
git clone --depth 1 https://github.com/seed-forge/harness-ai-kit

Made for: Claude Code, Codex.

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 diag-mysql-replication

README.md
[![agentmods](https://agentmods.dev/badge/skills/seed-forge/harness-ai-kit/diag-mysql-replication/github.svg)](https://agentmods.dev/skills/seed-forge/harness-ai-kit/diag-mysql-replication)
Your own site
<a href="https://agentmods.dev/skills/seed-forge/harness-ai-kit/diag-mysql-replication"><img src="https://agentmods.dev/badge/skills/seed-forge/harness-ai-kit/diag-mysql-replication/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 diag-mysql-replication

Your own site · 80×15
<a href="https://agentmods.dev/skills/seed-forge/harness-ai-kit/diag-mysql-replication"><img src="https://agentmods.dev/badge/skills/seed-forge/harness-ai-kit/diag-mysql-replication.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,347 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00070 $0.01347
Opus 5 $0.00035 $0.00674
Sonnet 5 $0.00014 $0.00269
Haiku 4.5 $0.00007 $0.00135

Measured 10d ago against content hash 3206c63ce042, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

diag-mysql-replication 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 10d 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/diag-mysql-replication/SKILL.md · 178 lines

How it starts

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

MySQL Replication Lag Full-Chain Diagnostics

用途

当用户报告主从延迟、读写分离数据不一致、或定期复制健康巡检时触发。

本技能是自包含诊断 Runbook

输入

  • 主库和从库的 MySQL 连接信息
  • 可选:已知延迟时间段或特定大事务

输出

  • 复制延迟分析报告(填充输出模板)
  • 延迟根因 + 修复建议

前置条件

要求
权限 REPLICATION CLIENT, PROCESS
版本 MySQL 5.7+(8.0+ 优先用 performance_schema replication 表)

诊断步骤

Step 1: 检查复制状态

-- 从库上执行
SHOW REPLICA STATUS\G          -- MySQL 8.0.22+
SHOW SLAVE STATUS\G            -- MySQL 5.7 / 8.0 < 8.0.22

-- 关键字段
-- Seconds_Behind_Source: 延迟秒数(NULL 表示复制中断)
-- Replica_IO_Running / Replica_SQL_Running: 线程是否正常
-- Last_Error / Last_SQL_Error: 最近的错误信息
-- Retrieved_Gtid_Set / Executed_Gtid_Set: GTID 进度

Step 2: 对比主从 GTID / Position

-- 主库
SHOW MASTER STATUS;
-- 或 MySQL 8.0+
SHOW BINARY LOG STATUS;

-- 从库
SHOW REPLICA STATUS\G
-- 比较 Master_Log_File/Read_Master_Log_Pos 与 Executed_Gtid_Set

Step 3: 检查从库 SQL 线程瓶颈

-- 从库当前执行的 SQL
SHOW PROCESSLIST;

-- 大事务检测(从库 relay log 中的大事务)
SELECT * FROM performance_schema.events_transactions_summary_by_thread_by_event_name
WHERE EVENT_NAME LIKE 'transaction%'
ORDER BY COUNT_STAR DESC LIMIT 10;

-- 从库并行复制状态(8.0+)
SELECT * FROM performance_schema.replication_applier_status_by_worker;

Step 4: 检查复制配置

-- 复制模式
SHOW VARIABLES LIKE 'rpl_semi_sync%';
SHOW VARIABLES LIKE 'slave_parallel_type';      -- LOGICAL_CLOCK / WRITESET
SHOW VARIABLES LIKE 'slave_parallel_workers';
SHOW VARIABLES LIKE 'binlog_format';            -- ROW / MIXED / STATEMENT
SHOW VARIABLES LIKE 'sync_binlog';
SHOW VARIABLES LIKE 'innodb_flush_log_at_trx_commit';

Step 5: 检查网络与 IO 延迟

-- 从库 IO 线程状态
SHOW REPLICA STATUS\G
-- 关注 Slave_IO_State: "Waiting for source to send event" 可能表示网络问题
-- 关注 Slave_SQL_State: "Reading event relay log" vs "Waiting for dependent transaction"

输出模板

MySQL Replication Lag Analysis Report
════════════════════════════════════════
Master:        {master_host}:{master_port}
Replica:       {replica_host}:{replica_port}
Analysis Time: {timestamp}

Replication Status
  IO Thread:    {io_running} (state: {io_state})
  SQL Thread:   {sql_running} (state: {sql_state})
  Lag:          {seconds_behind}s
  Last Error:   {last_error}

GTID Progress
  Master:   {master_gtid_set}
  Replica:  {replica_gtid_set}
  Gap:      {gtid_gap_description}

Configuration
  Binlog Format:    {binlog_format}
  Parallel Workers: {parallel_workers} ({parallel_type})
  Semi-Sync:        {semi_sync_status}
  sync_binlog:      {sync_binlog}
  flush_log_at_trx: {flush_log_at_trx}

Bottleneck Analysis
  {bottleneck_analysis}

Root Cause
  {root_cause}

Recommendations
  1. [Config] {config_fix}
  2. [SQL]    {sql_fix}
  3. [Infra]  {infra_fix}

Read the full file on GitHub · 178 lines

Files

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.

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. 10d ago First seen · 178 lines · 70 tokens per session scan A 3206c63ce042

Subscribe to this mod's changes

diag-mysql-replication is a skill published in the GitHub repository seed-forge/harness-ai-kit (22 stars, last pushed 9d ago), licensed Apache-2.0. It adds 70 tokens to every session and 1,347 once invoked, about $0.0003 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-08-30.

Related

Other skills, from other repositories

backend-db-performance

Optimize slow queries, indexes, and N+1s. Use when "slow query", "database performance", "add an index", or "N+1". Schema consistency → audit-db-schema. RLS access control → plan-rls-audit.

kensaurus/cursor-kenji · 56 tokens

sql-optimization-patterns

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

wshobson/agents · 44 tokens

debugging

Runs a hypothesis-driven debugging loop across any language or binary, escalating to orthogonal oracle angles and locking the fix with a failing test. Use for crashes, silent failures, hangs, wrong responses, memory leaks, async misbehavior, or reverse engineering.

code-yeongyu/oh-my-openagent · 53 tokens

lcx-report-bug

Create a high-signal bug issue or PR in the repo that owns the defect. Use this whenever the user asks to report, file, open, or triage a LazyCodex, lazycodex-ai, omo-codex, Codex plugin, or upstream Codex CLI bug, especially when they need source-backed root cause, reproduction steps, fix guidance, and GitHub routing.

code-yeongyu/oh-my-openagent · 85 tokens

ast-grep

Searches and rewrites code by AST shape across 25 languages. Use when the target is a syntax pattern (every call/class/import shaped like X, a codemod, a YAML rule) rather than literal text; for plain strings, comments, or filenames, use rg.

code-yeongyu/oh-my-openagent · 61 tokens

remove-deadcode

Remove unused code from this project with ultrawork mode, LSP-verified safety, atomic commits. Triggers: remove dead code, dead code, cleanup, remove unused.

code-yeongyu/oh-my-openagent · 41 tokens