diagnose_replication_lag
What it does
This skill checks the health of a database replica that copies data from another server. It is for database admins who need to know if the copy is lagging or has stopped.
When to use it
- ✓When your replica database seems to be showing old data.
- ✓When replication may have stopped and you need the error explained.
- ✓When you want to check how far behind a replica is.
Skill link
https://github.com/major/MySQLTuner-perl/blob/master/.agent/skills/diagnose-replication-lag/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Check whether my MySQL replica is behind the main server and tell me if any replication thread has failed.”
5 new skills a week. 1 minute to read.
How it works
The agent reads the replica's status with read-only commands, checks that the replication threads are running, measures the delay, and reports the exact error when a thread has failed.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
AI Skill: Database Replication Latency & Health Diagnostics
🧠 Purpose & Operational Objectives
The diagnose_replication_lag skill allows AI agents to monitor binary log transport latency, parallel worker thread concurrency, and replication thread failures in master-replica and multi-source topologies.
📋 Preconditions & Context
- Server configured as a MySQL or MariaDB replica/slave node.
- Read-only queries executed (
SHOW REPLICA STATUSorSHOW SLAVE STATUS). - Compatible with legacy (
SLAVE) and modern (REPLICA) keywords.
🛠️ Input Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
max_acceptable_lag_seconds |
integer | No | 30 |
Threshold in seconds above which replication is considered degraded. |
channel_name |
string | No | "" |
Multi-source replication channel identifier (optional). |
📊 Status Evaluation
- NOT_A_REPLICA: No replication configuration detected on the instance.
- THREAD_FAILED:
Slave_IO_Running != 'Yes'orSlave_SQL_Running != 'Yes'. Returns exact SQL/IO error code and message. - DEGRADED_LAG: Threads running, but
Seconds_Behind_Master > max_acceptable_lag_seconds. - HEALTHY: Both threads running and latency within acceptable bounds.
🛡️ Guardrails & Remediation
- Automatically suggests parallel worker thread tuning (
replica_parallel_workers,replica_parallel_type = 'LOGICAL_CLOCK') to absorb heavy write streams. - Provides rollback commands for all global variables.
FAQ
Does this skill change the replica?
No. It only reads the status and does not change anything.
What does lag mean here?
It is how many seconds the replica is behind the main server, compared with a limit you set.
Does it work with multiple sources?
Yes. It can check a specific replication channel when you name one.
Details
Original description by the author
Diagnoses MySQL and MariaDB replication latency, IO/SQL thread failures, GTID synchronization, and parallel worker saturation.
repo: major/MySQLTuner-perl
Popularity
- GitHub stars
- 9.5k
- Ranking position
- #12279
- License
- GPL-3.0
- Updated
- 10/28/2026
Comments
- …
More skills from this repository
analyze_buffer_pool
9.5kHelps your database agent check how well MySQL or MariaDB uses its InnoDB memory cache, spot disk write stalls and suggest a sensible buffer pool size.
cli-execution-mastery
9.5kHelps your agent run the MySQLTuner health check with the right connection and login options, for local, remote or container databases.
detect_fragmented_tables
9.5kHelps your agent find database tables that waste disk space through fragmentation, and suggest safe ways to reclaim it, with notes on how much each cleanup affects the server.
Similar skills
discrawl
394kLets your agent search and summarize a saved local archive of Discord messages, check how fresh it is, and read direct messages.
clickhouse-io
280kHelps your agent optimize queries and schemas in ClickHouse databases. It applies best practices for high-performance analytical workloads. Use when analytical queries are too slow.
scientific-db-pubmed-database
280kHelps your agent search for scientific articles in the biomedical field. It's useful for research needing specific medical information.