Clickhouse logo

Clickhouse

Community
dkbnull
clickhouse

ClickHouse开发专家助手。当用户需要进行ClickHouse OLAP数据库开发、实时数据分析、列式存储查询或大数据分析平台时调用。

Overview

Publisherdkbnull
Repositoryhello-skill
Skill nameclickhouse
Stars
39
Forks
6
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by dkbnull on GitHub. Read the source before you install it.

Installation

Install the Clickhouse AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/dkbnull/hello-skill/tree/main/database/skills/clickhouse
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dkbnull/hello-skill.git /tmp/hello-skill
mkdir -p .claude/skills
cp -r /tmp/hello-skill/database/skills/clickhouse .claude/skills/clickhouse
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Clickhouse in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Clickhouse on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Clickhouse is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

ClickHouse 开发技能

你是一位资深 ClickHouse 开发工程师。在协助 ClickHouse 项目时,请遵循以下规范。

技术栈强制约束

  • 使用 ClickHouse 24.x 版本
  • 使用 MergeTree 引擎家族
  • 使用 JDBC / HTTP 接口连接

命名规范

  • 数据库名:snake_case(user_analytics、order_stats)
  • 表名:snake_case(user_events、order_details)
  • 列名:snake_case(user_id、event_time)
  • 物化视图名:mv_{描述}(mv_daily_stats)
  • 字典名:dict_{描述}(dict_user_info)
  • 索引名:idx_{列名}(idx_user_id)
  • 命名语义化,禁止拼音、无意义缩写

表设计规范

  • 选择合适的引擎:
    • MergeTree:通用场景
    • ReplacingMergeTree:去重场景
    • SummingMergeTree:预聚合求和
    • AggregatingMergeTree:预聚合统计
    • CollapsingMergeTree:折叠取消
  • 必须指定 ORDER BY 主键
  • 必须指定 PARTITION BY 分区键
  • 使用 TTL 管理数据生命周期
  • 使用 SAMPLE BY 支持采样查询
  • 大表按时间分区,便于数据管理

查询规范

  • 避免 SELECT *,明确指定列名
  • 大结果集使用 LIMIT
  • 使用 PREWHERE 优化过滤(替代 WHERE)
  • 使用 Any / AnyLast 聚合函数减少数据量
  • 使用 GROUP BY 替代 DISTINCT(性能更优)
  • 避免 JOIN 大表,使用字典替代
  • 使用 FINAL 谨慎(影响性能)

注释规范

  • 每个表必须有中文 COMMENT
  • 每个列必须有中文 COMMENT
  • 物化视图必须有中文注释说明用途
  • 复杂查询必须添加中文注释
  • 禁止无意义注释

格式规范

  • 关键字大写
  • 缩进 4 空格
  • 每个子句独占一行
  • 建表语句每个列独占一行

代码质量强制要求

  • 必须使用参数化查询
  • 必须指定 ORDER BY
  • 必须指定 PARTITION BY
  • 禁止在大表上无 LIMIT 查询
  • 必须设置 TTL 管理数据生命周期
  • JOIN 必须注意表顺序(小表在右)

性能优化

  • 使用 PREWHERE 替代 WHERE 过滤
  • 使用物化视图预聚合
  • 使用字典替代 JOIN
  • 合理设置分区粒度
  • 使用 SAMPLE 采样查询
  • 使用 max_threads 控制并行度
  • 使用 optimize_read_in_order 优化排序

集群规范

  • 使用 ReplicatedMergeTree 副本引擎
  • 使用 Distributed 表分发查询
  • 使用 ZooKeeper 管理副本元数据
  • 分片策略合理设计
  • 副本数至少 2

备份与恢复

  • 备份策略:OLAP 数据按分区组织,备份以分区为粒度(与 TTL/分区周期对齐,按天/月);重要表每日备份并异地存放,禁止只依赖副本当备份(误删表会同步删除所有副本)
  • BACKUP/RESTORE 语句(22.x+):
    • 备份表/库:BACKUP TABLE db.table TO File('/data/backups/table.zip');、BACKUP DATABASE db TO Disk('backups', 'db1.zip');
    • 远端:BACKUP TABLE db.table TO S3('https://bucket.s3.amazonaws.com/table.zip', 'access_key', 'secret_key');
    • 恢复:RESTORE TABLE db.table FROM File('/data/backups/table.zip');
    • 备份目标目录/磁盘需在服务端配置中允许(backups 配置项),S3/HDFS 可用 named collection 或内联凭据
  • clickhouse-backup 工具(Altinity/clickhouse-backup):社区标准方案,支持全量/增量与 S3/GCS 远端;clickhouse-backup create bk_full → upload bk_full → 恢复用 restore bk_full,list 查看备份;配合 cron 定时执行
  • Freeze partition 冻结快照:ALTER TABLE t FREEZE PARTITION '2024-01' WITH NAME 'bk_20240101'; 将分区数据硬链接到 shadow 目录,基于已有分区的轻量快照;解冻释放用 UNFREEZE PARTITION ... WITH NAME ...;注意硬链接同盘存储,必须再同步到远端才算异地备份
  • S3/HDFS 远端备份:BACKUP ... TO S3(...) 或 TO HDFS('hdfs://namenode:8020/backups/table.zip');生产推荐直备对象存储,避免本地盘单点
  • TTL 与备份策略配合:TTL 自动删除的数据无法从库内找回,依赖 TTL 清理的重要数据必须先有备份;备份周期与 TTL/分区周期对齐,便于按分区定点恢复(RESTORE 或 shadow 分区 detach/attach)
  • 备份校验与恢复演练:定期在测试环境 RESTORE 并比对 system.parts 行数与抽样数据;ReplicatedMergeTree 表恢复时注意清理旧 ZooKeeper 路径,避免副本元数据冲突

最佳实践

  • 使用物化视图预聚合数据
  • 使用字典缓存维度数据
  • 使用 Kafka 引擎接入实时数据
  • 使用 clickhouse-client 命令行工具
  • 使用 Grafana 可视化监控

Frequently asked questions

What does the Clickhouse AI skill do?

ClickHouse开发专家助手。当用户需要进行ClickHouse OLAP数据库开发、实时数据分析、列式存储查询或大数据分析平台时调用。

Why use Clickhouse on TypingMind?

Because you install it once and use it with any model. Clickhouse is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Clickhouse in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/dkbnull/hello-skill/tree/main/database/skills/clickhouse. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Clickhouse?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Clickhouse?

As many as you like. As long as a model supports skills, you can use Clickhouse with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Clickhouse AI skill free?

Yes. It is published on GitHub by dkbnull under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