/clickhouse-pack:clickhouse-multi-env-setupfrom clickhouse-pack
Configures ClickHouse across dev, staging, and production with environment-specific settings, secrets management, and infrastructure-as-code. Use for per-environment ClickHouse setup and connection config management.
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.
Configure separate ClickHouse instances for development, staging, and production
with proper secrets management, environment detection, and infrastructure-as-code.
A single typed config module resolves the right instance from NODE_ENV, so
application code never branches on environment and destructive operations are
blocked outside dev/staging.
The full code for every step lives in references/implementation.md; worked end-to-end flows are in references/examples.md.
Provision one instance per tier, isolated by data sensitivity:
| Environment | Instance | Purpose | Data |
|---|---|---|---|
| Development | Docker local | Fast iteration | Synthetic seed data |
| Staging | ClickHouse Cloud (Dev tier) | Pre-prod validation | Sampled prod copy |
| Production | ClickHouse Cloud (Prod tier) | Live traffic | Real data |
Create src/config/clickhouse.ts with one ClickHouseEnvConfig per environment,
keyed by NODE_ENV. Fail fast in non-dev environments — require a password and
enforce HTTPS at startup:
export function getConfig(): ClickHouseEnvConfig {
const env = process.env.NODE_ENV ?? 'development';
const config = configs[env];
if (!config) throw new Error(`Unknown environment: ${env}`);
if (env !== 'development') {
if (!config.password) throw new Error(`CLICKHOUSE_PASSWORD not set for ${env}`);
if (!config.url.startsWith('https://')) {
throw new Error(`ClickHouse ${env} must use HTTPS`);
}
}
return config;
}
Full per-environment config table (pool sizes, timeouts, compression): references/implementation.md.
A lazily-initialized singleton in src/clickhouse/client.ts builds the pool once
per process from the resolved config. Full code:
references/implementation.md.
Dev uses a git-ignored .env.local; every other tier pulls from a secret manager
(AWS Secrets Manager, GCP Secret Manager, or Vault) — never commit credentials.
CLI recipes for all three:
references/implementation.md.
Run sorted .sql files through a migration runner (scripts/apply-schema.ts).
Fail hard in production, log-and-continue in dev/staging:
references/implementation.md.
requireNonProduction blocks TRUNCATE/reset in prod and validateDatabaseName
catches cross-environment queries. Full guards:
references/implementation.md.
Auto-deploy staging; gate production behind needs: deploy-staging plus a
manual-approval environment. Full workflow:
references/examples.md.
Completing this workflow yields:
src/config/clickhouse.ts — typed, per-environment ClickHouse config with
startup validation (password present, HTTPS enforced outside dev).src/clickhouse/client.ts — a singleton client factory keyed off NODE_ENV.scripts/apply-schema.ts — a deterministic, sorted migration runner..github/workflows/deploy.yml pipeline that migrates schema and deploys
staging automatically, production behind manual approval.Application code then calls getClient() with zero environment branching.
| Issue | Cause | Solution |
|---|---|---|
| Wrong database in prod | Env var not set | Validate config on startup |
| TLS error in staging | Using http:// for Cloud | Force https:// in non-dev |
| Schema drift | Applied manually | Use migration runner in CI |
| Secret not found | Missing env var | Check secret manager + CI config |
Query from application code with no environment logic — getConfig() resolves the
right instance from NODE_ENV:
import { getClient } from './clickhouse/client';
const rows = await getClient().query({
query: 'SELECT count() AS c FROM events WHERE date = today()',
format: 'JSONEachRow',
});
console.log(await rows.json());
More worked flows — the environment-strategy layout, the full CI/CD deploy pipeline, and end-to-end query usage — are in references/examples.md.
For monitoring and observability, see the clickhouse-observability skill, which
covers query performance dashboards, slow-query logging, and alerting across the
same dev/staging/production tiers you configured here.
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