About clickhouse
A skill for ClickHouse analytics work in TypeScript and Node.js. It guides client usage, SQL, schema and ingestion choices, operations, and focused verification using official client documentation.
Key features
- 01Official TypeScript client guidance
- 02SQL and schema design
- 03Batch and async ingestion patterns
- 04Cloud and self-hosted operations
- 05Focused query and insert checks
Use cases
- 01Build a Node.js ClickHouse analytics app
- 02Design MergeTree tables and sort keys
- 03Ingest JSONEachRow data in batches
- 04Check queries, streams, and migrations
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ dobroslavradosavljevic/ skills --skill clickhouseAfter installing, type/clickhousein Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamlreferences/client-ts.mdingest-query-patterns.mdsource-map.mdsql-engines-modeling.mdtesting-migrations.mdtypes-cloud-ops.mdusage-guide.mdDetails
From the project READMEClickHouse (TypeScript)
Use this skill for ClickHouse OLAP work driven from TypeScript/Node: official JS clients, SQL the app runs, table design, ingest, Cloud vs self-hosted, and ops the app can query.
Workflow
- Inspect the local surface:
- Packages:
@clickhouse/client(Node) and/or@clickhouse/client-web(browser/Workers). Snapshot 1.23.1 (1.24.0 is merged but unreleased). Node>=20. Client supports server 24.8+; current server lines are 26.9 stable and 26.8 / 26.3 LTS. - Connection:
url(HTTPS Cloud:8443vs local HTTP:8123), auth (password vs Cloud JWTaccess_token),database, TLS. - Schema: engine (MergeTree family),
ORDER BY,PARTITION BY, MVs/projections. - Ingest path:
insert()batches vsasync_insert, streams, empty-array no-op.
- Packages:
- For day-to-day how-to, follow usage-guide.md first.
- Refresh docs when versions drift. Start from source-map.md.
- Route deeper detail:
- Client API, formats, streams, settings: client-ts.md.
- Engines, keys, MVs, projections, indexes: sql-engines-modeling.md.
- Insert/select SQL patterns, FINAL, JOINs, mutations: ingest-query-patterns.md.
- Types, Cloud, system tables, errors: types-cloud-ops.md.
- Testcontainers + SQL migrations: testing-migrations.md.
- Prefer official
@clickhouse/clientover unscoped/clickhousecommunity packages. Never interpolate user input into SQL — use{name: Type}+query_params. - Verify with focused
query/insertsmokes, part-count awareness for ingest, and consume/close everyResultSet.
Core Judgment
- ClickHouse is columnar OLAP, not OLTP. Optimize for batched analytics, not high-QPS point lookups.
- JS clients speak HTTP(S) only (not native TCP 9000).
- Default to MergeTree + strong
ORDER BY; partitions are for data management (TTL/DROP), not a substitute for the sort key. - Prefer batched
insert({ format: 'JSONEachRow' }); tiny sync inserts →TOO_MANY_PARTS. Useasync_insert=1+wait_for_async_insert=1when clients cannot batch. - Specialized engines (Replacing/Summing/Aggregating/Collapsing) need correctness SQL (
FINALor merge-aware aggregation) — merges are eventual. - Prefer insert-only / RMT / MVs over chatty
ALTER UPDATE/DELETEmutations; lightweightDELETE FROMfor row deletes; lightweightUPDATE … SET(beta, patch parts) only for small (<~10%) batched fixes. - Server 26.9+: the new analyzer is mandatory (
enable_analyzeris obsolete) and default compression moved to ZSTD — retest old queries and pinned settings when upgrading. - Type traps: UInt64 → string in JSON; Decimal as string; Date as
'YYYY-MM-DD'; always setformat: 'JSONEachRow'for object rows (insert default is JSONCompactEachRow). - Always consume or
close()ResultSets — dangling streams causeECONNRESET. - One shared client per process;
close()/await usingon shutdown. Sessions →max_open_connections: 1. - Cloud: HTTPS
:8443, managed replication, no app-levelDistributed(...)— useremoteSecurewhen needed. - Prefer
bun/bunxin command examples.
Verification
Prefer repository-owned commands. For meaningful ClickHouse work, cover the relevant subset:
bun pm ls @clickhouse/clientand Node ≥20.- Smoke:
ping({ select: true }), DDL viacommand,insert+querywithJSONEachRow. - Ingest: batch size / async_insert settings; watch for error 252 too many parts.
- Streaming: full consume or
close(); backpressure on insert streams. - Cloud: TLS URL, credentials/JWT, keep-alive idle TTL < server timeout (~2500 ms client default).
- Schema:
ORDER BYmatches filter patterns; RMT/MV correctness underFINALor merge aggs. - Tests:
@testcontainers/clickhouse+getClientOptions()when integration tests exist.
Report which checks ran, which did not, and version/Cloud assumptions that remain.
Comments
Markdown supported