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.
What this skill does
# Local ClickHouse Development Setup
This skill walks through setting up a complete local ClickHouse development environment using `clickhousectl`. Follow these steps in order.
## When to Apply
Use this skill when the user wants to:
- Build an application that needs an analytical database or ClickHouse specifically
- Set up a local ClickHouse instance for development
- Install ClickHouse on their machine
- Create tables and start querying ClickHouse locally
- Prototype or experiment with ClickHouse
---
## Step 1: Install clickhousectl
Check if `clickhousectl` is already available:
```bash
which clickhousectl
```
If not found, install it:
```bash
curl -fsSL https://clickhouse.com/cli | sh
```
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:
```bash
export PATH="$HOME/.local/bin:$PATH"
```
Once installed, `clickhousectl skills` can be used to install the latest ClickHouse Agent Skills.
---
## Step 2: Install ClickHouse and set the default
Install the latest ClickHouse version and set it as the system default:
```bash
clickhousectl local use latest
```
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.
---
## Step 3: Initialize the project
From the user's project root directory:
```bash
clickhousectl local init
```
This creates a standard folder structure:
```
clickhouse/
tables/ # CREATE TABLE statements
materialized_views/ # Materialized view definitions
queries/ # Saved queries
seed/ # Seed data / INSERT statements
```
**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.
---
## Step 4: Start a local server
```bash
clickhousectl local server start --name <name>
```
This starts a ClickHouse server in the background.
**To check running servers and see their exposed ports:**
```bash
clickhousectl local server list
```
---
## Step 5: Create the schema
Based on the user's application requirements, write CREATE TABLE SQL files.
**Write each table definition to its own file** in `clickhouse/tables/`:
```bash
# Example: clickhouse/tables/events.sql
```
```sql
CREATE TABLE IF NOT EXISTS events (
timestamp DateTime,
user_id UInt32,
event_type LowCardinality(String),
properties String
)
ENGINE = MergeTree()
ORDER BY (event_type, timestamp)
```
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:**
```bash
clickhousectl local client --name <name> --queries-file clickhouse/tables/events.sql
```
---
## Step 6: Seed data (optional)
If the user needs sample data for development, write INSERT statements to `clickhouse/seed/`:
```bash
# Example: clickhouse/seed/events.sql
```
```sql
INSERT 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"}');
```
**Apply seed data:**
```bash
clickhousectl local client --name <name> --queries-file clickhouse/seed/events.sql
```
---
## Step 7: Verify the setup
Confirm tables were created:
```bash
clickhousectl local client --name <name> --query "SHOW TABLES"
```
Run a test query:
```bash
clickhousectl local client --name <name> --query "SELECT count() FROM events"
```
---
If the user wants to use a managed ClickHouse service, use the `clickhousectl-cloud-deploy` skill to help the user deploy to ClickHouse Cloud.
Related in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.