Agent skill

Clickhouse Best Practices

by vemetric in vemetric/vemetric

MUST USE when reviewing ClickHouse schemas, queries, or configurations.

Apache-2.0Auto-check passedDatabases

Install Clickhouse Best Practices

skills CLI
$ npx skills add vemetric/vemetric --skill clickhouse-best-practices -a claude-code

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

GitHub CLI
$ gh skill install vemetric/vemetric clickhouse-best-practices --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/vemetric/vemetric.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/clickhouse-best-practices .claude/skills/clickhouse-best-practices && 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-best-practices
GitHub stars
395
Used in
2 other repos
Token cost
~2.6k tokens
SKILL.md length
1,000 words
Files
36
Skills in repo
6
Repo updated
First seen
Licence
Apache-2.0

At a glance

MUST USE when reviewing ClickHouse schemas, queries, or configurations.

  • Works in 5 steps: Check for applicable rules in the rules/… → If rules exist: Apply them and cite them… → If no rule exists: Use the LLM's… → …
  • Reviewing ClickHouse schemas
  • SKILL.md covers IMPORTANT: How to Apply This…, Agent Connectivity & Query…, Review Procedures and Output Format, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Clickhouse Best Practices is an agent skill from vemetric/vemetric. MUST USE when reviewing ClickHouse schemas, queries, or configurations. Contains 31 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 36 other files (for example `AGENTS.md`, `README.md` and `rules/_sections.md`).

It sits in Databases, covering Data warehousing. It works with ClickHouse and Model Context Protocol. The repository describes itself as: Simple, yet powerful Web- & Product Analytics. The licence is Apache-2.0.

When your agent uses it

  • Reviewing ClickHouse schemas
  • Tasks that involve Data warehousing

Example prompts

  • “/clickhouse-best-practices”

Workflow steps

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

  1. Check for applicable rules in the rules/ directory
  2. If rules exist: Apply them and cite them in your response using "Per rule-name..."
  3. If no rule exists: Use the LLM's ClickHouse knowledge or search documentation
  4. If uncertain: Use web search for current best practices
  5. Always cite your source: rule name, "general ClickHouse guidance", or URL

What it can do on your machine

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

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    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

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

  • Credentials

    Names no API keys, tokens, secrets or passwords.

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

Context cost

Clickhouse Best Practices loads about 2.6k tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 1,000 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

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 vemetric/vemetric at commit 2352ee8, republished under its Apache-2.0 licence (© vemetric). 1,000 words, ~2,585 tokens.

Download SKILL.mdSave it as .claude/skills/clickhouse-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 35 other files; get the full folder from GitHub.
name
clickhouse-best-practices
description
MUST USE when reviewing ClickHouse schemas, queries, or configurations. Contains 31 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses.
license
Apache-2.0
metadata.author
ClickHouse Inc
metadata.version
0.4.0

ClickHouse Best Practices

Comprehensive guidance for ClickHouse covering schema design, query optimization, data ingestion, and AI agent connectivity. Contains 31 rules across 4 main categories (schema, query, insert, agent), prioritized by impact.

Official docs: ClickHouse Best Practices

IMPORTANT: How to Apply This Skill

Before answering ClickHouse questions, follow this priority order:

  1. Check for applicable rules in the rules/ directory
  2. If rules exist: Apply them and cite them in your response using "Per rule-name..."
  3. If no rule exists: Use the LLM's ClickHouse knowledge or search documentation
  4. If uncertain: Use web search for current best practices
  5. Always cite your source: rule name, "general ClickHouse guidance", or URL

Why rules take priority: ClickHouse has specific behaviors (columnar storage, sparse indexes, merge tree mechanics) where general database intuition can be misleading. The rules encode validated, ClickHouse-specific guidance.


Agent Connectivity & Query Workflow

Before querying ClickHouse, agents must establish a connection and follow the discovery workflow:

  1. rules/agent-connect-mcp.md - Connection setup (MCP + CLI), credential discovery, output format selection
  2. rules/agent-discovery-schema.md - CRITICAL: 7-step schema discovery workflow
  3. rules/agent-query-safety.md - CRITICAL: LIMIT, timeouts, progressive exploration

Every agent session should follow this sequence:

  1. Connect — establish connection via MCP or CLI (see agent-connect-mcp)
  2. Discover — databases → tables → columns + comments → sort keys → skip indexes → sample → EXPLAIN
  3. Plan — use sort key and skip index knowledge to write efficient WHERE clauses
  4. Execute — run queries with LIMIT and timeouts
  5. Recover — on timeout/memory errors, narrow filters and retry (see agent-query-safety)
Subagent architecture notes

