Agent skill

Clickhouse SDK Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Production-ready patterns for @clickhouse/client — streaming inserts, typed queries, error handling, and connection management.

MITAuto-check passedDatabases

Install Clickhouse SDK Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill clickhouse-sdk-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace clickhouse-sdk-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/clickhouse-sdk-patterns .claude/skills/clickhouse-sdk-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
clickhouse-sdk-patterns
GitHub stars
2.8k
Token cost
~1.4k tokens
SKILL.md length
440 words
Files
3 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Production-ready patterns for @clickhouse/client — streaming inserts, typed queries, error handling, and connection management.

  • Works in 7 steps: Typed query helper — the foundation… → Streaming insert (backpressure-safe) —… → Batch insert with retry — chunk rows… → …
  • Building robust ClickHouse integrations
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 4 more sections
  • Needs CLICKHOUSE_PASSWORD

What it does

Clickhouse SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. 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".

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/examples.md` and `references/implementation.md`). Compatibility notes: Designed for Claude Code

It sits in Databases, covering Data warehousing. It works with ClickHouse. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Building robust ClickHouse integrations
  • Implementing streaming inserts
  • Low-memory streaming reads
  • Establishing team coding standards

Example prompts

  • “clickhouse SDK patterns”
  • “clickhouse client patterns”
  • “clickhouse best practices”
  • “/clickhouse-sdk-patterns”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Typed query helper — the foundation every other pattern builds on. Define
  2. Streaming insert (backpressure-safe) — stream large inserts through a
  3. Batch insert with retry — chunk rows (default 10k) with exponential-backoff
  4. Streaming SELECT (low memory) — consume large result sets as an
  5. Error handling — distinguish server-side ClickHouseError (code + message)
  6. Connection lifecycle — flush pending inserts on SIGTERM via
  7. Per-query settings — override max_threads, max_memory_usage,

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • clickhouse.com
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • CLICKHOUSE_PASSWORD

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Clickhouse SDK Patterns loads about 1.4k tokens when it runs, and up to ~3k if it reads all its reference files. Until then it costs about 108 tokens; SKILL.md has 440 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~108
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 440 words, ~1,406 tokens.

Download SKILL.mdSave it as .claude/skills/clickhouse-sdk-patterns/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
clickhouse-sdk-patterns
description
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".
allowed-tools
Read
compatibility
Designed for Claude Code
version
1.7.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, database, analytics, clickhouse, olap

ClickHouse SDK Patterns

Overview

Production patterns for @clickhouse/client — typed queries, streaming inserts, error handling, and connection lifecycle management. Start from the typed query helper below, then drill into references/implementation.md for the streaming, batching, and lifecycle patterns.

Prerequisites

  • @clickhouse/client installed and authenticated (see clickhouse-install-auth)
  • Node.js 18+ with a CLICKHOUSE_HOST / CLICKHOUSE_USER / CLICKHOUSE_PASSWORD env set
  • Familiarity with async/await and Node.js streams (backpressure, drain, Readable)

Instructions

Apply the pattern that fits your workload. Steps 2–7 live in references/implementation.md with full, copy-pasteable code; the core typed-query skeleton stays here.

  1. Typed query helper — the foundation every other pattern builds on. Define a generic query<T> wrapper that returns parsed rows (skeleton below).
  2. Streaming insert (backpressure-safe) — stream large inserts through a Readable instead of buffering in memory; honor drain.
  3. Batch insert with retry — chunk rows (default 10k) with exponential-backoff retries, returning { inserted, errors }.
  4. Streaming SELECT (low memory) — consume large result sets as an AsyncGenerator so you never load the full set into RAM.
  5. Error handling — distinguish server-side ClickHouseError (code + message) from network/client errors and normalize into a structured result.
  6. Connection lifecycle — flush pending inserts on SIGTERM via client.close(); expose a ping()-based health check.
  7. Per-query settings — override max_threads, max_memory_usage, max_execution_time, and max_result_rows for heavy queries.
Skeleton: Typed Query Helper
typescript
import { createClient } from '@clickhouse/client';

const client = createClient({
  url: process.env.CLICKHOUSE_HOST!,
  username: process.env.CLICKHOUSE_USER ?? 'default',
  password: process.env.CLICKHOUSE_PASSWORD ?? '',
});

// Generic typed query — returns parsed JSON rows
async function query<T>(sql: string, params?: Record<string, unknown>): Promise<T[]> {
  const rs = await client.query({
    query: sql,
    query_params: params,
    format: 'JSONEachRow',
  });
  return rs.json<T>();
}

Note on parameterized queries: ClickHouse uses {name:Type} syntax for parameters, not $1 or ?. Always use typed parameters to prevent SQL injection.

Output

Applying these patterns produces:

  • A single reusable client instance plus a generic query<T> helper that returns typed, parsed rows.
  • Streaming insert/read paths that keep memory flat regardless of dataset size.
  • A batch-insert result object { inserted: number; errors: Error[] } you can act on programmatically.
  • Normalized error results (CH-<code>: <message> for server-side failures) rather than raw thrown exceptions.
  • Graceful shutdown that flushes pending inserts before the process exits.
Show full SKILL.md (145 more words)Show less

Error Handling

Map common ClickHouse server error codes to a corrective action:

Error CodeMeaningAction
SYNTAX_ERROR (62)Bad SQLFix query syntax
UNKNOWN_TABLE (60)Table doesn't existCheck table name, database
TOO_MANY_SIMULTANEOUS_QUERIES (202)Connection overloadReduce concurrency or pool
MEMORY_LIMIT_EXCEEDED (241)Query uses too much RAMAdd filters, use streaming
TIMEOUT_EXCEEDED (159)Query too slowOptimize ORDER BY, add indexes

Full safeQuery wrapper (server-vs-client error discrimination) is in references/implementation.md under Pattern 5.

Examples

Worked, runnable usage of each helper is in references/examples.md. Quick look — a typed aggregation query with named parameters:

typescript
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 }
);

See references/examples.md for streaming reads and structured error-result usage.

Resources

Next Steps

Apply these patterns in clickhouse-core-workflow-a for real data modeling, then tune query cost and concurrency with clickhouse-cost-tuning and clickhouse-performance-tuning.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/.curated/clickhouse-sdk-patterns of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/examples.md
  • references/implementation.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Clickhouse SDK Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Clickhouse SDK Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clickhouse SDK Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.4kAutomated safety check: PassMIT
Keeper Stress AnalysisClickHouse/ClickHouse50k—~4.7kAutomated safety check: PassApache-2.0
Perf ComparisonClickHouse/ClickHouse50k—~3.9kAutomated safety check: NotesApache-2.0
Patch Release CheckClickHouse/ClickHouse50k—~4kAutomated safety check: NotesApache-2.0
Clickhouse Architecture Advisorvemetric/vemetric3952 repos~791Automated safety check: PassApache-2.0
Decompress BinaryClickHouse/ClickHouse50k—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • Keeper Stress Analysis

    ClickHouse/ClickHouse

    Analyze ClickHouse Keeper stress-test results from play.clickhouse.com / keeperstresstests data warehouse.

    50k GitHub stars~4.7k tokensUpdated today
    DatabasesAuto-check passed
  • Perf Comparison

    ClickHouse/ClickHouse

    Evaluate ClickHouse performance test results from existing CI/dashboard data or local perf.py runs.

    50k GitHub stars~3.9k tokensUpdated today
    DatabasesAuto-check: notes
  • Patch Release Check

    ClickHouse/ClickHouse

    Check whether ClickHouse's supported versions (last 3 majors + latest LTS) have recent stable patch releases, diagnose why the scheduled AutoReleases pipeline failed, and identify which releases…

    50k GitHub stars~4k tokensUpdated today
    DatabasesAuto-check: notes
  • MUST USE when designing ClickHouse architectures, selecting between ingestion or modeling patterns, or translating best practices into workload-specific system designs.

    395 GitHub starsUsed in 2 repos~791 tokens
    DatabasesAuto-check passed
  • Decompress Binary

    ClickHouse/ClickHouse

    Extract the inner ELF from a ClickHouse self-extracting clickhouse binary, including when its architecture differs from the host (e.g.

    50k GitHub stars~1.1k tokensUpdated today
    DatabasesAuto-check passed
  • Good PRs

    ClickHouse/ClickHouse

    Show a report of open ClickHouse PRs whose only non-green CI check is "CH Inc sync" (or that are fully green) — i.e.

    50k GitHub stars~1.8k tokensUpdated today
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Clickhouse SDK Patterns

What does Clickhouse SDK Patterns do?

Production-ready patterns for @clickhouse/client — streaming inserts, typed queries, error handling, and connection management. Clickhouse SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Production-ready patterns for @clickhouse/client — streaming inserts, typed queries, error handling, and connection management.

When should I use Clickhouse SDK Patterns?

Clickhouse SDK Patterns fits situations like: building robust ClickHouse integrations; implementing streaming inserts; low-memory streaming reads; establishing team coding standards.

How do I install Clickhouse SDK Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clickhouse-sdk-patterns -a claude-code`. Or copy the skill folder (skills/.curated/clickhouse-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/clickhouse-sdk-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Clickhouse SDK Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clickhouse-sdk-patterns -a codex`. Or copy the skill folder (skills/.curated/clickhouse-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/clickhouse-sdk-patterns in your project. Codex loads it when a task matches its description.

Can I use Clickhouse SDK Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clickhouse-sdk-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clickhouse-sdk-patterns, .gemini/skills/clickhouse-sdk-patterns, .github/skills/clickhouse-sdk-patterns and .opencode/skills/clickhouse-sdk-patterns in your project.

What does Clickhouse SDK Patterns need to run?

Going by SKILL.md and its folder, Clickhouse SDK Patterns needs credentials named CLICKHOUSE_PASSWORD. Our summary lists: Node.js. Its frontmatter pre-approves these tools: Read. Compatibility (from SKILL.md): Designed for Claude Code.

Does Clickhouse SDK Patterns access the network?

SKILL.md names 2 domains. As links in the text: clickhouse.com and github.com. This is read from the text; nothing was executed.

Is Clickhouse SDK Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Clickhouse SDK Patterns use?

Clickhouse SDK Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clickhouse SDK Patterns use?

About 1.4k tokens (SKILL.md is roughly 5.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.6k tokens, read only when the agent opens those files.

What are the alternatives to Clickhouse SDK Patterns?

Skills that share tags, products or a category with Clickhouse SDK Patterns: Keeper Stress Analysis (ClickHouse/ClickHouse, 50k stars), Perf Comparison (ClickHouse/ClickHouse, 50k stars), Patch Release Check (ClickHouse/ClickHouse, 50k stars) and Clickhouse Architecture Advisor (vemetric/vemetric, 395 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clickhouse SDK Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.