npx skills add ...
npx skills add clickhouse/agent-skills --skill clickhousectl-local-dev
npx skills add clickhouse/agent-skills --skill clickhousectl-local-dev
Use when a user wants to build an application with ClickHouse, set up a local ClickHouse development environment, install ClickHouse, create a local server, create tables, or start developing with ClickHouse. Covers the full flow from zero to a working local ClickHouse setup.
This skill walks through setting up a complete local ClickHouse development environment using clickhousectl. Follow these steps in order.
Use this skill when the user wants to:
Check if clickhousectl is already available:
If not found, install it:
This installs clickhousectl to ~/.local/bin/clickhousectl and creates a chctl alias.
If the command is still not found after install: The user may need to add ~/.local/bin to their PATH or open a new terminal session. Suggest:
Once installed, clickhousectl skills can be used to install the latest ClickHouse Agent Skills.
Install the latest ClickHouse version and set it as the system default:
This installs ClickHouse, sets it as the default version used by clickhousectl local commands, and symlinks ~/.local/bin/clickhouse to the binary, putting clickhouse on your PATH (meaning you can invoke clickhouse directly, e.g. clickhouse client if needed).
You can use other version specifiers like stable, 26.4, 26.4.2.10 when needed.
From the user's project root directory:
This creates a standard folder structure:
Note: This step is optional. If the user already has their own folder structure for SQL files, skip this and adapt the later steps to use their paths.
This starts a ClickHouse server in the background.
To check running servers and see their exposed ports:
Based on the user's application requirements, write CREATE TABLE SQL files.
Write each table definition to its own file in clickhouse/tables/:
When designing schemas, if the clickhouse-best-practices skill is available, consult it for guidance on ORDER BY column selection, data types, and partitioning.
Apply the schema to the running server:
If the user needs sample data for development, write INSERT statements to clickhouse/seed/:
Apply seed data:
Confirm tables were created:
Run a test query:
If the user wants to use a managed ClickHouse service, use the clickhousectl-cloud-deploy skill to help the user deploy to ClickHouse Cloud.
clickhouse/
tables/ # CREATE TABLE statements
materialized_views/ # Materialized view definitions
queries/ # Saved queries
seed/ # Seed data / INSERT statementsclickhousectl local server start --name <name>clickhousectl local server list# Example: clickhouse/tables/events.sqlCREATE TABLE IF NOT EXISTS events (
timestamp DateTime,
user_id UInt32,
event_type LowCardinality(String),
properties String
)
ENGINE = MergeTree()
ORDER BY (event_type, timestamp)clickhousectl local client --name <name> --queries-file clickhouse/tables/events.sql# Example: clickhouse/seed/events.sqlINSERT INTO events (timestamp, user_id, event_type, properties) VALUES
('2024-01-01 00:00:00', 1, 'page_view', '{"page": "/home"}'),
('2024-01-01 00:01:00', 2, 'click', '{"button": "signup"}');clickhousectl local client --name <name> --queries-file clickhouse/seed/events.sqlclickhousectl local client --name <name> --query "SHOW TABLES"clickhousectl local client --name <name> --query "SELECT count() FROM events"