/clickhouse-pack:clickhouse-local-dev-loopfrom clickhouse-pack
Sets up a local ClickHouse dev environment using Docker Compose with auto-migration, seed data, and Vitest integration tests.
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.
Run ClickHouse in Docker for local development with fast schema iteration, seed
data, and integration testing using vitest. This skill scaffolds a
Docker-Compose-based dev loop: an auto-migrating init script, a seed generator,
a reusable client singleton, and a truncate-between-tests integration harness —
so schema changes and query work stay a docker compose up away.
docker info succeeds).@clickhouse/client package for the seed/test scripts.localhost.This is a local dev setup with no external ClickHouse Cloud service. The
container's credentials are declared inline in docker-compose.yml
(CLICKHOUSE_USER: default, CLICKHOUSE_PASSWORD: dev_password) and consumed by
the client via env vars (CLICKHOUSE_USER, CLICKHOUSE_PASSWORD,
CLICKHOUSE_HOST, CLICKHOUSE_DATABASE). Keep real per-developer overrides in a
git-ignored .env.local; commit only a .env.example. Never reuse
dev_password outside local development.
Follow the seven-step build. The lean skeleton is below; the full walkthrough carries the complete file contents for every step.
Docker Compose setup — Write a docker-compose.yml exposing 8123
(HTTP) and 9000 (native TCP), mounting ./init-db for auto-migration and a
named volume for persistence:
services:
clickhouse:
image: clickhouse/clickhouse-server:latest
ports: ["8123:8123", "9000:9000"]
volumes:
- clickhouse-data:/var/lib/clickhouse
- ./init-db:/docker-entrypoint-initdb.d
environment:
CLICKHOUSE_PASSWORD: dev_password
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
volumes:
clickhouse-data:
Then docker compose up -d and verify with
curl http://localhost:8123/ping → Ok.
Init script — Write init-db/001-schema.sql with your
CREATE DATABASE / CREATE TABLE ... ENGINE = MergeTree() DDL. ClickHouse
auto-runs it on the container's first start.
Seed data — Write scripts/seed.ts that batch-inserts synthetic rows via
client.insert({ format: 'JSONEachRow' }).
Project structure — lay out init-db/, scripts/, src/, tests/, and
the .env.local / .env.example pair.
Client singleton — Write src/db.ts exposing a memoized getClient()
that reads connection settings from env vars with localhost fallbacks.
Integration testing — Write a vitest tests/setup.ts that TRUNCATEs
tables in beforeEach and closes the client in afterAll, then write
per-feature test files.
Package scripts — Edit package.json to add db:up, db:down,
db:reset, db:seed, db:shell, and test scripts.
Read the full walkthrough for the exact, copy-pasteable contents of each file.
Running this skill produces a working local ClickHouse dev loop:
clickhouse-server container reachable at http://localhost:8123
(HTTP) and localhost:9000 (native), answering curl .../ping with Ok.app database and schema from init-db/001-schema.sql.npm run db:seed (default: 1000 synthetic events).db:up, db:down, db:reset, db:seed,
db:shell, test) wired into package.json.| Error | Cause | Solution |
|---|---|---|
Connection refused :8123 | Container not running | docker compose up -d |
READONLY | User lacks write perms | Set CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 |
Too many parts | Tiny frequent inserts | Batch inserts or increase parts_to_throw_insert |
Memory limit exceeded | Large query on small container | Add --memory 4g to Docker |
Bring the stack up, seed it, and confirm the rows landed:
docker compose up -d
curl http://localhost:8123/ping # → "Ok.\n"
npm run db:seed # seeds 1000 events
curl 'http://localhost:8123/?query=SELECT+count()+FROM+app.events' # → 1000
Open an interactive SQL shell:
docker exec -it <container> clickhouse-client --password dev_password
See more examples — server-state inspection, HTTP queries, environment reset, and a passing integration-test run.
Once the local loop is green, see the clickhouse-sdk-patterns skill for
production-ready client patterns (connection pooling, retries, typed query
helpers, and async inserts) that build on the getClient() singleton above.
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".
/clickhouse-core-workflow-bInsert, 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".
/clickhouse-cost-tuningOptimize ClickHouse Cloud costs — compute scaling, storage tiering, compression,
and query efficiency for lower bills.
Use when analyzing ClickHouse Cloud bills, reducing storage costs, or optimizing
compute utilization.
Trigger with "clickhouse cost", "clickhouse billing", "reduce clickhouse spend",
"clickhouse pricing", "clickhouse expensive", "clickhouse storage cost".
/clickhouse-data-handlingHandle data lifecycle in ClickHouse — TTL expiration, data deletion (GDPR),
column-level encryption, and audit logging with real ClickHouse SQL.
Use when implementing data retention, fulfilling GDPR/CCPA deletion requests,
or managing sensitive data in ClickHouse.
Trigger with "clickhouse data retention", "clickhouse TTL", "clickhouse GDPR",
"delete data clickhouse", "clickhouse data lifecycle", "clickhouse PII".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin clickhouse-packOther plugins' skills for the same job