Use this skill whenever the user needs to operate or troubleshoot a PostgreSQL server/cluster as a DBA — a one-shot cluster health overview; server reads (version/uptime, settings, extensions, databases, roles); activity (sessions, idle-in-transaction, long-running queries, locks); query stats (pg_stat_statements top-N, EXPLAIN a statement); index health (unused indexes, missing-index hints, bloat, invalid/duplicate); table health (sizes, dead-tuple bloat, autovacuum status); replication (standby lag, replication slots, WAL); three flagship analyses — slow-query RCA (worst pg_stat_statements entry + EXPLAIN → cause/action), bloat & vacuum analysis (dead tuples + autovacuum lag → recommendation), and blocking lock-chain RCA (build the wait-for tree, name the root blocker); and guarded writes (terminate a backend, cancel a query, VACUUM/ANALYZE, create/drop an index, REINDEX, ALTER SYSTEM SET a parameter, reset query stats). Always use this skill for "postgres health check", "why is this
记忆
mysql-aiops
试用Use this skill whenever the user needs to operate or troubleshoot a MySQL 8.x or MariaDB 10.6+ server as a DBA — a one-shot server health overview (version + flavor, connection headroom, replica role); server reads (global variables, status counters, databases, storage engines); activity (sessions/processlist, long-running queries, open InnoDB transactions, lock waits); query stats (performance_schema statement-digest top-N, EXPLAIN FORMAT=JSON); index health (unused indexes, redundant/duplicate indexes, cardinality); table health (sizes, data_free fragmentation, engine/row-format status); replication (replica IO/SQL thread state and lag, binlog/GTID status); four flagship analyses — slow-query RCA (worst digest + EXPLAIN → cited cause/action incl. full-scan and lock-time-dominant classification), InnoDB lock-wait & deadlock chain RCA (wait-for tree, root blocker, last deadlock parsed from SHOW ENGINE INNODB STATUS), replication lag RCA (thread state/error fields → cause+action), and t
它能做什么
Use this skill whenever the user needs to operate or troubleshoot a MySQL 8.x or MariaDB 10.6+ server as a DBA — a one-shot server health overview (version + flavor, connection headroom, replica role); server reads (global variables, status counters, databases, storage engines); activity (sessions/processlist, long-running queries, open InnoDB transactions, lock waits); query stats (performance_schema statement-digest top-N, EXPLAIN FORMAT=JSON); index health (unused indexes, redundant/duplicate indexes, cardinality); table health (sizes, data_free fragmentation, engine/row-format status); replication (replica IO/SQL thread state and lag, binlog/GTID status); four flagship analyses — slow-query RCA (worst digest + EXPLAIN → cited cause/action incl. full-scan and lock-time-dominant classification), InnoDB lock-wait & deadlock chain RCA (wait-for tree, root blocker, last deadlock parsed from SHOW ENGINE INNODB STATUS), replication lag RCA (thread state/error fields → cause+action), and table fragmentation analysis (data_free → OPTIMIZE candidates); and guarded writes (kill a session or query, OPTIMIZE/ANALYZE TABLE, create/drop an index, SET GLOBAL a variable, reset digest stats). Always use this skill for "mysql health check", "why is this query slow", "top queries by time", "EXPLAIN this", "table fragmentation", "which indexes are unused", "redundant index", "who is blocking whom", "deadlock", "kill the session holding the lock", "replication lag", "replica stopped", "seconds behind master/source", "OPTIMIZE this table", "create/drop an index", or "SET GLOBAL max_connections" when the context is a MySQL or MariaDB database. Do NOT use for PostgreSQL — use postgres-aiops. Do NOT use when the target is OT / industrial equipment (use industrial-aiops), a hypervisor, a storage appliance, a backup product, or a container/cluster orchestrator (negative routing hints only). Common MySQL/MariaDB DBA operations with a built-in governance harness (audit, policy, token budget,
技能文档
MySQL AIops
Disclaimer: Community-maintained open-source project, not affiliated with, endorsed by, or sponsored by Oracle Corporation or the MariaDB Foundation. "MySQL" and "MariaDB" trademarks belong to their owners. Source at github.com/AIops-tools/MySQL-AIops under the MIT license.
Governed MySQL / MariaDB DBA operations — 35 MCP tools, every one wrapped with the bundled @governed_tool harness: a local unified audit log under ~/.mysql-aiops/, token/runaway budget guard, undo-token recording, and descriptive risk-tier labels. The account password is stored encrypted (~/.mysql-aiops/secrets.enc, Fernet + scrypt) — never plaintext on disk.
Standalone: the governance harness is bundled in the package (
mysql_aiops.governance) — mysql-aiops has no external skill-family dependency. Behaviour is covered by a mock-based test suite;docs/VERIFICATION.mdis the checklist for a live run against a real MySQL / MariaDB server.
What This Skill Does
| Domain | Tools | Count | Read or Write |
|---|---|---|---|
| Overview | server health snapshot (version+flavor, connections, replica role) | 1 | 1 read |
| Server | version+flavor, variables, status, databases, engines, connection stats | 6 | 6 read |
| Activity | sessions, long-running queries, transactions, lock waits | 4 | 4 read |
| Queries | top-N statement digests, EXPLAIN FORMAT=JSON | 2 | 2 read |
| Indexes | unused, redundant/duplicate, cardinality stats | 3 | 3 read |
| Tables | sizes, data_free fragmentation, engine/row-format status | 3 | 3 read |
| Replication | replica status/lag, binlog/GTID | 2 | 2 read |
| Analysis (flagship) | slow-query RCA, lock-wait & deadlock RCA, replication-lag RCA, fragmentation | 4 | 4 read |
| Writes | kill-session, kill-query, drop-index | 3 | 3 write (high) |
| optimize, analyze-table, create-index, SET GLOBAL, reset-stats | 5 | 5 write (medium) | |
| Undo | undo list, undo apply | 2 | 1 read / 1 write |
The flagship analyses accept injected records for pure/offline analysis, or pull live from a configured target. top_queries / slow_query_rca require performance_schema=ON; the read account should have PROCESS, REPLICATION CLIENT and SELECT on performance_schema.
Quick Install
uv tool install mysql-aiops
mysql-aiops init # interactive wizard: connection + encrypted password
mysql-aiops doctor # connectivity + flavor + performance_schema + replica role
When to Use This Skill
- Triage a server (
overview): version + flavor, uptime, connection headroom, sessions by command, longest query, most fragmented table, replica role - Root-cause a slow query (
analyze slow-query/slow_query_rca): the worst statement digest + EXPLAIN → cited cause and action (full scan, lock-time dominant, tmp-disk spill, N+1) - Untangle a lock pile-up or deadlock (
analyze lock-waits/lock_wait_rca): the wait-for tree with the root blocker named + the last deadlock parsed fromSHOW ENGINE INNODB STATUS - Diagnose replication (
analyze replication/replication_lag_rca): IO/SQL thread state,Seconds_Behind_Source, error fields → cause + action - Decide what to OPTIMIZE (
analyze fragmentation/fragmentation_analysis): tables ranked by reclaimabledata_free - Find unused / redundant indexes; check table sizes and engines; inspect binlog/GTID state
- Kill a session or its query, OPTIMIZE/ANALYZE a table, create/drop an index (reversible), or SET GLOBAL a variable — all with dry-run + double-confirm
Do NOT use for PostgreSQL — use postgres-aiops. Do NOT use when the target is OT/industrial equipment (use industrial-aiops), a hypervisor, a storage appliance, a backup product, or a container cluster.
Related Skills — Skill Routing
| If the user wants… | Use |
|---|---|
| MySQL / MariaDB DBA-ops: slow queries, lock waits, replication, fragmentation | mysql-aiops (this skill) |
| PostgreSQL DBA-ops | postgres-aiops |
| OT / industrial edge (Modbus, OPC-UA, PLC, PROFINET) | the industrial-aiops line |
| Hypervisor VM lifecycle (power, snapshot, migrate) | a hypervisor ops skill |
| Container/cluster lifecycle | a cluster ops skill |
Common Workflows
1. "The application is slow" — from complaint to a working index
mysql-aiops doctor→ connectivity, detected flavor, and whetherperformance_schemais actually enabled (if it is off, the digest-based analysis below has nothing to read — fix that first).mysql-aiops overview→ one-shot: version, connection counts, buffer-pool and activity headline, so you know whether this is a query problem or a load problem.mysql-aiops analyze slow-query→ the worst statement digests, each with cited findings (full scan / no index used, lock time dominant, rows examined per row sent, tmp-table spill to disk, high call count) and a concrete action per finding.mysql-aiops query top --limit 20→ confirm the digest the RCA blamed really is the top consumer, not a one-off.mysql-aiops query explain ""→ read the actual plan.access_type: ALLon a large table is the signature that an index will help; a plan already using an index means the fix is elsewhere.mysql-aiops index unusedandmysql-aiops index redundant→ before adding one, check you are not duplicating an index that already exists (a redundant index costs writes and buys nothing).mysql-aiops remediate create-index --name idx_x --dry-run→ prints the exact DDL; re-run without--dry-run(double-confirm). The write is reversible and records an inversedrop_indexundo descriptor.- Re-run
mysql-aiops query explain ""andanalyze slow-queryto prove the plan changed and the digest dropped. - Failure branch: if the plan did not change, the optimizer may be working from
stale statistics —
mysql-aiops remediate analyze-tableand re-check. If the index made things worse (write amplification, or the optimizer picking it wrongly), reverse it:mysql-aiops undo list→mysql-aiops undo applydrops exactly the index that was created. Index DDL on a large table can be long-running — if it stalls,mysql-aiops activity long --min-seconds 60will show it, and cancelling mid-DDL is its own risk, so size the table withmysql-aiops table sizesbefore step 7.
2. A lock pile-up is stalling writes
mysql-aiops activity lock-waits→ the raw blocking/blocked pairs, straight from the server.mysql-aiops analyze lock-waits→ the wait-for tree resolved down to the root blocker session, with the last deadlock (victim + both statements) attached.mysql-aiops activity transactions→ what the root blocker is actually doing and how long it has been open. An idle-in-transaction blocker is an application bug, not a database one.mysql-aiops activity sessions --no-sleeping→ confirm the blocker's user, host, and statement before you touch it.- Cancel the statement, not the connection, if that is enough:
mysql-aiops remediate kill-query --dry-runthen for real (double-confirm). Escalate tomysql-aiops remediate killonly if the session must go. - Re-run
mysql-aiops analyze lock-waits→ the tree should be empty. - Failure branch:
killandkill-queryare irreversible — they record no undo, and killing a long-running transaction triggers a rollback that can itself take a long time and hold locks meanwhile. If the tree does not clear, do not kill more sessions in a loop (the runaway budget guard will stop you anyway): re-readactivity transactionsto see whether the rollback is in progress, and go after the application holding the transaction open instead.
3. A replica has fallen behind
mysql-aiops analyze replication→ the cited cause: IO thread stopped (with the realLast_IO_Error), SQL thread stopped (withLast_SQL_Error), applier simply lagging, or an intentionalSQL_Delay.mysql-aiops repl status→ the raw replica record, so you can see the seconds-behind value and thread states the analysis quoted. Note the tool branches on flavor automatically (SHOW REPLICA STATUSon MySQL,SHOW SLAVE STATUSon MariaDB).mysql-aiops repl binlog→ binlog position and retention, to judge whether the replica can still catch up or has fallen off the end of the logs.mysql-aiops overviewon the replica → check the lag is not just resource pressure masquerading as a replication fault.- Apply the cause-specific fix: connectivity/credentials for a stopped IO thread, the
diverged row for a stopped SQL thread, or parallel apply for a slow applier —
mysql-aiops remediate set slave_parallel_workers 4 --dry-runfirst (reversible; the prior value is captured as the undo descriptor). - Failure branch: an intentional
SQL_Delayis not a fault — the analysis says so, and "fixing" it defeats a deliberate safety window. If aSET GLOBALmade things worse,mysql-aiops undo applyrestores the prior value. If the replica has fallen off the retained binlogs, no setting will recover it — it needs a reseed, which is out of this tool's scope.
4. Reclaim space from a bloated table
mysql-aiops analyze fragmentation→ tables ranked by reclaimabledata_free, each citing the measured bytes.mysql-aiops table sizesandmysql-aiops table fragmentation→ confirm the size and free space independently, and see how big the rebuild will actually be.mysql-aiops index unused→ while you are here, an index nothing has used is dead weight;mysql-aiops index statsshows the usage numbers behind that claim.mysql-aiops remediate drop-index --dry-runthen for real — the write rebuilds the index definition fromSHOW CREATE TABLEbefore dropping, so the undo descriptor recreates exactly the index that existed.mysql-aiops remediate optimize --dry-run→ preview, then re-run toOPTIMIZE TABLE(double-confirm).- Re-run
mysql-aiops analyze fragmentationto confirm the space came back. - Failure branch:
OPTIMIZE TABLErebuilds the table and can lock or block writes for the duration on a large table — run it in a maintenance window, and checkmysql-aiops activity longif the system goes quiet. It records no undo (there is nothing to reverse). If dropping the index turned out to be wrong,mysql-aiops undo applyrecreates it from the captured definition — this is the one step in this recipe that is reversible, which is why it comes before the OPTIMIZE.
Offline analysis (no live server)
Pass data straight to the analysis tools — slow_query_rca(statements=[...]), lock_wait_rca(pairs=[...]), replication_lag_rca(status={...}), or fragmentation_analysis(tables=[...]) — to analyse an exported dataset without connecting.
Governance & Safety
The skill delivers reads and writes and records them; it does not decide whether a write is permitted. That is your agent's judgement, or the permission of the account you connect it with (point it at a MySQL/MariaDB account granted only SELECT / PROCESS / REPLICATION CLIENT and no write privileges (no INSERT/UPDATE/DELETE/DDL) — writes then fail at the server). There is no read-only switch, policy file, or approval gate.
- Audit is the guarantee, and it is not bypassable. Every operation — MCP and CLI alike — is logged to
~/.mysql-aiops/audit.db(relocatable viaMYSQL_AIOPS_HOME): params, result, status, duration, and the risk tier. The CLI writes the same row the MCP path does. MYSQL_AUDIT_APPROVED_BY/MYSQL_AUDIT_RATIONALEare optional annotations recorded on the audit row (who/why); they are never required and never block.- Runaway guard — a safety backstop, not authorization: the same call looped in a tight window trips a circuit breaker. Disable with
MYSQL_RUNAWAY_MAX=0. - Writes support
--dry-run/dry_run=Trueand double confirmation at the CLI. - Reversible writes fetch the real before-state and record an inverse descriptor; irreversible ops (kill session/query, optimize/analyze, reset stats) record prior state only.
- All values are bound query parameters; identifiers that cannot be parameterised are validated and backtick-quoted.
References
references/capabilities.md— full tool + field referencereferences/cli-reference.md— CLI command referencereferences/setup-guide.md— onboarding, credentials, and connectivity
相关技能
Use this skill whenever the user needs to operate a GPU inference cluster — vLLM (OpenAI API + Prometheus /metrics) and Ray Serve / Ray Jobs (Ray dashboard), plus the single-process serving engines SGLang and TGI (Text Generation Inference): a one-shot cluster overview (deployments + total replicas + queue backpressure), request metrics (TTFT / TPOT / e2e latency + token totals), queue depth, KV-cache stats (utilisation, prefix-cache hit rate, preemptions), the flagship latency root-cause analysis (diagnose_latency_spike / diagnose_engine_latency) and low-utilisation RCA, engine-agnostic health + running-model inventory across vLLM/SGLang/TGI, Ray Serve autoscaling and scaling (scale up/down, scale-to-zero, drain a replica), LoRA load/unload, base-model hot-swap, deploy/undeploy/redeploy, prefix-aware routing, GPU utilisation, Ray jobs, and cost per million tokens. Always use this skill for "why is inference slow", "TTFT spike", "latency spike", "GPU underutilised", "scale down the dep
Use this skill whenever the user needs to operate a self-hosted observability stack on Prometheus (HTTP API + PromQL), Alertmanager, Grafana, or Grafana Loki (logs) — a one-shot overview, PromQL instant/range queries, label + series metadata, scrape-target health (up/down + why) and dropped targets, recording/alerting rule health, firing/pending alerts, Alertmanager alerts + silences, Grafana dashboards/datasources/folders, bounded Loki LogQL log reads (labels, query, error-tail), five flagship analyses (firing-alert RCA, target-scrape-health, alert-noise/flap, log-error-burst RCA, log-volume/cardinality) plus an alert->log cross-signal, and guarded writes (create/expire silence, create annotation, update/delete dashboard, reload Prometheus config). Always use this skill for "Prometheus", "PromQL", "Alertmanager", "Grafana", "Loki", "LogQL", "logs", "which targets are down", "scrape failing", "why is this alert firing", "root cause this alert", "firing alerts", "silence this alert", "n
用自然语言完成阿里云 PolarDB MySQL/PostgreSQL 集群的运维、巡检与诊断。
Use this skill whenever the user needs to operate a redis cache or a rabbitmq broker — a one-shot overview, redis memory posture (used vs maxmemory, eviction policy, fragmentation), SLOWLOG and a SCAN-budgeted big-key sample (never KEYS *), connected clients, CONFIG get/set, rabbitmq queues with backlog depth, connections/channels, policies and node watermark alarms, four flagship RCAs (redis memory pressure, redis latency/slowlog, rabbitmq queue backlog, connection churn on both platforms), and governed writes (set a config parameter, kill a client, declare/purge/delete a queue, set/delete a policy). Always use this skill for "redis", "rabbitmq", "maxmemory", "eviction", "evicted keys", "big key", "slowlog", "why is my cache slow", "queue backlog", "messages piling up", "no consumers", "unacked messages", "memory watermark", "connection churn", "purge a queue", "rabbitmq policy" when the context is a redis or rabbitmq deployment. Do NOT use when the target is something other than a re
Alibaba Cloud PolarDB/RDS MySQL historical lock wait root cause analysis skill. Diagnoses and analyzes historical lock wait issues, identifies the complete l...