clickhouse-managed-postgres-rca
This skill diagnoses performance problems on ClickHouse-managed Postgres instances by scraping Prometheus metrics and querying the Slow Query Patterns API to…
Identity proven by GitHub's verified organisation badge (ClickHouse)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- Apache-2.0 (permissive)
- Pin
- 356a8c1pinned Oct 9, 2026
- Context cost
- about 1,100 tokenswhen the skill loads
- GitHub stars
- 544on clickhouse/agent-skills
- Scripts
- None found
What it does
“MUST USE when investigating performance issues on a ClickHouse-managed Postgres instance. Provides an evidence-based RCA workflow that scrapes the Prometheus endpoint for system signal, pulls per-digest evidence from the Slow Query Patterns API, and recommends (does not apply) a fix.”
Generated summary from the skill's own text
This skill diagnoses performance problems on ClickHouse-managed Postgres instances by scraping Prometheus metrics and querying the Slow Query Patterns API to identify root causes. It follows a structured six-step workflow that triages signals into specific failure patterns (full scans, N+1 loops, or write contention) and recommends fixes without applying them.
When to use it
- User reports slowness, high CPU, or low throughput on managed Postgres
- Investigating cache hit ratio issues or connection pool saturation
- Diagnosing unexplained performance degradation on a running instance
- Analyzing patterns in slow queries across a service
When not to
- You have EXPLAIN plans or need detailed query execution details
- Investigating autovacuum or table bloat issues requiring scan counters
- User wants immediate automatic fixes applied to the database
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add clickhouse/agent-skills --skill clickhouse-managed-postgres-rcaInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install clickhouse/agent-skills clickhouse-managed-postgres-rca@356a8c1b9a7392adb389a132f5ad3fec38532a03Installs the commit we checked (356a8c1).
Copy by hand
Download the folder at 356a8c1 and put it in .claude/skills/clickhouse-managed-postgres-rca for Claude Code and in .agents/skills/clickhouse-managed-postgres-rca for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install clickhouse@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Claude Code plugin
/plugin install clickhouse-best-practices@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "clickhouse-managed-postgres-rca" by ClickHouse. Source, pinned to commit 356a8c1b9a7392adb389a132f5ad3fec38532a03: https://github.com/clickhouse/agent-skills/tree/356a8c1b9a7392adb389a132f5ad3fec38532a03/skills/clickhouse-managed-postgres-rca 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/clickhouse-managed-postgres-rca/ for Claude Code and .agents/skills/clickhouse-managed-postgres-rca/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/clickhouse/clickhouse-managed-postgres-rca
SKILL.md at the pin
---
name: clickhouse-managed-postgres-rca
description: MUST USE when investigating performance issues on a ClickHouse-managed Postgres instance. Provides an evidence-based RCA workflow that scrapes the Prometheus endpoint for system signal, pulls per-digest evidence from the Slow Query Patterns API, and recommends (does not apply) a fix.
license: Apache-2.0
metadata:
author: ClickHouse Inc
version: "0.1.0"
---
# ClickHouse Managed Postgres RCA
## When to use
Trigger whenever a user reports slowness, high CPU, low
throughput, cache thrash, or any unexplained pain on a
ClickHouse-managed Postgres instance.
## What you have access to
Two APIs on `https://api.clickhouse.cloud` (HTTP Basic auth
using a ClickHouse Cloud API key/secret pair):
- **Prometheus metrics** — operation `postgresInstancePrometheusGet`
under the Prometheus tag. Returns Prometheus exposition format.
System and workload metrics for one Postgres service.
- **Slow Query Patterns** — operation `slowQueryPatternsGetList`
under the Postgres tag. Returns per-digest latency, IO, and
call statistics for normalized query patterns. **Beta.**
Both endpoints require an `organizationId` and a `serviceId` as
path parameters. The user must supply both, plus the API
key/secret pair.
## What you do NOT have
- Query plans / EXPLAIN output.
- Per-table scan-type counters (`seq_scan` / `idx_scan`).
- Autovacuum or last-ANALYZE timestamps.
Reason from IO and timing signals, not from a plan tree.
## Workflow
Six steps, in order. Do not skip ahead.
Steps 2 and 3 only share auth — no data dependency between
them. Run them in parallel (background curls, `&` + `wait`) to
cut wall time from sequential ~2s to ~1s.
### 1. Discover the live API shape
These endpoints are Beta — paths, params, and JSON field names
can shift. Follow `rules/openapi-discovery.md` to:
1. Fetch the OpenAPI spec from `https://api.clickhouse.cloud/v1`.
2. Locate the two operations by `operationId`:
- `postgresInstancePrometheusGet` (Prometheus tag)
- `slowQueryPatternsGetList` (Postgres tag)
3. Resolve their path templates, required query parameters,
and (for the slow-query endpoint) the response schema.
4. Build a session-scoped role map from the schema property
descriptions: `{ semantic role → actual field name }`.
Use the resolved names in every subsequent request and citation.
Never hardcode field names from memory.
### 2. Scrape Prom once for system gauges
Follow `rules/prometheus-scrape.md`. **One scrape, no wait.**
You're after gauges (current values) that don't need a delta:
`CacheHitRatio`, `ActiveConnections`, `MemoryUsedPercent`,
`FilesystemUsedPercent`.
A `CacheHitRatio` well below ~95% on a workload that should
fit in cache is a real signal on its own. Climbing
`ActiveConnections` toward the pool ceiling is a real signal
on its own. These don't need rate-of-change.
A second scrape for counter deltas is **opt-in**, used only
when Step 4 triage points at write-congestion (where deadlock
and rollback *rates* matter and the Slow Query Patterns API
can't substitute). For the read-path case (the most common
RCA shape) the single scrape is enough.
### 3. Pull top slow query patterns
Request the slow query patterns. Follow
`rules/slow-query-patterns-fields.md` for the fields that
matter and how to read them. This is the primary diagnostic —
it returns per-pattern accumulated totals (call count, runtime,
blocks, rows) over the window you request, which is the
"rate-of-change" data you'd otherwise derive from two Prom
scrapes — but per query and without waiting.
If no patterns return a meaningful `totalDurationUs`, the
report may be overstated or the issue isn't query-shaped.
Stop and tell the user what you looked at.
### 4. Triage: pick the right heuristic
Follow `rules/triage.md`. Match the combined Prom + slow-query
signal to one of the heuristic shapes. Each shape points to a
specific heuristic file:
- `rules/heuristic-full-scan.md` — read-path full scan.
- `rules/heuristic-hot-loop.md` — N+1 / hot loop from the app.
- `rules/heuristic-write-congestion.md` — deadlocks, slow
writes, high rollback rate.
If the signal does not match any shape cleanly, do not invent
a hypothesis. Surface the top patterns and ask the user which
workload they recognize. New heuristics are welcome as PRs.
### 5. Reason, then recommend
Use the format in `rules/output-template.md`. Always include:
symptom, evidence, hypothesis (noting any alternative cause
you cannot rule out from this surface alone), short-term fix,
and long-term follow-ups.
### 6. Do not apply the fix
Follow `rules/recommend-only.md`. Never run DDL. Never call
`pg_cancel_backend` or `pg_terminate_backend`. Write the
recommendation, explain why, and let the human apply it.
## Full Compiled Document
For the complete guide with every rule expanded in a single
context load: `AGENTS.md`.
From clickhouse/agent-skills at 356a8c1, shown as plain text under its license: Apache-2.0 (permissive). The license text is in skills/clickhouse-managed-postgres-rca/SKILL.md.
View SKILL.md on GitHub at 356a8c1Files
- SKILL.md4.9 KB · 9c6b082aea70
- AGENTS.md33 KB · 3a92ef63035b
- README.md1.4 KB · e735b6eee8ba
- metadata.json887 B · e455117f3b44
- rules/
- heuristic-full-scan.md2.6 KB · 7106356b2a48
- heuristic-hot-loop.md2.5 KB · 2680a0a6a6cb
- heuristic-write-congestion.md3.2 KB · 673b63e095fe
- openapi-discovery.md6.2 KB · 4569352acf06
- output-template.md2.7 KB · 18cb72e6edf6
- prometheus-scrape.md3.6 KB · 0255a9461550
- recommend-only.md1.6 KB · 91f436465d60
- slow-query-patterns-fields.md5.5 KB · 8dc9b1168a83
- triage.md3.2 KB · 0f868a47b5e2
13 files, 71 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 356a8c1More from ClickHouse
chdb-datastore
This skill enables working with tabular data using a pandas-compatible API backed by ClickHouse for faster execution.
Contains scripts
Claude Code, Codex, Cursor +3 · about 1.2K tokens · pinned 6 days ago
chdb-sql
The skill enables running ClickHouse SQL queries on local files (parquet, csv, json), remote databases (Postgres, MySQL, MongoDB, ClickHouse Cloud), and cloud…
Contains scripts
Claude Code, Codex, Cursor +3 · about 960 tokens · pinned 6 days ago
clickhouse-architecture-advisor
This skill guides agents through ClickHouse architecture decisions for specific workloads like observability, SIEM, and financial services.
Claude Code, Codex, Cursor +4 · about 690 tokens · pinned 6 days ago
clickhouse-best-practices
This skill provides 31 ClickHouse best practices rules covering schema design, query optimization, data ingestion, and agent connectivity.
Claude Code, Codex, Cursor +4 · about 2.5K tokens · pinned 6 days ago
clickhouse-js-node-rowbinary
This skill generates TypeScript/JavaScript code to read and write ClickHouse RowBinary format streams in Node.js.
Contains scripts
Claude Code, Codex, Cursor +3 · about 1.2K tokens · pinned 6 days ago
clickhouse-js-node-troubleshooting
Diagnose and fix issues with the ClickHouse Node.js client (@clickhouse/client) running in Node.js environments.
Claude Code, Codex, Cursor +4 · about 1.1K tokens · pinned 6 days ago
Related in Observability
clickstack-otel-collector
Sets up an OpenTelemetry collector for ClickHouse Cloud's Managed ClickStack, either by deploying a new local collector via Docker or configuring an existing…
by ClickHouseOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 9.7K tokens · pinned 6 days ago
redis-observability
This skill guides agents on monitoring Redis instances by identifying key metrics to track, using built-in diagnostic commands like SLOWLOG and MEMORY DOCTOR…
by RedisOfficial publisher
Claude Code, Codex, Cursor +4 · about 770 tokens · pinned 6 days ago
logfire-infrastructure
This skill configures the OpenTelemetry Collector to send infrastructure metrics from hosts, Docker containers, Kubernetes clusters, databases, message…
by pydanticCommunity
Claude Code, Codex, Cursor +4 · about 1.6K tokens · pinned 6 days ago
debugging-executions
Debug workflow execution failures by inspecting failed nodes, re-running executions, and comparing expected versus actual values.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.5K tokens · pinned 6 days ago
instance-awareness
This skill teaches the agent to resolve ambiguous requests by reading the instance's activity log and workflow history instead of asking the user to clarify.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 1.3K tokens · pinned 6 days ago
creating-replay-vision-scanners
Guides agents through creating Replay Vision scanners, LLM probes that watch session recordings on a schedule and log findings as observations.
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.3K tokens · pinned 6 days ago