clickhouse-system-quer…
Query ClickHouse system tables to inspect query logs, monitor cluster health, check replication status, and analyze slow queries. Use when the user mentions…
Optimize slow queries, analyze SQL performance, and collect evidence for expensive workloads.
$ npx -y skills add FrankChen021/datastoria --skill optimize-clickhouse-sql --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/optimize-clickhouse-sqlContext preview
The summary Claude sees to decide when to auto-load this skill.
Optimize slow queries, analyze SQL performance, and collect evidence for expensive workloads.
name: optimize-clickhouse-sql description: Optimize slow queries, analyze SQL performance, and collect evidence for expensive workloads. metadata: author: System show-in-sql-editor-quick-action: true
Workflow is evidence-driven: collect evidence with tools, then recommend based on evidence only.
1. **HAS SQL**: Conversation contains a SQL query -> Go to WORKFLOW step 2 (Collect Evidence). 2. **HAS QUERY_ID**: Conversation contains query_id -> Go to WORKFLOW step 2 (Call `collect_sql_optimization_evidence` immediately). 3. **DISCOVERY REQUEST**: User asks to optimize the slowest/heaviest queries but does not provide SQL/query_id -> Go to WORKFLOW step 1 (Discovery). 4. **NEITHER**: Call `ask_user_question` with exactly one question:
After the tool returns:
1. **Discovery (if needed)**: Prefer `search_query_log` to find candidates. If the request exceeds the tool's schema, then load `clickhouse-system-queries`, load `references/system-query-log.md` via `skill_resource`, and use that reference. Extract `query_id` from the results. 2. **Collect Evidence**: Call `collect_sql_optimization_evidence` with query_id (preferred) or sql (and same time params if coming from discovery). 3. **Analyze**: Review evidence for optimization opportunities. 4. **Recommendations**: Rank by Impact/Risk/Effort. Prefer low-risk query rewrites first. 5. **Validate**: Use `validate_sql` for any proposed SQL changes. Add inline comments (`-- comment`) to highlight key changes.
The AI-native ClickHouse console for your cluster diagnostics, query generation, evidence-based optimization, intelligent visualization.
Repo: FrankChen021/datastoria
Query ClickHouse system tables to inspect query logs, monitor cluster health, check replication status, and analyze slow queries. Use when the user mentions…
Diagnose ClickHouse cluster health and provide concrete remediation.
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…
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…
Expert system for generating, validating, and optimizing ClickHouse SQL. Use this when the user needs data, queries, or analysis.
Rules for charts and visualization. Use when the user asks for charts, graphs, plots, or visual representations (line, bar, pie, timeseries).