/diagnose-clickhouse-clusters
Diagnose ClickHouse cluster health and provide concrete remediation.
$ npx -y skills add FrankChen021/datastoria --skill diagnose-clickhouse-clusters --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition โ
- You can call itInvoke it directly when you want it.
- Slash command
/diagnose-clickhouse-clusters
Context preview
The summary Claude sees to decide when to auto-load this skill.
Diagnose ClickHouse cluster health and provide concrete remediation.
SKILL.md
diagnose-clickhouse-clusters.SKILL.mdname: diagnose-clickhouse-clusters
description: Diagnose ClickHouse cluster health and provide concrete remediation.
Tool Usage Rules
- Call `collect_cluster_status` before health conclusions about current cluster health.
- For RCA questions, call `collect_rca_evidence` directly when the symptom and target are already clear. Use `collect_cluster_status` first only when you need current health context, severity/outliers, or help choosing the RCA symptom/scope.
- Use only supported Phase 1 RCA symptoms: `high_part_count` and `unknown`.
- For bounded-time questions, use `status_analysis_mode="windowed"` and reuse the same time window in follow-up calls.
- If user asks for a chart, use the `visualization` skill. Do not emit chart specs directly from this skill.
- Do not invent custom health-check SQL. Use tool outputs as the source of truth.
Workflow (MANDATORY)
1. Determine whether the user asks for status only, or root cause ("why", "root cause", "reason", "caused by", "explain"). 2. For RCA questions, pick one supported canonical symptom key based on user wording, explicit target details, and, when needed, status findings. 3. Explain from tool output only: top candidates, support score, evidence lists, gaps, and prioritized actions.
Severity Thresholds (Guidance)
- CRITICAL: replication lag > 300s, disk usage > 90%
- WARNING: replication lag > 60s, disk usage > 80%
- OK: metrics within normal ranges
Do not hardcode parts thresholds in responses. Use the thresholds and severities returned by `collect_cluster_status`.
Output Format (MANDATORY)
Use one of these two formats:
A) Status-only question
1. Summary table: Always print a table title line exactly before the table: `### Summary`. | Status | Nodes with Issues | Checks Run | Timestamp | |--------|-------------------|------------|-----------| | ๐ข OK / ๐ WARNING / ๐ด CRITICAL | N | categories | ISO8601 | 2. Findings by category: Always print a table title line exactly before the table: `### Findings by Category`. Use a markdown table (not bullets) with one row per category. Required columns: | Category | Status | Key Metrics | Top Outlier / Scope | Notes | |----------|--------|-------------|----------------------|-------| | parts / errors / replication / ... | ๐ข OK / ๐ WARNING / ๐ด CRITICAL | concise metric values with thresholds | node/table if present, else `-` | one short phrase |
Table rules:
- Include all categories returned by `collect_cluster_status` in stable order.
- Status must include both emoji and text (for example `๐ WARNING`), never emoji-only.
- Markdown table cells do not reliably support line breaks in this UI. Do not try to render multi-line bullets in a cell.
- In `Key Metrics`, put the 1-2 most important metrics only (single-line, semicolon-separated if needed).
- Put additional metrics in `Notes` as compact key/value items (single-line).
- Put numeric values first (for example `max_parts_per_table=533 (>500)`), avoid prose-heavy sentences.
- Always wrap database/table identifiers in backticks (for example `` `db.table` `` or `` `db` ``) in all table cells.
- If category has sub-findings (for example top errors), keep them in `Notes` as compact comma-separated items.
- If no outlier exists, set `Top Outlier / Scope` to `-`.
3. Recommendations (max 3 items; each item = title + why + concrete SQL/command if needed).
B) RCA question ("why", "cause", "reason", "explain")
Use compact structure only:
1. **RCA Verdict**: one sentence, max 30 words. 2. **Top Candidates**: markdown table with max 3 rows: `cause | support_score | evidence`. In `evidence`, render up to 3 `evidence_for` items prefixed with `โ` and up to 2 `evidence_against` items prefixed with `โ`, separated by `<br/>`. When `excluded_candidates` is non-empty, include at least one excluded reason as a `โ` item for the most relevant row. Evidence fidelity rules:
- Use only `candidate.evidence_for` and `candidate.evidence_against` from `collect_rca_evidence` for that row.
- Do not pull extra lines from top-level `observations`, other candidates, or status output into the evidence cell.
- Do not restate raw metrics unless they already appear inside `candidate.evidence_for` or `candidate.evidence_against`.
- Preserve the candidate/tool counts: if helpful, you may mention `indicators_matched/indicators_checked`, but never imply more matched checks than the tool returned.
3. **Possible Actions**: max 3 numbered items, sorted by impact. Formatting rule: print the line `3. **Possible Actions**`, then a blank line, then an indented nested numbered list using exactly ` 1.`, ` 2.`, ` 3.`. Do not continue the outer top-level numbering for action items. 4. **Gaps / Next Checks**: max 2 bullets. Formatting rule: print the line `4. **Gaps / Next Checks**`, then a blank line, then indented bullets using exactly ` -`.
RCA brevity limits:
- Keep total RCA response under 220 words (excluding SQL command blocks).
- Do not add long background/theory paragraphs.
- Use direct statements and numeric evidence.
Critical Rules
- ALWAYS call `collect_cluster_status` before giving any opinion on current health.
- Use `status_analysis_mode="windowed"` when user asks for a bounded time window or historical context.
- For RCA questions, MUST call `collect_rca_evidence`. `collect_cluster_status` is optional unless current health context is needed.
- Do NOT state root causes without RCA evidence output.
- If `gaps[]` is non-empty, explicitly state what evidence is missing.
- If all candidates have `support_score < 0.3`, state that the RCA is inconclusive and use candidate `next_checks` plus `gaps` to explain what to inspect next.
- If best candidate is weak (`0.30-0.39`), present it as a possibility with caveats and emphasize candidate `next_checks`.
- Never fabricate or merge evidence lines across candidates. Candidate rows must be traceable directly
Read more
name: diagnose-clickhouse-clusters description: Diagnose ClickHouse cluster health and provide concrete remediation.
Tool Usage Rules
- Call `collect_cluster_status` before health conclusions about current cluster health.
- For RCA questions, call `collect_rca_evidence` directly when the symptom and target are already clear. Use `collect_cluster_status` first only when you need current health context, severity/outliers, or help choosing the RCA symptom/scope.
- Use only supported Phase 1 RCA symptoms: `high_part_count` and `unknown`.
- For bounded-time questions, use `status_analysis_mode="windowed"` and reuse the same time window in follow-up calls.
- If user asks for a chart, use the `visualization` skill. Do not emit chart specs directly from this skill.
- Do not invent custom health-check SQL. Use tool outputs as the source of truth.
Workflow (MANDATORY)
1. Determine whether the user asks for status only, or root cause ("why", "root cause", "reason", "caused by", "explain"). 2. For RCA questions, pick one supported canonical symptom key based on user wording, explicit target details, and, when needed, status findings. 3. Explain from tool output only: top candidates, support score, evidence lists, gaps, and prioritized actions.
Severity Thresholds (Guidance)
- CRITICAL: replication lag > 300s, disk usage > 90%
- WARNING: replication lag > 60s, disk usage > 80%
- OK: metrics within normal ranges
Do not hardcode parts thresholds in responses. Use the thresholds and severities returned by `collect_cluster_status`.
Output Format (MANDATORY)
Use one of these two formats:
A) Status-only question
1. Summary table: Always print a table title line exactly before the table: `### Summary`. | Status | Nodes with Issues | Checks Run | Timestamp | |--------|-------------------|------------|-----------| | ๐ข OK / ๐ WARNING / ๐ด CRITICAL | N | categories | ISO8601 | 2. Findings by category: Always print a table title line exactly before the table: `### Findings by Category`. Use a markdown table (not bullets) with one row per category. Required columns: | Category | Status | Key Metrics | Top Outlier / Scope | Notes | |----------|--------|-------------|----------------------|-------| | parts / errors / replication / ... | ๐ข OK / ๐ WARNING / ๐ด CRITICAL | concise metric values with thresholds | node/table if present, else `-` | one short phrase |
Table rules:
- Include all categories returned by `collect_cluster_status` in stable order.
- Status must include both emoji and text (for example `๐ WARNING`), never emoji-only.
- Markdown table cells do not reliably support line breaks in this UI. Do not try to render multi-line bullets in a cell.
- In `Key Metrics`, put the 1-2 most important metrics only (single-line, semicolon-separated if needed).
- Put additional metrics in `Notes` as compact key/value items (single-line).
- Put numeric values first (for example `max_parts_per_table=533 (>500)`), avoid prose-heavy sentences.
- Always wrap database/table identifiers in backticks (for example `` `db.table` `` or `` `db` ``) in all table cells.
- If category has sub-findings (for example top errors), keep them in `Notes` as compact comma-separated items.
- If no outlier exists, set `Top Outlier / Scope` to `-`.
3. Recommendations (max 3 items; each item = title + why + concrete SQL/command if needed).
B) RCA question ("why", "cause", "reason", "explain")
Use compact structure only:
1. **RCA Verdict**: one sentence, max 30 words. 2. **Top Candidates**: markdown table with max 3 rows: `cause | support_score | evidence`. In `evidence`, render up to 3 `evidence_for` items prefixed with `โ` and up to 2 `evidence_against` items prefixed with `โ`, separated by `<br/>`. When `excluded_candidates` is non-empty, include at least one excluded reason as a `โ` item for the most relevant row. Evidence fidelity rules:
- Use only `candidate.evidence_for` and `candidate.evidence_against` from `collect_rca_evidence` for that row.
- Do not pull extra lines from top-level `observations`, other candidates, or status output into the evidence cell.
- Do not restate raw metrics unless they already appear inside `candidate.evidence_for` or `candidate.evidence_against`.
- Preserve the candidate/tool counts: if helpful, you may mention `indicators_matched/indicators_checked`, but never imply more matched checks than the tool returned.
3. **Possible Actions**: max 3 numbered items, sorted by impact. Formatting rule: print the line `3. **Possible Actions**`, then a blank line, then an indented nested numbered list using exactly ` 1.`, ` 2.`, ` 3.`. Do not continue the outer top-level numbering for action items. 4. **Gaps / Next Checks**: max 2 bullets. Formatting rule: print the line `4. **Gaps / Next Checks**`, then a blank line, then indented bullets using exactly ` -`.
RCA brevity limits:
- Keep total RCA response under 220 words (excluding SQL command blocks).
- Do not add long background/theory paragraphs.
- Use direct statements and numeric evidence.
Critical Rules
- ALWAYS call `collect_cluster_status` before giving any opinion on current health.
- Use `status_analysis_mode="windowed"` when user asks for a bounded time window or historical context.
- For RCA questions, MUST call `collect_rca_evidence`. `collect_cluster_status` is optional unless current health context is needed.
- Do NOT state root causes without RCA evidence output.
- If `gaps[]` is non-empty, explicitly state what evidence is missing.
- If all candidates have `support_score < 0.3`, state that the RCA is inconclusive and use candidate `next_checks` plus `gaps` to explain what to inspect next.
- If best candidate is weak (`0.30-0.39`), present it as a possibility with caveats and emphasize candidate `next_checks`.
- Never fabricate or merge evidence lines across candidates. Candidate rows must be traceable directly
The AI-native ClickHouse console for your cluster diagnostics, query generation, evidence-based optimization, intelligent visualization.
Repo: FrankChen021/datastoria
Other skills on datastoria.
- /clickhouse-system-queries
Query ClickHouse system tables to inspect query logs, monitor cluster health, check replication status, and analyze slow queries. Use when the user mentions "system tables", "query_log", "ClickHouse monitoring", "cluster status", "slow queries", or asks to diagnose ClickHouse
Open skill - /diagnose-clickhouse-errors
Diagnose ClickHouse runtime query failures when the user wants database-level cause and fix guidance from an error or numeric error code, not source-code root cause analysis.
Open skill - /optimize-clickhouse-sql
Optimize slow queries, analyze SQL performance, and collect evidence for expensive workloads.
Open skill - /source-code-inspection
Investigate application or repository source code with search_file and read_file to explain behavior, trace root causes of runtime or query errors, and answer with precise file citations.
Open skill - /sql-expert
Expert system for generating, validating, and optimizing ClickHouse SQL. Use this when the user needs data, queries, or analysis.
Open skill - /visualization
Rules for charts and visualization. Use when the user asks for charts, graphs, plots, or visual representations (line, bar, pie, timeseries).
Open skill

