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.
Compatibility
Through your Versatile gateway every MCP client can load this skill's instructions. Whether it can also do the work depends on what the skill needs and what the client can run.
Requires
Nothing beyond reading its instructions
| Client | Works | Why | Reads SKILL.md natively |
|---|---|---|---|
| Claude Code | Full | Has everything this skill needs | Yes |
| Codex CLI | Full | Has everything this skill needs | Yes |
| Cursor | Full | Has everything this skill needs | Yes |
| Gemini CLI | Full | Has everything this skill needs | Yes |
| VS Code Copilot | Full | Has everything this skill needs | Yes |
| opencode / oh-my-pi | Full | Has everything this skill needs | Yes |
| Claude Desktop | Full | Has everything this skill needs | Yes |
| ChatGPT and other chat-only MCP clients | Full | Has everything this skill needs | No |
How we determine this
Nothing here was run or tested. Each verdict is derived from the skill's own files and a fixed rule table, so read it as a forecast, not a guarantee.
From the skill we read the tools its frontmatter allows, the languages of its bundled scripts, the commands it names in code, any network use and the MCP servers it expects.
From each client we use three things it can do on your machine with no extra servers: run commands, read and write files, fetch from the web. A chat app's built-in search does not count, because a skill cannot drive it.
Full means the client can do everything the skill needs. Instructions only means it can load and follow the text but lacks a capability the skill uses. No means the skill ships code and the client cannot run it.
--- name: clickhouse-js-node-rowbinary description: > 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. --- # ClickHouse JS RowBinary Codec Generator for Node.js This skill generates both directions of the wire format: **readers** (decode bytes → values) and **writers** (encode values → bytes, the mirror). A given task normally needs only one side. This file is the shared entry point — the format gate plus the principles common to both directions; the per-direction decisions, guidance, and the per-type reference tables live in two sibling files. **Pick your side — read only the one you need:** - **Decoding a `RowBinary*` response** from ClickHouse into JS values → **[reader.md](reader.md)**. Streaming vs whole-buffer, row-objects vs columnar, fixed vs runtime schema, and the per-type reader reference. - **Encoding JS values into a `RowBinary` payload** to send to ClickHouse → **[writer.md](writer.md)**. The `Sink`/`writeX` building blocks, `writeRows` streaming, and the per-type writer reference. The per-type code is real, split by direction under `src/readers/` and `src/writers/`. ## First: is RowBinary even the right format? RowBinary exists for throughput, but it is **not automatically the fastest path** — match the format to the shape of the data before committing to a bespoke parser. **Prefer a `JSON*` format (e.g. `JSONEachRow`) when** the result is mostly strings / JSON-like values that you consume wholesale — randomly accessing essentially every field, running string/regexp methods on them, treating values as text. V8's native `JSON.parse` is heavily optimized C++ and builds JS strings and objects faster than a JS-level RowBinary decoder can; pair it with HTTP response compression (`gzip` / `zstd`, which crushes JSON's repetitive keys) and the wire cost shrinks too. **RowBinary clearly wins when** the result is dominated by: - **Wide numerics** — `Int128`/`Int256`/`UInt128`/`UInt256`, `Decimal128`/`Decimal256`. - **Binary / fixed-width blobs** — `IPv4`, `IPv6`, `UUID`, `FixedString`. - **High-volume fixed-width numeric columns** generally, where each value is a single `DataView` read. **Prefer the `Native` format when** columnar load and client-side analytics are the main goal (fold/scan/filter columns, feed typed arrays to a Worker or WASM). `Native` is column-major, so it loads straight into one typed array per column with no transpose. For help choosing and consuming a `JSON*` format (or CSV / TSV) instead, use the **`clickhouse-js-node-coding`** skill. ## Core guidance (both directions) These principles apply whether you are generating a reader or a writer; the side-specific operational guidance is in [reader.md](reader.md) / [writer.md](writer.md). - **Little-endian only.** RowBinary is little-endian; target x86/ARM. Read and write every multi-byte number with `DataView` accessors passing a **literal** `true` for the `littleEndian` flag. - **Correct first, then optimize.** First emit a correct codec built from the plain per-type API. Only after it's correct (and tested) specialize it. Don't bake performance assumptions in before correctness. - **Monomorphize generic/composite types.** Emit specialized, inlined code per type combination instead of passing functions as arguments where the type is known ahead of time. - **Inline the leaf ops.** The per-type `readX`/`writeX` functions are the correct, composable reference; the generated codec should INLINE their bodies, not call them, so the row loop is straight-line with no per-field indirection (and so the fixed-width coalescing can fold the offset arithmetic together). - **Annotate the type per column.** Inlining erases the type structure, so put a short comment above each column's encode/decode block naming the ClickHouse type it handles. - **Shared scratch is not reentrant.** Some hot methods reuse a module-level scratch buffer as a write-then-read pair — correct only because the access is fully synchronous. An `async`/`yield` boundary between populating and reading it corrupts the value. - **TypeScript by default.** Generate TypeScript code and helpers unless the user explicitly asks for plain JavaScript. ## Worked examples Six end-to-end examples with real speedup are catalogued in [EXAMPLES.md](EXAMPLES.md). ## Out of scope - **JSON / CSV / TSV / Parquet parsing** → use `clickhouse-js-node-coding`. - **Connection errors, hangs, type mismatches** → use `clickhouse-js-node-troubleshooting`. - **Browser / Web Worker / Edge** → `@clickhouse/client-web`. ## Still Stuck? - [ClickHouse RowBinary format](https://clickhouse.com/docs/interfaces/formats#rowbinary) - [ClickHouse data types](https://clickhouse.com/docs/sql-reference/data-types) - [ClickHouse JS client docs](https://clickhouse.com/docs/integrations/javascript)
193 files, 678.8 KB
- .gitignore106 B
- AGENTS.md2.9 KB
- CHANGELOG.md3 KB
- EXAMPLES.md5.5 KB
- README.md15.3 KB
- SKILL.md5 KB
- case-studies/iot-rowbinary-vs-json.md4 KB
- case-studies/ledger-rowbinary-vs-json.md5.3 KB
- case-studies/logs-json-wins.md4.4 KB
- case-studies/wasm-vs-js.md9.9 KB
- eval_result.md6.2 KB
- eval_result_composer.md7.6 KB
- eval_result_haiku.md8.9 KB
- eval_result_sonnet.md6.1 KB
- package-lock.json40.1 KB
- package.json1.9 KB
- reader.md14.6 KB
- src/examples/carts.ts2.7 KB
- src/examples/events.ts2.1 KB
- src/examples/iot.ts6.3 KB
- src/examples/ledger.ts3.6 KB
- src/examples/logs.ts3 KB
- src/examples/observability.ts5.4 KB
- src/examples/orders.ts2.9 KB
- src/examples/profiles.ts2.2 KB
- src/examples/telemetry.ts3.5 KB
- src/readers/aggregateFunction.ts1.7 KB
- src/readers/bool.ts282 B
- src/readers/columnar.ts6 KB
- src/readers/compile.ts11.1 KB
- src/readers/composite.ts7.1 KB
- src/readers/core.ts3 KB
- src/readers/datetime.ts4.2 KB
- src/readers/decimals.ts2.5 KB
- src/readers/dynamic.ts12.3 KB
- src/readers/enums.ts1.6 KB
- src/readers/floats.ts1.3 KB
- src/readers/geo.ts3.5 KB
- src/readers/header.ts1 KB
- src/readers/integers.ts3.4 KB
- src/readers/interval.ts1.6 KB
- src/readers/ip.ts3.1 KB
- src/readers/json.ts1.4 KB
- src/readers/lowCardinality.ts750 B
- src/readers/nested.ts1 KB
- src/readers/nothing.ts1.3 KB
- src/readers/reader.ts3.1 KB
- src/readers/rowBinaryWithNamesAndTypes.ts6.9 KB
- src/readers/rows.ts2.3 KB
- src/readers/simpleAggregateFunction.ts797 B
- src/readers/stream.ts12 KB
- src/readers/strings.ts2 KB
- src/readers/time.ts2.2 KB
- src/readers/uuid.ts5.6 KB
- src/readers/varint.ts2.9 KB
- src/writers/aggregateFunction.ts796 B
- src/writers/bool.ts285 B
- src/writers/composite.ts5 KB
- src/writers/core.ts3.9 KB
- src/writers/datetime.ts4.5 KB
- src/writers/decimals.ts2.1 KB
- src/writers/enums.ts580 B
- src/writers/floats.ts1.8 KB
- src/writers/geo.ts4.5 KB
- src/writers/integers.ts3.7 KB
- src/writers/interval.ts463 B
- src/writers/ip.ts4.2 KB
- src/writers/lowCardinality.ts454 B
- src/writers/nested.ts776 B
- src/writers/nothing.ts941 B
- src/writers/rows.ts6.7 KB
- src/writers/simpleAggregateFunction.ts434 B
- src/writers/strings.ts3 KB
- src/writers/time.ts2.1 KB
- src/writers/uuid.ts2.2 KB
- src/writers/varint.ts2.4 KB
- src/writers/writer.ts3.1 KB
- tests/AggregateFunction.write.test.ts411 B
- tests/Array.test.ts2.3 KB
- tests/BFloat16.test.ts1.4 KB
- tests/Bool.test.ts1.1 KB
- tests/BoolEnumFloat.write.test.ts4.3 KB
- tests/Composite.write.test.ts3.2 KB
- tests/Date.test.ts1.3 KB
- tests/Date32.test.ts1.4 KB
- tests/DateTime.test.ts1.4 KB
- tests/DateTime.write.test.ts3.5 KB
- tests/DateTime64.test.ts1.9 KB
- tests/DateTime64P3.test.ts1.4 KB
- tests/DateTime64P6.test.ts1.4 KB
- tests/DateTime64P9.test.ts1.3 KB
- tests/Decimal.write.test.ts2.9 KB
- tests/Decimal128.test.ts1.6 KB
- tests/Decimal256.test.ts1.6 KB
- tests/Decimal32.test.ts1.9 KB
- tests/Decimal64.test.ts1.5 KB
- tests/Dynamic.test.ts12.6 KB
- tests/Enum16.test.ts1.9 KB
- tests/Enum8.test.ts1.8 KB
- tests/FixedString.test.ts1.4 KB
93 more files at the source.
- Licence
- Apache-2.0found in repository
- Listing
- Download the YAML
Gateway on port 7465 change
Saved in this browser only.
No gateway yet? Paste this in your terminal, then click Import again.
git clone https://github.com/versatile-sh/connector-engine && cd connector-engine && make upImport opens your own gateway in a new tab; this page never contacts it. How it works