Agent Skill · SigNoz

signoz-writing-clickhouse-queries

Write raw ClickHouse SQL for a SigNoz dashboard panel — timeseries, value, or table widgets that the builder UI cannot express (custom joins, window functions, regex extraction over log bodies, aggregations beyond builder syntax). Trigger when the user explicitly asks for a "ClickHouse query", a "raw SQL panel", a "custom SQL widget", or describes a SigNoz dashboard panel whose query needs SQL the builder cannot produce. Anchored to dashboard-panel SQL specifically. For ad-hoc data exploration that does not need to land in a panel, use `signoz-generating-queries` instead.

Provider: SigNoz Path in repo: plugins/signoz/skills/signoz-writing-clickhouse-queries/SKILL.md

Skill body

Writing ClickHouse Queries for SigNoz Dashboards

When to Use

Use this skill when the user asks for SigNoz queries involving:

If the user asks for a dashboard panel but does not mention ClickHouse, still use this skill.

Signal Detection

Identify whether the request is about logs or traces.

If the request is ambiguous, ask the user to clarify.

Reference Routing

Each reference covers table schemas, optimization patterns, attribute access syntax, dashboard templates, query examples, and a validation checklist.

Quick Reference

Key Variables by Signal

Logs

Traces

Top Anti-Patterns

Query Attribution

Every generated query MUST end with a SETTINGS clause for monitoring:

SELECT ...
FROM ...
WHERE ...
SETTINGS log_comment = 'signoz-writing-clickhouse-queries skill | YYYY-MM-DD'

Replace YYYY-MM-DD with today’s date (e.g., 2026-04-03). If the query already has a SETTINGS clause, append log_comment to it with a comma.

Workflow

  1. Detect the signal: logs or traces.
  2. Read the matching reference file before writing the query.
  3. Pick the panel type: timeseries, value, or table.
  4. Build the query using the required patterns from the reference.
  5. Append the SETTINGS log_comment attribution clause.
  6. Validate the result with the checklist in the reference.