If your system dispatches ClickHouse tasks to specialized subagents:

  • Schema discovery + query execution: any model — the steps are procedural
  • EXPLAIN analysis + query optimization: benefits from mid-tier reasoning
  • Schema design review against all 28 rules: benefits from mid-tier reasoning

Review Procedures

For Schema Reviews (CREATE TABLE, ALTER TABLE)

Read these rule files in order:

  1. rules/schema-pk-plan-before-creation.md - ORDER BY is immutable
  2. rules/schema-pk-cardinality-order.md - Column ordering in keys
  3. rules/schema-pk-prioritize-filters.md - Filter column inclusion
  4. rules/schema-types-native-types.md - Proper type selection
  5. rules/schema-types-minimize-bitwidth.md - Numeric type sizing
  6. rules/schema-types-lowcardinality.md - LowCardinality usage
  7. rules/schema-types-avoid-nullable.md - Nullable vs DEFAULT
  8. rules/schema-partition-low-cardinality.md - Partition count limits
  9. rules/schema-partition-lifecycle.md - Partitioning purpose

Check for:

  • PRIMARY KEY / ORDER BY column order (low-to-high cardinality)
  • Data types match actual data ranges
  • LowCardinality applied to appropriate string columns
  • Partition key cardinality bounded (100-1,000 values)
  • ReplacingMergeTree has version column if used
For Query Reviews (SELECT, JOIN, aggregations)

Read these rule files:

  1. rules/query-join-choose-algorithm.md - Algorithm selection
  2. rules/query-join-filter-before.md - Pre-join filtering
  3. rules/query-join-use-any.md - ANY vs regular JOIN
  4. rules/query-index-skipping-indices.md - Secondary index usage
  5. rules/schema-pk-filter-on-orderby.md - Filter alignment with ORDER BY

Check for:

  • Filters use ORDER BY prefix columns
  • JOINs filter tables before joining (not after)
  • Correct JOIN algorithm for table sizes
  • Skipping indices for non-ORDER BY filter columns
For Insert Strategy Reviews (data ingestion, updates, deletes)

Read these rule files:

  1. rules/insert-batch-size.md - Batch sizing requirements
  2. rules/insert-mutation-avoid-update.md - UPDATE alternatives
  3. rules/insert-mutation-avoid-delete.md - DELETE alternatives
  4. rules/insert-async-small-batches.md - Async insert usage
  5. rules/insert-optimize-avoid-final.md - OPTIMIZE TABLE risks

Check for:

  • Batch size 10K-100K rows per INSERT
  • No ALTER TABLE UPDATE for frequent changes
  • ReplacingMergeTree or CollapsingMergeTree for update patterns
  • Async inserts enabled for high-frequency small batches

Output Format

Structure your response as follows:

## Rules Checked
- `rule-name-1` - Compliant / Violation found
- `rule-name-2` - Compliant / Violation found
...

## Findings

### Violations
- **`rule-name`**: Description of the issue
  - Current: [what the code does]
  - Required: [what it should do]
  - Fix: [specific correction]

### Compliant
- `rule-name`: Brief note on why it's correct

## Recommendations
[Prioritized list of changes, citing rules]

Rule Categories by Priority

PriorityCategoryImpactPrefixRule Count
1Primary Key SelectionCRITICALschema-pk-4
2Data Type SelectionCRITICALschema-types-5
3JOIN OptimizationCRITICALquery-join-5
4Insert BatchingCRITICALinsert-batch-1
5Mutation AvoidanceCRITICALinsert-mutation-2
6Partitioning StrategyHIGHschema-partition-4
7Skipping IndicesHIGHquery-index-1
8Materialized ViewsHIGHquery-mv-2
9Async InsertsHIGHinsert-async-2
10OPTIMIZE AvoidanceHIGHinsert-optimize-1
11JSON UsageMEDIUMschema-json-1
12Agent Schema DiscoveryCRITICALagent-discovery-1
13Agent Query SafetyCRITICALagent-query-1
14Agent Connectivity + FormatsHIGHagent-connect-1

Show full SKILL.md (390 more words)Show less

Quick Reference

Schema Design - Primary Key (CRITICAL)
  • schema-pk-plan-before-creation - Plan ORDER BY before table creation (immutable)
  • schema-pk-cardinality-order - Order columns low-to-high cardinality
  • schema-pk-prioritize-filters - Include frequently filtered columns
  • schema-pk-filter-on-orderby - Query filters must use ORDER BY prefix
Schema Design - Data Types (CRITICAL)
  • schema-types-native-types - Use native types, not String for everything
  • schema-types-minimize-bitwidth - Use smallest numeric type that fits
  • schema-types-lowcardinality - LowCardinality for <10K unique strings
  • schema-types-enum - Enum for finite value sets with validation
  • schema-types-avoid-nullable - Avoid Nullable; use DEFAULT instead
