ClickHouse Node.js client
Writes correct Node.js code for the official ClickHouse client, so inserts, queries and streams work first time.
What we improved
Made SKILL.md useful on its own instead of a router. It now carries working core patterns for the shared client and shutdown, inserts, typed selects, streaming selects, safe query parameters, DDL with command and wait_end_of_query, ping for
Improved by YourAISkill from the original by ClickHouse, under its Apache-2.0 licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
8/10 Precise @clickhouse/client guidance on method choice, typed query parameters, stream handling, sessions, 64-bit integers and compression, with version notes and per-topic answer checklists.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
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, managing sessions and temporary tables, working with data types or customizing JSON parsing. Do NOT use for browser/Web client code.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: clickhouse-js-node-coding
description: "Write idiomatic Node.js application code with the official ClickHouse client (@clickhouse/client): configuring and sharing the client, health checks with ping, inserting rows (JSONEachRow and other formats, column subsets, SQL expressions, dates, decimals, async inserts), selecting and parsing results (json, text, streaming), binding query parameters safely with {name: Type}, DDL with command, sessions and temporary tables, compression, modern data types (Dynamic, Variant, JSON, Time, QBit) and custom JSON parsing. Use whenever someone is building against @clickhouse/client in a Node.js runtime, including Next.js Node routes, server components and server actions. Do NOT use for browser, Web Worker, Next.js Edge or Cloudflare Workers code, which needs @clickhouse/client-web."
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by ClickHouse. See CHANGES.md. -->
# ClickHouse Node.js Client: Coding
Docs: https://clickhouse.com/docs/integrations/javascript
> **Node.js runtime only.** This skill covers `@clickhouse/client` in a Node.js runtime: plain Node processes, Next.js Node runtime API routes, React Server Components and Server Actions. It does not apply to browser components, Web Workers, the Next.js Edge runtime or Cloudflare Workers; those use `@clickhouse/client-web`.
## How to use this skill
1. Write the code from the core patterns below; they cover most tasks.
2. For anything beyond them, open the matching file from the Task Index before writing code, and work through its **Answer checklist**: those lists hold details people need but short answers tend to omit.
3. Note version constraints (listed at the end of this file) when the user's code depends on them.
## Rules that apply to every answer
- Import from `@clickhouse/client` (never `@clickhouse/client-web`) and create **one shared client** per process with `createClient(...)`; it holds a connection pool. Call `await client.close()` at the end of self-contained scripts, or on graceful shutdown in services.
- Prefer `format: 'JSONEachRow'` for inserts and selects unless the user has chosen another format or is moving raw bytes (CSV, TSV, Parquet).
- Bind every user-supplied value with ClickHouse `{name: Type}` placeholders and `query_params`. Whenever you show parameter binding, say plainly that building SQL with template literals or string concatenation from user input is a **SQL injection** risk; users coming from PostgreSQL or MySQL often reach for `$1`, `?` or `:name`, none of which work here.
- `clickhouse_settings` on `createClient` are defaults for every request; any `query()`, `insert()`, `command()` or `exec()` call can override them with its own `clickhouse_settings`. Say this whenever settings are configured on the client.
- Pick the method by job:
- `client.insert()` writes rows.
- `client.query()` reads rows; then `resultSet.json()`, `.text()` or `.stream()`.
- `client.command()` runs statements that return no rows (`CREATE`, `DROP`, `TRUNCATE`, `ALTER`, `INSERT ... SELECT`, `SET` in a session).
- `client.exec()` returns the raw response stream of any statement (rare in application code).
- `client.ping()` health-checks; it resolves `{ success: true }` or `{ success: false, error }` and does not throw on connection failure.
## Core patterns
### Client
```ts
import { createClient } from "@clickhouse/client";
export const client = createClient({
...From ClickHouse's repository, Apache-2.0 licence.
Related skills
-
Checked
Safe Postgres migrations
Plans Postgres schema changes with the right locks and backfills, so migrations run without downtime.
9/101 credit -
Checked
Reversible database migrations
Writes safe, reversible migrations for Postgres, Prisma, Django and others, so tables change without downtime.
8/101 credit -
Checked
MySQL and MariaDB tuning
Guides MySQL and MariaDB schema, indexes, EXPLAIN plans and replication, so your database runs smoothly.
7/101 credit -
Checked
Prisma schema and queries
Writes Prisma schemas, queries and migrations to current Prisma 7 rules, so your code avoids old habits.
7/101 credit -
Checked
BigQuery migration checks
Validates that tables moved to BigQuery match their source on schema, aggregates and rows, so nothing is lost.
7/101 credit -
Checked
Query driven schema design
Designs tables, keys and indexes from your real query patterns, so your data model stays fast as it grows.
7/101 credit