Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/clickhouse-sdk-patterns

@0d57af8
Run it yourself

Production-ready patterns for @clickhouse/client — streaming inserts, typed queries, error handling, and connection management. Use when building robust ClickHouse integrations, implementing streaming inserts or low-memory streaming reads, or establishing team coding standards. Trigger with "clickhouse SDK patterns", "clickhouse client patterns", "clickhouse best practices", "clickhouse streaming insert".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/clickhouse-sdk-patterns

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesexamples.md

≈401 tokens on demand. Your agent reads this file only when SKILL.md points to it.

ClickHouse SDK Patterns — Worked Examples

Concrete, runnable usage of the patterns. Each example calls the helpers defined in SKILL.md (typed query helper) and references/implementation.md (streaming, batching, error handling).

Example 1: Typed aggregation query

Call the generic query<T> helper with a typed row shape and named parameters. ClickHouse returns numeric columns as strings in JSON, so type cnt as string.

// Usage
interface EventCount {
  event_type: string;
  cnt: string;  // ClickHouse JSON returns numbers as strings
}

const rows = await query<EventCount>(
  'SELECT event_type, count() AS cnt FROM events WHERE user_id = {user_id:UInt64} GROUP BY event_type',
  { user_id: 42 }
);

Example 2: Streaming a large result set

Iterate a multi-million-row SELECT without loading it all into memory, using the streamQuery async generator from references/implementation.md.

// Usage
for await (const event of streamQuery<{ event_type: string }>('SELECT * FROM events')) {
  process.stdout.write(`${event.event_type}\n`);
}

Example 3: Safe query with structured error result

Wrap a query so callers get a discriminated { data, error } result instead of a thrown exception — see safeQuery in references/implementation.md.

const { data, error } = await safeQuery<EventCount>(
  'SELECT event_type, count() AS cnt FROM events GROUP BY event_type'
);
if (error) {
  // error is a normalized string like "CH-60: ..." for server-side failures
  console.error(error);
} else {
  console.log(data);
}

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides production-ready coding patterns for the ClickHouse Node.js SDK, focusing on streaming, batching, and error handling. It correctly handles credentials via environment variables and emphasizes the use of parameterized queries to prevent SQL injection.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago
What it can do
Reads files
version
1.7.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
[
  "saas",
  "database",
  "analytics",
  "clickhouse",
  "olap"
]
All 1 allowed tools
Read
Other metadata
compatibility
Designed for Claude Code

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/clickhouse-sdk-patterns