Schema Design - Partitioning (HIGH)
  • schema-partition-low-cardinality - Keep partition count 100-1,000
  • schema-partition-lifecycle - Use partitioning for data lifecycle, not queries
  • schema-partition-query-tradeoffs - Understand partition pruning trade-offs
  • schema-partition-start-without - Consider starting without partitioning
Schema Design - JSON (MEDIUM)
  • schema-json-when-to-use - JSON for dynamic schemas; typed columns for known
Query Optimization - JOINs (CRITICAL)
  • query-join-choose-algorithm - Select algorithm based on table sizes
  • query-join-use-any - ANY JOIN when only one match needed
  • query-join-filter-before - Filter tables before joining
  • query-join-consider-alternatives - Dictionaries/denormalization vs JOIN
  • query-join-null-handling - join_use_nulls=0 for default values
Query Optimization - Indices (HIGH)
  • query-index-skipping-indices - Skipping indices for non-ORDER BY filters
Query Optimization - Materialized Views (HIGH)
  • query-mv-incremental - Incremental MVs for real-time aggregations
  • query-mv-refreshable - Refreshable MVs for complex joins
Insert Strategy - Batching (CRITICAL)
  • insert-batch-size - Batch 10K-100K rows per INSERT
Insert Strategy - Async (HIGH)
  • insert-async-small-batches - Async inserts for high-frequency small batches
  • insert-format-native - Native format for best performance
Insert Strategy - Mutations (CRITICAL)
  • insert-mutation-avoid-update - ReplacingMergeTree instead of ALTER UPDATE
  • insert-mutation-avoid-delete - Lightweight DELETE or DROP PARTITION
Insert Strategy - Optimization (HIGH)
  • insert-optimize-avoid-final - Let background merges work
Agent Integration - Discovery (CRITICAL)
  • agent-discovery-schema - Always discover schema before querying
Agent Integration - Safety (CRITICAL)
  • agent-query-safety - LIMIT, timeouts, progressive exploration
Agent Integration - Connectivity + Formats (HIGH)
  • agent-connect-mcp - MCP + CLI setup, credential discovery, output format selection

When to Apply

This skill activates when you encounter:

  • AI agent connecting to ClickHouse (MCP, CLI, HTTP)

  • Agent workflow design for ClickHouse

  • Schema discovery or exploration requests

  • CREATE TABLE statements

  • ALTER TABLE modifications

  • ORDER BY or PRIMARY KEY discussions

  • Data type selection questions

  • Slow query troubleshooting

  • JOIN optimization requests

  • Data ingestion pipeline design

  • Update/delete strategy questions

  • ReplacingMergeTree or other specialized engine usage

  • Partitioning strategy decisions


Rule File Structure

Each rule file in rules/ contains:

  • YAML frontmatter: title, impact level, tags
  • Brief explanation: Why this rule matters
  • Incorrect example: Anti-pattern with explanation
  • Correct example: Best practice with explanation
  • Additional context: Trade-offs, when to apply, references

Full Compiled Document

For the complete guide with all rules expanded inline: AGENTS.md

Use AGENTS.md when you need to check multiple rules quickly without reading individual files.

© vemetric, Apache-2.0. 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 35 other files in .agents/skills/clickhouse-best-practices of vemetric/vemetric.

  • SKILL.md
  • AGENTS.md
  • README.md
  • rules/_sections.md
  • rules/_template.md
  • rules/agent-connect-mcp.md
  • rules/agent-discovery-schema.md
  • rules/agent-query-safety.md
  • rules/insert-async-small-batches.md
  • rules/insert-batch-size.md
  • rules/insert-format-native.md
  • rules/insert-mutation-avoid-delete.md
  • rules/insert-mutation-avoid-update.md
  • rules/insert-optimize-avoid-final.md
  • rules/query-index-skipping-indices.md
  • rules/query-join-choose-algorithm.md
  • rules/query-join-consider-alternatives.md
  • rules/query-join-filter-before.md
  • rules/query-join-null-handling.md
  • rules/query-join-use-any.md
  • … and 16 more

Open the folder on GitHubat commit 2352ee8

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in vemetric/vemetric, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Clickhouse Best Practices 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 Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clickhouse Best Practices this skillvemetric/vemetric3952 repos~2.6kAutomated safety check: PassApache-2.0
Webapp Buildersidequery/sidemantic129—~5.5kAutomated safety check: PassAGPL-3.0
Releasehypequery/hypequery103—~623Automated safety check: PassCustom licence
Modelersidequery/sidemantic129—~4.2kAutomated safety check: PassApache-2.0
Semantic Analystsidequery/sidemantic129—~982Automated safety check: PassAGPL-3.0
Manual Testhypequery/hypequery103—~618Automated safety check: PassCustom licence

