clickhouse/agent-skills193 files

Clickhouse JS Node Rowbinary

>

Specification
Skill ID
clickhouse/agent-skills/clickhouse-js-node-rowbinary
Publisher
clickhouse
Repository
agent-skills
Installs
0
Files
193
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

clickhouse/agent-skills/clickhouse-js-node-rowbinaryInstalls these files
  • .gitignore
  • AGENTS.md
  • CHANGELOG.md
  • EXAMPLES.md
  • README.md
  • SKILL.md
  • case-studies/iot-rowbinary-vs-json.md
  • case-studies/ledger-rowbinary-vs-json.md
  • case-studies/logs-json-wins.md
  • case-studies/wasm-vs-js.md
  • eval_result.md
  • eval_result_composer.md
  • eval_result_haiku.md
  • eval_result_sonnet.md
  • package-lock.json
  • package.json
  • reader.md
  • src/examples/carts.ts
  • src/examples/events.ts
  • src/examples/iot.ts
  • src/examples/ledger.ts
  • src/examples/logs.ts
  • src/examples/observability.ts
  • src/examples/orders.ts
  • src/examples/profiles.ts
  • src/examples/telemetry.ts
  • src/readers/aggregateFunction.ts
  • src/readers/bool.ts
  • src/readers/columnar.ts
  • src/readers/compile.ts
  • src/readers/composite.ts
  • src/readers/core.ts
  • src/readers/datetime.ts
  • src/readers/decimals.ts
  • src/readers/dynamic.ts
  • src/readers/enums.ts
  • src/readers/floats.ts
  • src/readers/geo.ts
  • src/readers/header.ts
  • src/readers/integers.ts
  • src/readers/interval.ts
  • src/readers/ip.ts
  • src/readers/json.ts
  • src/readers/lowCardinality.ts
  • src/readers/nested.ts
  • src/readers/nothing.ts
  • src/readers/reader.ts
  • src/readers/rowBinaryWithNamesAndTypes.ts
  • src/readers/rows.ts
  • src/readers/simpleAggregateFunction.ts
  • src/readers/stream.ts
  • src/readers/strings.ts
  • src/readers/time.ts
  • src/readers/uuid.ts
  • src/readers/varint.ts
  • src/writers/aggregateFunction.ts
  • src/writers/bool.ts
  • src/writers/composite.ts
  • src/writers/core.ts
  • src/writers/datetime.ts
  • src/writers/decimals.ts
  • src/writers/enums.ts
  • src/writers/floats.ts
  • src/writers/geo.ts
  • src/writers/integers.ts
  • src/writers/interval.ts
  • src/writers/ip.ts
  • src/writers/lowCardinality.ts
  • src/writers/nested.ts
  • src/writers/nothing.ts
  • src/writers/rows.ts
  • src/writers/simpleAggregateFunction.ts
  • src/writers/strings.ts
  • src/writers/time.ts
  • src/writers/uuid.ts
  • src/writers/varint.ts
  • src/writers/writer.ts
  • tests/AggregateFunction.write.test.ts
  • tests/Array.test.ts
  • tests/BFloat16.test.ts
  • tests/Bool.test.ts
  • tests/BoolEnumFloat.write.test.ts
  • tests/Composite.write.test.ts
  • tests/Date.test.ts
  • tests/Date32.test.ts
  • tests/DateTime.test.ts
  • tests/DateTime.write.test.ts
  • tests/DateTime64.test.ts
  • tests/DateTime64P3.test.ts
  • tests/DateTime64P6.test.ts
  • tests/DateTime64P9.test.ts
  • tests/Decimal.write.test.ts
  • tests/Decimal128.test.ts
  • tests/Decimal256.test.ts
  • tests/Decimal32.test.ts
  • tests/Decimal64.test.ts
  • tests/Dynamic.test.ts
  • tests/Enum16.test.ts
  • tests/Enum8.test.ts
  • tests/FixedString.test.ts
  • tests/FixedStringBytes.test.ts
  • tests/Float32.test.ts
  • tests/Float64.test.ts
  • tests/Geo.write.test.ts
  • tests/Geometry.test.ts
  • tests/IP.write.test.ts
  • tests/IPv4.test.ts
  • tests/IPv6.test.ts
  • tests/Int128.test.ts
  • tests/Int16.test.ts
  • tests/Int256.test.ts
  • tests/Int32.test.ts
  • tests/Int64.test.ts
  • tests/Int8.test.ts
  • tests/Integers.write.test.ts
  • tests/Interval.test.ts
  • tests/JSON.test.ts
  • tests/LineString.test.ts
  • tests/Map.test.ts
  • tests/MultiLineString.test.ts
  • tests/MultiPolygon.test.ts
  • tests/Nothing.write.test.ts
  • tests/Nullable.test.ts
  • tests/Point.test.ts
  • tests/Polygon.test.ts
  • tests/Ring.test.ts
  • tests/Rows.write.test.ts
  • tests/String.test.ts
  • tests/String.write.test.ts
  • tests/Time.test.ts
  • tests/Time64.test.ts
  • tests/TimeInterval.write.test.ts
  • tests/Tuple.test.ts
  • tests/TupleNamed.test.ts
  • tests/UInt128.test.ts
  • tests/UInt16.test.ts
  • tests/UInt256.test.ts
  • tests/UInt32.test.ts
  • tests/UInt64.test.ts
  • tests/UInt8.test.ts
  • tests/UUID.test.ts
  • tests/UUID.write.test.ts
  • tests/UUIDBigInt.test.ts
  • tests/UUIDHiLo.test.ts
  • tests/UVarint.test.ts
  • tests/UVarint.write.test.ts
  • tests/Variant.test.ts
  • tests/advance.test.ts
  • tests/aggregateFunction.test.ts
  • tests/carts.bench.ts
  • tests/carts.example.test.ts
  • tests/clickhouse.ts
  • tests/coalesceChunks.test.ts
  • tests/columnar.test.ts
  • tests/combinations.generated.test.ts
  • tests/compile.test.ts
  • tests/encode.ts
  • tests/events.bench.ts
  • tests/events.example.test.ts
  • tests/framing-interleaved.test.ts
  • tests/framing-nested.test.ts
  • tests/framing.test.ts
  • tests/iot.bench.ts
  • tests/iot.columnar.bench.ts
  • tests/iot.wasm-headroom.bench.ts
  • tests/ledger.bench.ts
  • tests/logs.bench.ts
  • tests/lowCardinality.test.ts
  • tests/nested.test.ts
  • tests/nothing.test.ts
  • tests/observability.bench.ts
  • tests/observability.example.test.ts
  • tests/orders.bench.ts
  • tests/orders.example.test.ts
  • tests/parseIP.bench.ts
  • tests/profiles.bench.ts
  • tests/profiles.example.test.ts
  • tests/qbit.test.ts
  • tests/readHeader.test.ts
  • tests/readUUID.bench.ts
  • tests/rowBinaryWithNamesAndTypes.order.test.ts
  • tests/rowBinaryWithNamesAndTypes.test.ts
  • tests/rows.test.ts
  • tests/simpleAggregateFunction.test.ts
  • tests/streamRowBatches.test.ts
  • tests/streamingRow.bench.ts
  • tests/telemetry.bench.ts
  • tests/telemetry.example.test.ts
  • tests/wasm-int128.experiment.mjs
  • tsconfig.build.json
  • tsconfig.json
  • vitest.config.ts
  • writer.md

What this skill tells the agent

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**. 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 / 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.

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?

Use this skill in a project

Open any RiverX project, search the Skills panel for clickhouse/agent-skills/clickhouse-js-node-rowbinary, and install it in one click.

Use this skill