/clickhouse-pack:clickhouse-hello-worldfrom clickhouse-pack
Creates a ClickHouse MergeTree table, inserts JSONEachRow data, and runs analytical queries. Use when starting a ClickHouse project or testing connectivity.
Ships in clickhouse-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create a MergeTree table, insert rows with JSONEachRow, and run your first
analytical query -- all using the official @clickhouse/client. This is the
smoke test that proves your connection works and teaches the four MergeTree
concepts (ORDER BY, PARTITION BY, TTL, LowCardinality) reused in every
real schema.
@clickhouse/client installed and connected (see the clickhouse-install-auth
skill for connection setup).CLICKHOUSE_HOST / CLICKHOUSE_USER / CLICKHOUSE_PASSWORD set as
environment variables.import { createClient } from '@clickhouse/client';
const client = createClient({
url: process.env.CLICKHOUSE_HOST ?? 'http://localhost:8123',
username: process.env.CLICKHOUSE_USER ?? 'default',
password: process.env.CLICKHOUSE_PASSWORD ?? '',
});
await client.command({
query: `
CREATE TABLE IF NOT EXISTS events (
event_id UUID DEFAULT generateUUIDv4(),
event_type LowCardinality(String),
user_id UInt64,
payload String,
created_at DateTime DEFAULT now()
)
ENGINE = MergeTree()
ORDER BY (event_type, created_at)
PARTITION BY toYYYYMM(created_at)
TTL created_at + INTERVAL 90 DAY
`,
});
console.log('Table "events" created.');
Key concepts:
MergeTree() -- the foundational ClickHouse engine for analyticsORDER BY -- defines the primary index (sort key); pick columns you filter/group onPARTITION BY -- splits data into parts by month for efficient pruningTTL -- automatic data expirationLowCardinality(String) -- dictionary-encoded string, ideal for columns with < 10K distinct valuesFor the full engine menu (ReplacingMergeTree, SummingMergeTree, etc.) and the
column-type table, see MergeTree engines & data types.
await client.insert({
table: 'events',
values: [
{ event_type: 'page_view', user_id: 1001, payload: '{"url":"/home"}' },
{ event_type: 'click', user_id: 1001, payload: '{"button":"signup"}' },
{ event_type: 'page_view', user_id: 1002, payload: '{"url":"/pricing"}' },
{ event_type: 'purchase', user_id: 1002, payload: '{"amount":49.99}' },
{ event_type: 'page_view', user_id: 1003, payload: '{"url":"/docs"}' },
],
format: 'JSONEachRow',
});
console.log('Inserted 5 events.');
// Count events by type
const rs = await client.query({
query: `
SELECT
event_type,
count() AS total,
uniqExact(user_id) AS unique_users
FROM events
GROUP BY event_type
ORDER BY total DESC
`,
format: 'JSONEachRow',
});
const rows = await rs.json<{
event_type: string;
total: string; // ClickHouse returns numbers as strings in JSON
unique_users: string;
}>();
for (const row of rows) {
console.log(`${row.event_type}: ${row.total} events, ${row.unique_users} users`);
}
Once data lands, inspect on-disk size and part counts via system.parts to
confirm your partitioning is healthy. Full query and column reference:
exploring system tables.
Running the three core steps against a fresh table produces:
Table "events" created. (idempotent via IF NOT EXISTS).Inserted 5 events.event_type, sorted by count descending:page_view: 3 events, 3 users
click: 1 events, 1 users
purchase: 1 events, 1 users
ClickHouse returns numeric aggregates as JSON strings, so cast total /
unique_users before doing arithmetic in TypeScript.
| Error | Cause | Solution |
|---|---|---|
Table already exists | Re-running CREATE | Use IF NOT EXISTS |
Unknown column | Typo in column name | Check DESCRIBE TABLE events |
Type mismatch | Wrong data type in insert | Match types to schema |
Memory limit exceeded | Query too broad | Add WHERE clauses, use LIMIT |
Steps 1-3 form the canonical end-to-end example: create → insert → aggregate. Two extensions live in the reference files:
MergeTree for
ReplacingMergeTree (upserts) or add a Decimal(18,2) column:
MergeTree engines & data types.system.parts size/part-count query:
exploring system tables.Proceed to the clickhouse-local-dev-loop skill for Docker-based local
development and an iterative schema-editing workflow.
What SKILL.md sets; muted values are Claude Code's defaults
24 skills in this plugin
/clickhouse-ci-integrationRun ClickHouse integration tests in CI with GitHub Actions and Docker
containers. Use when setting up automated testing against a real ClickHouse
instance, configuring CI pipelines, or implementing schema validation in CI.
Trigger with "clickhouse CI", "clickhouse GitHub Actions", "clickhouse
integration tests", "test clickhouse in CI", "clickhouse automated testing".
/clickhouse-common-errorsDiagnose and fix the top 15 ClickHouse errors — query failures, insert problems,
memory limits, and merge issues.
Use when a ClickHouse query or insert throws an exception, a server-side error
appears in logs, or a failed query needs root-cause analysis.
Trigger with "clickhouse error", "fix clickhouse", "clickhouse not working",
"debug clickhouse", "clickhouse exception", "clickhouse syntax error".
/clickhouse-core-workflow-aDesign ClickHouse schemas with MergeTree engines, ORDER BY keys, and
partitioning.
Use when creating new tables, choosing an engine, designing sort keys, or
modeling data for analytical workloads on ClickHouse or ClickHouse Cloud.
Trigger with "clickhouse schema design", "clickhouse table design",
"clickhouse ORDER BY", "clickhouse partitioning", "MergeTree table".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin clickhouse-packOther plugins' skills for the same job