Agent skill · data analytics · jeremylongshore
clickhouse-core-workflow-b
Insert, query, and aggregate data in ClickHouse with real SQL patterns. Use when writing analytical queries, inserting data at scale, building dashboards, or implementing materialized views for pre-aggregation. Trigger with "clickhouse query", "clickhouse insert", "clickhouse aggregate", "clickhouse materialized view", "clickhouse SQL".
Why this skill is useful
Provides specific SQL patterns and best practices for efficient data insertion and querying in ClickHouse that the AI wouldn't reliably generate on its own.
What it needs
Requires @clickhouse/client installed locally. About 3k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
ClickHouse Insert & Query (Core Workflow B) Overview Move data into ClickHouse efficiently, then answer analytical questions with aggregations, funnels, retention, window functions, and materialized views. This skill covers the read/write half of the core workflow: the fast-path insert patterns that avoid "too many parts", the parameterized query API for Node.js, and pre-aggregation via materialized views. The high-frequency patterns live inline below; the deep query library and advanced engine patterns are broken out into references/ so you can drill in only when you need them. Prerequisites Tables already created — run clickhouse-core-workflow-a first if not. @clickhouse/client installed and connected (CLICKHOUSEHOST, CLICKHOUSEUSER, CLICKHOUSEPASSWORD in the environment). A target database/table (examples use analytics.events). Instructions Step 1: Bulk insert (the fast path) Batch rows and let the client buffer. ClickHouse writes a new "part" per INSERT, so many tiny inserts are the number-one performance mistake. Streaming a file (CSV, Parquet, etc.) uses the same call with a read stream and the matching format (e.g. CSVWithNames). Insert best practices: Batch rows: aim for 10K-100K rows per INSERT (not one at a time). ClickHouse creates a new "part" per INSERT — too many small inserts cause "too many parts". For real-time streams, buffer 1-5 seconds then flush. Step 2: Analytical queries Aggregate with count(), uniqExact(), and time filters. The canonical "top events by tenant" shape: Funnel, retention, and safe parameterized-query patterns are in references/queries.md. Step 3: Pre-aggregation and windowing For dashboards, pre-aggregate on INSERT with a materialized view backed by an AggregatingMergeTree target, then merge states at read time. Window functions (rownumber(), running totals via OVER (PARTITION BY ...)) and the full function reference table are in references/advanced.md. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/clickhouse-core-workflow-b