Similar skills

  • Webapp Builder

    sidequery/sidemantic

    Build interactive analytics webapps, demos, dashboards, or embedded app surfaces from Sidemantic semantic models using copyable component primitives and deterministic query inspection.

    129 GitHub stars~5.5k tokensUpdated 3 days ago
    DatabasesAuto-check passed
  • Release

    hypequery/hypequery

    Cut a stable hypequery release via Changesets, or explain/check the canary flow.

    103 GitHub stars~623 tokensUpdated today
    DatabasesAuto-check passed
  • Modeler

    sidequery/sidemantic

    Build, validate, and manage semantic models using Sidemantic.

    129 GitHub stars~4.2k tokensUpdated 3 days ago
    DatabasesAuto-check passed
  • Semantic Analyst

    sidequery/sidemantic

    Answer analytical, KPI, metric, trend, cohort, and business-performance questions through a Sidemantic semantic layer.

    129 GitHub stars~982 tokensUpdated 3 days ago
    DatabasesAuto-check passed
  • Manual Test

    hypequery/hypequery

    Execute one of the model-runnable E2E test specs in testing/ (cli, datasets, serve, mcp, react) against a real ClickHouse instance.

    103 GitHub stars~618 tokensUpdated today
    DatabasesAuto-check passed
  • Pytorch Clickhouse

    pytorch/test-infra

    Load this FIRST whenever working with PyTorch CI data (any pytorch/ org repo), the torchci/HUD codebase, or the PyTorch HUD ClickHouse database.

    113 GitHub stars~2.8k tokensUpdated today
    DatabasesAuto-check passed

More from vemetric/vemetric

  • Chdb Datastore

    vemetric/vemetric

    A skill your agent uses when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or speed up slow pandas.

    395 GitHub starsUsed in 2 repos~1.4k tokens
    Auto-check passed
  • Chdb SQL

    vemetric/vemetric

    A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…

    395 GitHub starsUsed in 1 repo~1.2k tokens
    Auto-check passed
  • 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
    Auto-check passed
  • Clickhouse JS Node Coding

    vemetric/vemetric

    Write idiomatic application code with the ClickHouse Node.js client (@clickhouse/client).

    395 GitHub starsUsed in 1 repo~2.8k tokens
    Auto-check passed
  • Troubleshoot and resolve common issues with the ClickHouse Node.js client (@clickhouse/client).

    395 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed

Categories

Questions about Clickhouse Best Practices

What does Clickhouse Best Practices do?

MUST USE when reviewing ClickHouse schemas, queries, or configurations. Clickhouse Best Practices is an agent skill from vemetric/vemetric. MUST USE when reviewing ClickHouse schemas, queries, or configurations.

When should I use Clickhouse Best Practices?

Clickhouse Best Practices fits situations like: reviewing ClickHouse schemas; tasks that involve Data warehousing.

How do I install Clickhouse Best Practices in Claude Code?

Run `npx skills add vemetric/vemetric --skill clickhouse-best-practices -a claude-code`. Or copy the skill folder (.agents/skills/clickhouse-best-practices in vemetric/vemetric) into .claude/skills/clickhouse-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install Clickhouse Best Practices in Codex?

Run `npx skills add vemetric/vemetric --skill clickhouse-best-practices -a codex`. Or copy the skill folder (.agents/skills/clickhouse-best-practices in vemetric/vemetric) into .agents/skills/clickhouse-best-practices in your project. Codex loads it when a task matches its description.

Can I use Clickhouse Best Practices 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 vemetric/vemetric --skill clickhouse-best-practices -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-best-practices, .gemini/skills/clickhouse-best-practices, .github/skills/clickhouse-best-practices and .opencode/skills/clickhouse-best-practices in your project.

What does Clickhouse Best Practices need to run?

SKILL.md names no scripts, command-line tools or credentials: Clickhouse Best Practices is instructions for the agent only.

Does Clickhouse Best Practices access the network?

SKILL.md names 1 domain. As links in the text: clickhouse.com. This is read from the text; nothing was executed.

Is Clickhouse Best Practices 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 Best Practices use?

Clickhouse Best Practices is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clickhouse Best Practices use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Clickhouse Best Practices?

Skills that share tags, products or a category with Clickhouse Best Practices: Webapp Builder (sidequery/sidemantic, 129 stars), Release (hypequery/hypequery, 103 stars), Modeler (sidequery/sidemantic, 129 stars) and Semantic Analyst (sidequery/sidemantic, 129 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clickhouse Best Practices?

vemetric (a GitHub organization) maintains it in vemetric/vemetric, which has 395 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 9, 2026.

Source: vemetric/vemetric on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.