clickhouse-query
Skill311 starsChanged 10 days agoApache-2.0View on GitHub
Run bounded, read-only ClickHouse queries through the repository wrapper.
3 other projects use a version of this; 2 new projects in the last 4 weeks, against 0 the 4 before.
Adopted by
Surging: 2 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- obsessiondb/rudelword for word, first seen Nov 30, 2026
- opalinehq/cliword for word, first seen Nov 29, 2026
- civitai/civitaitheir own version, first seen Oct 8, 2026
Other versions3 projects use a version of this.
Word for word · 2
- obsessiondb/rudel★ 311100% same
- opalinehq/cli★ 311100% same
Edited · 0
None found.
Wrote their own version · 1
- civitai/civitai★ 7.3ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/clickhouse-architecture-advisor/AGENTS.mdAGENTS.md
- .claude/skills/clickhouse-best-practices/AGENTS.mdAGENTS.md
- api-testingSkill
- clickhouse-architecture-advisorSkill
- clickhouse-best-practicesSkill
- clickhouse-js-node-codingSkill
- clickhouse-js-node-troubleshootingSkill
- code-architectureSkill
- environment-variablesSkill
- library-docsSkill
- opaline-designSkill
- pr-creationSkill
- testing-bunSkill
- typescript-standardsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Run only read-only queries.
- Distinctive: line 29
Never print or persist credentials or production-derived result data.
- Very specific: line 30
Use -F json by default; use -F jsonl only for bounded streaming output.
- Very specific: line 116
Use fields discovered in steps 3–4.
- Very specific: line 145
If the plan shows useful part or granule pruning, run the same query without EXPLAIN.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ClickHouse Query
Use one command:
bun run --cwd packages/ch-schema chcli -- -F json -q "<SQL>"The wrapper reads CLICKHOUSE_URL, CLICKHOUSE_USERNAME, and
CLICKHOUSE_PASSWORD from the current process. The URL must not contain
credentials. See references/connection.md.
Guardrails
- Run only read-only queries. Never run DDL, inserts, mutations, deletes, or administrative commands.
- Local and staging use their configured identities. Production requires a separate least-privilege, read-only identity; stop if it is unavailable.
- Never print or persist credentials or production-derived result data.
- Use
-F jsonby default; use-F jsonlonly for bounded streaming output.
Per ClickHouse's
agent-query-safety
rule, every application-data query must have:
- a filter on a discovered sorting or partition key;
- a finite
LIMIT; max_execution_time;max_rows_to_readormax_bytes_to_read.
LIMIT does not cap scanned rows. Metadata queries must also have a finite
LIMIT, a time limit, and a read limit.
Workflow
Per ClickHouse's
agent-discovery-schema
rule, run these steps in order. Execute every SQL block with the wrapper command
above and structured output.
1. Databases
SELECT name
FROM system.databases
WHERE name NOT IN ('system', 'information_schema', 'INFORMATION_SCHEMA')
ORDER BY name
LIMIT 100
SETTINGS max_execution_time = 10, max_rows_to_read = 1000002. Tables and active-part sizes
Replace analytics with the selected database.
SELECT
t.name,
t.engine,
coalesce(sumIf(p.rows, p.active), 0) AS rows,
formatReadableSize(coalesce(sumIf(p.bytes_on_disk, p.active), 0)) AS size
FROM system.tables AS t
LEFT JOIN system.parts AS p
ON p.database = t.database AND p.table = t.name
WHERE t.database = 'analytics'
GROUP BY t.name, t.engine
ORDER BY sumIf(p.bytes_on_disk, p.active) DESC
LIMIT 200
SETTINGS max_execution_time = 15, max_rows_to_read = 10000003. Columns and comments
SELECT position, name, type, default_expression, comment
FROM system.columns
WHERE database = 'analytics' AND table = 'events'
ORDER BY position
LIMIT 500
SETTINGS max_execution_time = 10, max_rows_to_read = 1000004. Sorting and partition keys
SELECT sorting_key, primary_key, partition_key
FROM system.tables
WHERE database = 'analytics' AND name = 'events'
LIMIT 1
SETTINGS max_execution_time = 10, max_rows_to_read = 1000005. Skipping indexes
SELECT name, type_full, expr, granularity
FROM system.data_skipping_indices
WHERE database = 'analytics' AND table = 'events'
ORDER BY name
LIMIT 100
SETTINGS max_execution_time = 10, max_rows_to_read = 1000006. Bounded sample
Use fields discovered in steps 3–4. This example assumes event_date is a key:
SELECT event_date, user_id, event_type
FROM analytics.events
WHERE event_date >= today() - 1
LIMIT 10
SETTINGS max_execution_time = 30,
max_rows_to_read = 10000000,
timeout_before_checking_execution_speed = 07. Explain, then execute
Explain the exact bounded query:
EXPLAIN indexes = 1
SELECT event_type, count() AS events
FROM analytics.events
WHERE event_date >= today() - 1
GROUP BY event_type
ORDER BY events DESC
LIMIT 100
SETTINGS max_execution_time = 30,
max_rows_to_read = 10000000,
timeout_before_checking_execution_speed = 0If the plan shows useful part or granule pruning, run the same query without
EXPLAIN. Otherwise narrow the key filter. On timeout, read-limit, or memory
errors, narrow the query rather than increasing limits.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

