clickhouse-js-node-coding
Write idiomatic application code with the ClickHouse Node.js client (`@clickhouse/client`). Use this skill whenever a user is *building* against the Node.js client — configuring the client, pinging, inserting rows in JSON or raw formats, selecting and parsing results, binding query parameters, manag
- 01GitHub stars
- 564
- 02Installs
- New
- 03Files scanned
- 13
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 03db3316361f10ff… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
ClickHouse Node.js Client — Coding
Reference: https://clickhouse.com/docs/integrations/javascript
⚠️ Node.js runtime only. This skill covers the
@clickhouse/clientpackage running in a Node.js runtime exclusively — including Next.js Node runtime API routes, React Server Components, Server Actions, and standard Node.js processes. Do not apply this skill to browser client components, Web Workers, Next.js Edge runtime, Cloudflare Workers, or any usage of@clickhouse/client-web. For browser/edge environments, the correct package is@clickhouse/client-web.
How to Use This Skill
- Match the user's intent to a row in the Task Index below and read the corresponding reference file before writing code. After reading it, scan any Answer checklist in that reference and make sure the final answer covers each relevant item; those checklists capture details users usually need but are easy to omit in short answers.
- Always import from
@clickhouse/client(never@clickhouse/client-web) and create a client withcreateClient({ url })or rely on supported defaults when appropriate. Close it withawait client.close()preferably when it's no longer needed or during graceful shutdown for global resources. - Prefer
JSONEachRowfor typical row inserts/selects unless the user has already chosen another format or is streaming raw bytes (CSV / TSV / Parquet — seeexamples/node/performance/). Note onclickhouse_settings: settings passed tocreateClientare defaults for every request; they can be overridden per-call by passingclickhouse_settingsdirectly toinsert(),query(), orcommand(). Always mention this when the user configures settings at the client level. - Always use
query_paramsfor user-supplied values — never template- literal-interpolate them into SQL. Seereference/query-parameters.md. When answering a parameter-binding question, your response must explicitly name template-literal interpolation as a "SQL injection risk" — even when the user only asked about syntax and did not raise security. The literal phrase "SQL injection" needs to appear; this is the most common mistake from PostgreSQL/MySQL users and the security framing is part of the correct answer, not an optional aside. - Pick the right method for the job:
client.insert()— write rows.client.query()+resultSet.json()/.text()/.stream()— read rows that return data.client.command()— DDL and other statements that don't return rows (CREATE,DROP,TRUNCATE,ALTER,SETin a session, etc.).client.exec()— when you need the raw response stream of an arbitrary statement (rare in coding scenarios).client.ping()— health check; returns{ success, error? }, never throws on connection failure.
- Note version constraints when relevant. Examples:
pathnameconfig option: client>= 1.0.0.BigIntvalues inquery_params: client>= 1.15.0.TupleParamand JSMapinquery_params: client>= 1.9.0.- Configurable
json.parse/json.stringify: client>= 1.14.0. Time/Time64data types: ClickHouse server>= 25.6.QBitdata type: ClickHouse server>= 25.10(GA on26.x).Dynamic/Variant/ newJSONtypes: ClickHouse server>= 24.1/24.5/24.8(no longer experimental since25.3).
Task Index
Identify the user's task and read the matching reference file.
| Task | Triggers / symptoms | Reference file |
|---|---|---|
| Configure / connect the client | Building a createClient call, URL parameters, clickhouse_settings, default format, custom HTTP headers | reference/client-configuration.md |
| Compress requests / responses | compression, gzip vs zstd, { codec } option shape, Node version requirements, web limitations | reference/compression.md |
| Ping the server | Health checks, readiness probes, "is ClickHouse up?" | reference/ping.md |
| Choose an insert format | "Which format should I use to insert?", JSON vs raw, JSONEachRow vs JSON vs JSONObjectEachRow | reference/insert-formats.md |
| Insert into a subset of columns / different database | insert({ columns }), excluding columns, ephemeral columns, cross-DB inserts | reference/insert-columns.md |
| Insert values, expressions, dates, decimals | INSERT … VALUES with SQL functions, Date/DateTime from JS, Decimal precision, INSERT … SELECT; inserting a UUID into a UInt128 column is tricky — use when the user is writing code that stores a UUID as UInt128 | reference/insert-values.md |
| Async inserts (server-side batching) | async_insert=1, fire-and-forget vs wait-for-ack | reference/async-insert.md |
| Select and parse results | JSONEachRow reads, JSON with metadata, picking a select format | reference/select-formats.md |
| Parameterize queries | Binding values, special characters / escaping, "SQL injection?", {name: Type} syntax | reference/query-parameters.md |
| Sessions & temporary tables | session_id, CREATE TEMPORARY TABLE, per-session SET commands | reference/sessions.md |
| Modern data types | Dynamic, Variant, JSON (object), Time, Time64, QBit (vector search) | reference/data-types.md |
| Custom JSON parse/stringify | Plug in JSONBig / safe-stable-stringify / a BigInt-aware serializer | reference/custom-json.md |
Conventions used in answers
- Always show
import { createClient } from '@clickhouse/client'(Node, never Web). - Always
await client.close()at the end of self-contained snippets; in long-running services, close on graceful shutdown. - For inserts, prefer
format: 'JSONEachRow'andvalues: [...]unless the user's scenario requires otherwise. - For selects, prefer
await (await client.query({...})).json<RowType>()for small / medium result sets; for bigger results suggest streaming. - When showing parameter binding, use ClickHouse's native
{name: Type}syntax — never$1,?, or:name. - For DDL inside a cluster or behind a load balancer, set
clickhouse_settings: { wait_end_of_query: 1 }on thecommand()call so the server only acknowledges after the change is applied. See https://clickhouse.com/docs/en/interfaces/http/#response-buffering.
Out of scope
This skill covers day-to-day coding against @clickhouse/client (Node).
The following topics are intentionally not covered here:
- Errors, hangs, type mismatches, proxy pathname surprises, log silence,
socket hang-ups,
ECONNRESET→ use theclickhouse-js-node-troubleshootingskill. - Streaming, Parquet, file streams, server-side bulk moves, progress
streaming, async-insert throughput tuning — see
examples/node/performance/. - TLS, RBAC / read-only users, deeper SQL-injection guidance — see
examples/node/security/. CREATE TABLEpatterns, deployment-shaped connection strings, replication / sharding choices — seeexamples/node/schema-and-deployments/.- Browser, Web Worker, Next.js Edge, Cloudflare Workers — use
@clickhouse/client-weband seeexamples/web/.
Still Stuck?
examples/node/coding/— the runnable corpus this skill is built on.- ClickHouse JS client docs
- ClickHouse supported formats
- ClickHouse data types
Files
13- SKILL.md
6dd189aaf010.9 KB - reference/async-insert.md
21d66ab2e84.0 KB - reference/client-configuration.md
2a858f3a384.6 KB - reference/compression.md
4aa54be20b4.6 KB - reference/custom-json.md
3c8379123c6.6 KB - reference/data-types.md
cfd407dc7210.6 KB - reference/insert-columns.md
c83bd73c913.1 KB - reference/insert-formats.md
3cff7ffb2c6.1 KB - reference/insert-values.md
8233f2364c6.4 KB - reference/ping.md
ac091e9bd05.1 KB - reference/query-parameters.md
cbd30281f75.4 KB - reference/select-formats.md
556730f7637.2 KB - reference/sessions.md
1876fa36be6.9 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from ClickHouse/agent-skills8
Use when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or speed up slow pandas. Provides chDB DataStore — same pandas API, ClickHouse engine underneath. Also handles reading from S3, MySQL, PostgreSQL, MongoDB, ClickHouse Cloud,
Use when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse Cloud, Iceberg, Delta Lake) without setting up a server. Provides chDB — embedded ClickHouse SQL in Python with 1000+ function
MUST USE when designing ClickHouse architectures, selecting between ingestion or modeling patterns, or translating best practices into workload-specific system designs. Complements clickhouse-best-practices with decision frameworks and explicit provenance labels.
MUST USE when reviewing ClickHouse schemas, queries, native full-text search, or configurations. Contains 36 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses.
Generate TypeScript/JavaScript code that reads/decodes AND writes/encodes ClickHouse RowBinary streams for the ClickHouse HTTP server. Use this skill whenever a user wants to parse or produce `RowBinary`, `RowBinaryWithNames`, or `RowBinaryWithNamesAndTypes`. Node.js only, doesn't cover browsers.
Troubleshoot and resolve common issues with the ClickHouse Node.js client (@clickhouse/client). Use this skill whenever a user reports errors, unexpected behavior, or configuration questions involving the Node.js client specifically — including socket hang-up errors, Keep-Alive problems, stream hand
MUST USE when investigating performance issues on a ClickHouse-managed Postgres instance. Provides an evidence-based RCA workflow that scrapes the Prometheus endpoint for system signal, pulls per-digest evidence from the Slow Query Patterns API, and recommends (does not apply) a fix.
Use when a user wants to wire an OpenTelemetry collector into a Managed ClickStack service on ClickHouse Cloud, either by deploying a new local collector (Docker run or Docker Compose) or by configuring their own existing collector, then send rich synthetic telemetry and verify it is visible in Clic
Related backend skillsscan passed
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Use this when generating RTK Query endpoints from OpenAPI schemas with @rtk-query/codegen-openapi. Covers the empty API pattern, filterEndpoints, endpointOverrides, generated tags, and reviewing generated output before it becomes part of the app.
Report browser/API/CLI/job/worker/webhook bugs. Use for: qa report only, just report bugs, test but dont fix. (gstack)
Use this skill when debugging active macOS connectivity failures, when an API or MCP service times out or disconnects, when DNS resolution is failing or inconsistent, or when video calls or other interactive traffic show packet loss or latency. Isolate local-LAN, DNS, upstream-path, and remote-servi
PostHog integration for FastAPI applications
Implements API rate limiting using token bucket, sliding window, and Redis-based algorithms to protect against abuse. Use when securing public APIs, implementing tiered access, or preventing denial-of-service attacks.