chdb-datastore
Use when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or…
MUST USE when reviewing ClickHouse schemas, queries, native full-text search, or configurations. Contains 36 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses.
Claude Code
$ npx -y skills add clickhouse/agent-skills --skill clickhouse-best-practices --agent claude-code
Codex
$ npx skills add clickhouse/agent-skills --skill clickhouse-best-practices -a codex -y
Cursor
$ npx skills add clickhouse/agent-skills --skill clickhouse-best-practices -a cursor -y
Gemini CLI
$ npx skills add clickhouse/agent-skills --skill clickhouse-best-practices -a gemini-cli -y
GitHub Copilot
$ npx skills add clickhouse/agent-skills --skill clickhouse-best-practices -a github-copilot -y
OpenCode
$ npx skills add clickhouse/agent-skills --skill clickhouse-best-practices -a opencode -y
Windsurf
$ npx skills add clickhouse/agent-skills --skill clickhouse-best-practices -a windsurf -y
name: clickhouse-best-practices description: MUST USE when reviewing ClickHouse schemas, queries, native full-text search, or configurations. Contains 36 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 version: "0.5.0"
Comprehensive guidance for ClickHouse covering schema design, query optimization, data ingestion, and AI agent connectivity. Contains 36 rules across 4 main categories (schema, query, insert, agent), prioritized by impact.
> **Official docs:** [ClickHouse Best Practices](https://clickhouse.com/docs/best-practices)
**Before answering ClickHouse questions, follow this priority order:**
1. **Check for applicable rules** in the `rules/` directory 2. **If rules exist:** Apply rules that match the deployed ClickHouse version and cite them using "Per `rule-name`...". Verify evolving features against version-specific official documentation; do not override newer authoritative evidence with an older rule. 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.
---
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`)
If your system dispatches ClickHouse tasks to specialized subagents:
---
**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:**
**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:**
Read the relevant files directly:
1. `rules/query-index-text-native.md` - Native postings, version baseline, granularity, legacy indexes 2. `rules/query-index-text-semantics.md` - Full search operation map, correctness, phrases, and capability boundaries 3. `rules/query-index-text-analysis.md` - Tokenizers, languages, normalization, stemming, and stop words 4. `rules/query-index-text-plan.md` - Direct read, hints, fallback, and EXPLAIN evidence 5. `rules/query-index-text-lifecycle.md` - Existing-part materialization and migration
For any full-text-search question, establish the search contract (tokens, substrings, phrases, language, fields, ranking), deployed version/build, and indexed expression. Native text indexes store row-ID postings: their large granularity does not restrict them to part-level decisions. Eligible predicates can be exact, candidate hints, or ordinary pruning; preserve the original match semantics.
Read these references for the relevant feature details:
Do not promise native BM25/fuzzy ranking, universal language segmentation, same-element matches across
The official Agent Skills for ClickHouse. These skills help LLMs and agents to adopt best practices when working with ClickHouse and chdb (in-process ClickHouse for Python). You can use these skills with open-source ClickHouse and managed ClickHouse Cloud.
Use when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or…
Use when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote…
MUST USE when designing ClickHouse architectures, selecting between ingestion or modeling patterns, or translating best practices…
Write idiomatic application code with the ClickHouse Node.js client (`@clickhouse/client`). Use this skill whenever a user is…
Generate TypeScript/JavaScript code that reads/decodes AND writes/encodes ClickHouse RowBinary streams for the ClickHouse HTTP…
Troubleshoot and resolve common issues with the ClickHouse Node.js client (@clickhouse/client). Use this skill whenever a user…
Sweep the googleapis/mcp-toolbox docs for broken and non-canonical links, report each finding with its cause, and apply the safe…
Create reusable Convex components with clear boundaries and a small app-facing API.