Token导航 LogoToken导航TokenDH.com
开发规范敏感数据github未标认证来源可访问许可证需确认审计通过

clickhouse-best-practicesCLIckHouse 最佳实践

Agent Skill

clickhouse-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

309

周安装

13

GitHub Stars

4

下载量

108
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:clickhouse-best-practices(CLIckHouse 最佳实践)
来源仓库:https://github.com/duyet/claude-plugins
仓库路径:skills/clickhouse-best-practices
安装命令:
npx skills add https://github.com/duyet/claude-plugins --skill clickhouse-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/duyet/claude-plugins --skill clickhouse-best-practices

简介

clickhouse-best-practices 提供 ClickHouse 数据库的最佳实践指南,涵盖模式设计、查询优化和数据导入。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中需要优化数据库性能或规范开发时使用。
  • 可通过 npx skills add 命令从 GitHub 安装,需确认权限范围和维护状态后再使用。
  • 使用前建议核验是否会触发联网、命令执行或文件读写操作。
  • 可结合来源仓库和原始 README 进一步了解具体用法和限制条件。

SKILL.md

ClickHouse Best Practices

Guidance for ClickHouse covering schema design, query optimization, and data ingestion. Contains 28 atomic rules across 3 categories (schema, query, insert), prioritized by impact. Extended with 14 reference files covering cluster management, backups, monitoring, and integrations.

Official docs: ClickHouse Best Practices
Official docs: ClickHouse Best Practices

⚠️ Security Considerations

Credential Placeholders

Example credentials in documentation (password123, AKIAIOSFODNN7EXAMPLE) are placeholders only. Never use these in production. Use proper secret management:

  • Environment variables
  • Secret managers (AWS Secrets Manager, HashiCorp Vault, etc.)
  • Kubernetes secrets (for K8s deployments)
  • ClickHouse named collections with external configuration

Installation & Operations

For installation and operational procedures:

  • Follow official documentation links provided in reference files
  • Prefer package managers (apt, yum, helm) over direct downloads
  • Use versioned artifacts instead of latest in production
  • Test procedures in non-production environments first

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: Check references/ for deeper topic coverage
  4. If neither covers it: Use general ClickHouse knowledge or search documentation
  5. Always cite your source: rule name, reference file, 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.


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-pk-filter-on-orderby.md — Query filter alignment
  5. rules/schema-types-native-types.md — Proper type selection
  6. rules/schema-types-minimize-bitwidth.md — Numeric type sizing
  7. rules/schema-types-lowcardinality.md — LowCardinality usage
  8. rules/schema-types-avoid-nullable.md — Nullable vs DEFAULT
  9. rules/schema-types-enum.md — Enum for finite value sets
  10. rules/schema-partition-low-cardinality.md — Partition count limits
  11. rules/schema-partition-lifecycle.md — Partitioning purpose
  12. rules/schema-partition-query-tradeoffs.md — Partition pruning trade-offs
  13. rules/schema-partition-start-without.md — Start without partitioning
  14. rules/schema-json-when-to-use.md — JSON type usage

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-use-any.md — ANY vs regular JOIN
  3. rules/query-join-filter-before.md — Pre-join filtering
  4. rules/query-join-consider-alternatives.md — Dictionaries/denormalization
  5. rules/query-join-null-handling.md — join_use_nulls setting
  6. rules/query-index-skipping-indices.md — Secondary index usage
  7. rules/query-mv-incremental.md — Incremental materialized views
  8. rules/query-mv-refreshable.md — Refreshable materialized views

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-async-small-batches.md — Async insert usage
  3. rules/insert-format-native.md — Native format for performance
  4. rules/insert-mutation-avoid-update.md — UPDATE alternatives
  5. rules/insert-mutation-avoid-delete.md — DELETE alternatives
  6. 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 review responses 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

PriorityCategoryImpactPrefixCount
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

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

Quick Decision Guides

Which Table Engine?

Need to store data?
├── < 1M rows, dimension → Memory
└── ≥ 1M rows → MergeTree family
    ├── Deduplication? → ReplacingMergeTree(version)
    ├── Changelog? → CollapsingMergeTree(sign)
    ├── Pre-aggregation? → AggregatingMergeTree()
    ├── Replication? → ReplicatedMergeTree(...)
    └── Default → MergeTree()

See references/table-engines.md for complete reference.

Common Issues & Quick Fixes

IssueQuick Fix
Too many partsOPTIMIZE TABLE table FINAL (see insert-optimize-avoid-final)
Slow queryEXPLAIN SELECT... to check index usage
Mutation stuckCheck system.mutations, consider alternatives per insert-mutation-avoid-update
Replication lagCheck system.replication_queue, ZooKeeper
OOM on queryIncrease max_memory_usage, optimize query

See references/debugging.md for detailed troubleshooting.


Deep Reference Files

For topics beyond the 28 rules, see the references/ directory:

Schema & Table Design

  • references/core-concepts.md — Architecture, data model, internals
  • references/schema-design.md — Database engines, migrations, version control
  • references/table-design.md — ORDER BY, partitioning, column selection
  • references/table-engines.md — Complete MergeTree family reference

Query & Performance

  • references/sql-reference.md — Complete SQL dialect, data types
  • references/query-optimization.md — EXPLAIN, JOINs, projections, skip indexes
  • references/advanced-features.md — Materialized views, mutations, TTL, dictionaries

Operations & Cluster

  • references/debugging.md — Query debugging, merges, mutations, replication
  • references/cluster-management.md — Distributed tables, replication, sharding
  • references/backup-restore.md — Backup strategies, disaster recovery
  • references/monitoring.md — Query monitoring, health checks, system queries

Integration & Best Practices

  • references/integrations.md — Kafka, S3, PostgreSQL, MySQL, BI tools
  • references/best-practices.md — Complete checklist and anti-patterns
  • references/external.md — Altinity KB links, official docs
  • references/system-queries.md — Ready-to-use queries for operations

Version: 1.3.0 Rules: Synced with ClickHouse/agent-skills (Apache-2.0) References: Altinity Knowledge Base (200+ articles) + ClickHouse Official Docs

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.57%
按下载量换算41

Claude

32.04%
按下载量换算35

Cursor

16.93%
按下载量换算18

Gemini CLI

8.76%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills