Agent skill

Schema Design Advisor

by chmonitor in chmonitor/chmonitor

Recommend table ORDER BY keys, partition strategies, column data-type right-sizing, codecs, skip indexes, and projections for ClickHouse tables.

GPL-3.0Auto-check passedDatabases

Install Schema Design Advisor

skills CLI
$ npx skills add chmonitor/chmonitor --skill schema-design-advisor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install chmonitor/chmonitor schema-design-advisor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/chmonitor/chmonitor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/schema-design-advisor .claude/skills/schema-design-advisor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
schema-design-advisor
GitHub stars
299
Token cost
~2.2k tokens
SKILL.md length
852 words
Files
1
Skills in repo
53
Repo updated
First seen
Licence
GPL-3.0

At a glance

Recommend table ORDER BY keys, partition strategies, column data-type right-sizing, codecs, skip indexes, and projections for ClickHouse tables.

  • Works in 4 steps: Query max(col), min(col), uniq(col),… → Pick the narrowest correct type from the… → Check if existing queries rely on… → …
  • Tasks that involve Database schema design
  • SKILL.md covers Inspect First, ORDER BY / Primary Key Design, Partition Key Choices and Column Data-Type Right-Sizing, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Schema Design Advisor is an agent skill from chmonitor/chmonitor. Recommend table ORDER BY keys, partition strategies, column data-type right-sizing, codecs, skip indexes, and projections for ClickHouse tables.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering Database schema design and Data warehousing. It works with ClickHouse. The repository describes itself as: Open-source operational advisor for ClickHouse — real-time monitoring plus AI-driven index/partition/materialized-view recommendations. The licence is GPL-3.0.

When your agent uses it

  • Tasks that involve Database schema design
  • Tasks that involve Data warehousing

Example prompts

  • “/schema-design-advisor”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Query max(col), min(col), uniq(col), countIf(col IS NULL) to measure range, cardinality, and null rate.
  2. Pick the narrowest correct type from the tables above.
  3. Check if existing queries rely on implicit casting (e.g. comparing String column to integer literal).
  4. Emit the ALTER

What it can do on your machine

Read from SKILL.md and the folder at commit fc39ef0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are sql).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Schema Design Advisor loads about 2.2k tokens when it runs. Until then it costs about 42 tokens; SKILL.md has 852 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~42
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from chmonitor/chmonitor at commit fc39ef0, republished under its GPL-3.0 licence (© chmonitor). 852 words, ~2,236 tokens.

Download SKILL.mdSave it as .claude/skills/schema-design-advisor/SKILL.md (or your agent's skills folder).
name
schema-design-advisor
description
Recommend table ORDER BY keys, partition strategies, column data-type right-sizing, codecs, skip indexes, and projections for ClickHouse tables.

Schema Design Advisor

Replaces the removed table-design advisor tool. Follow the sections below in order: inspect first, then recommend.

Inspect First

Gather evidence before making any recommendation. Run all three in parallel.

1. Schema — call get_table_schema for the target table.

2. Parts summary — call get_table_parts, or:

sql
SELECT
    partition,
    count()                                                 AS part_count,
    sum(rows)                                               AS total_rows,
    formatReadableSize(sum(data_compressed_bytes))          AS compressed,
    formatReadableSize(sum(data_uncompressed_bytes))        AS uncompressed,
    round(sum(data_uncompressed_bytes) /
          nullIf(sum(data_compressed_bytes), 0), 2)        AS ratio
FROM system.parts
WHERE active AND database = 'db' AND table = 't'
GROUP BY partition
ORDER BY partition DESC
LIMIT 20

3. Per-column compression + cardinality — run via query:

sql
SELECT
    name,
    type,
    formatReadableSize(data_compressed_bytes)               AS compressed,
    formatReadableSize(data_uncompressed_bytes)             AS uncompressed,
    round(data_uncompressed_bytes /
          nullIf(data_compressed_bytes, 0), 2)              AS ratio,
    compression_codec
FROM system.columns
WHERE database = 'db' AND table = 't'
ORDER BY data_uncompressed_bytes DESC

4. Cardinality probe (spot-check suspicious columns):

sql
SELECT
    uniq(col_a)  AS card_a,
    uniq(col_b)  AS card_b,
    count()      AS total
FROM db.t

A ratio < 2× on per-column compression usually means the wrong codec or wrong type. Cardinality drives type and codec choices below.


ORDER BY / Primary Key Design

  • Rule: list columns low-cardinality → high-cardinality in the ORDER BY clause.
  • Common ordering: (tenant_id, date, entity_id, event_id).
  • Only the first N columns of ORDER BY form the sparse index (granule size 8192 rows by default). Columns later in the key still sort data but don't speed up point lookups.
  • Filter alignment: include in ORDER BY every column that appears in WHERE clauses of your most frequent queries — leftmost first.
  • PRIMARY KEY can be a prefix of ORDER BY if you want to deduplicate on a broader key (ReplacingMergeTree / CollapsingMergeTree).
  • Avoid putting high-cardinality UUIDs first — they destroy index locality.
  • When two columns have similar cardinality, put the one queried with = before the one queried with BETWEEN/range.

Partition Key Choices

GranularityDDLWhen to use
MonthlyPARTITION BY toYYYYMM(event_date)Most time-series tables; 1–12 partitions/year
DailyPARTITION BY toYYYYMMDD(event_date)Only when you routinely DROP whole days and have < 1000 partitions total
By tenantPARTITION BY (tenant_id, toYYYYMM(event_date))Multi-tenant with per-tenant data lifecycle

Too-many-partitions warning: ClickHouse merges within a partition, not across. More than ~1000 active partitions per table degrades insert and merge performance (each insert touches one partition; too many partitions = many small parts). Daily partitioning on a high-volume table quickly exceeds safe limits.

Check current partition count:

sql
SELECT count(DISTINCT partition) FROM system.parts
WHERE active AND database = 'db' AND table = 't'

If > 500, recommend coarser partitioning.


Column Data-Type Right-Sizing

Integer width
Value rangeType
0–255UInt8
0–65535UInt16
0–4 billionUInt32
> 4 billion or unknownUInt64
Negative smallInt8/Int16/Int32

Use the narrowest type that fits the actual data range (query max(col), min(col)). Narrower types compress better and fit more values per granule.

Strings
SituationType
cardinality < ~10 000 distinct valuesLowCardinality(String)
cardinality > ~100 000plain String — LC overhead outweighs benefit
fixed-width binary/hash (e.g. MD5)FixedString(16) (store raw bytes, not hex)
small, known set of valuesEnum8 or Enum16 (saves space + enforces valid values)

LowCardinality stores a dictionary per column chunk; high-cardinality columns with LC can use more memory than String.

Dates and timestamps
NeedType
Date only (day precision)Date (2 bytes)
Second precision, 1970–2105DateTime (4 bytes)
Sub-second or timezoneDateTime64(3) / DateTime64(6) (8 bytes)

Avoid String for timestamps — they block time-based pruning and sort incorrectly.

Nullable

Avoid Nullable(T) unless the column genuinely contains NULLs that have semantic meaning. Nullable adds a hidden bitmask column and disables some optimizations (skip indexes, certain codecs). Use a sentinel value (0, empty string, epoch) and document the convention instead.

How to recommend a type change
  1. Query max(col), min(col), uniq(col), countIf(col IS NULL) to measure range, cardinality, and null rate.
  2. Pick the narrowest correct type from the tables above.
  3. Check if existing queries rely on implicit casting (e.g. comparing String column to integer literal).
  4. Emit the ALTER:
sql
ALTER TABLE db.t MODIFY COLUMN col_name NewType;

For large tables this is a background mutation — monitor via system.mutations.


Show full SKILL.md (316 more words)Show less

Compression Codecs

Data shapeRecommended codec
Monotonically increasing integers (timestamps, IDs)Delta, ZSTD(3)
Slow-changing countersDoubleDelta, ZSTD(3)
Floating-point gauge metricsGorilla, ZSTD(3)
Integer columns with small value rangeT64, ZSTD(3)
Random strings / UUIDsZSTD(3) or LZ4
Already-compressed blobsNONE

Apply per column:

sql
ALTER TABLE db.t MODIFY COLUMN ts DateTime CODEC(DoubleDelta, ZSTD(3));
ALTER TABLE db.t MODIFY COLUMN value Float64 CODEC(Gorilla, ZSTD(3));
ALTER TABLE db.t MODIFY COLUMN status LowCardinality(String) CODEC(ZSTD(3));

ZSTD(3) is a safe default when unsure. LZ4 is faster to decompress at the cost of compression ratio. Benchmark with SELECT formatReadableSize(data_compressed_bytes), formatReadableSize(data_uncompressed_bytes) FROM system.columns WHERE ... before and after.


Skip Indexes

Add skip indexes to columns that appear in WHERE but are not in the ORDER BY prefix.

Index typeBest forExample
minmaxNumeric ranges, dateserror_code, response_time
set(N)Low-cardinality columns (≤ N distinct values per granule)status, region
bloom_filterString equality / IN on medium-cardinalityuser_agent, trace_id
ngrambf_v1(n, size, hashes, seed)LIKE / substring search on stringsquery_text, url_path
sql
-- minmax on a numeric column
ALTER TABLE db.t ADD INDEX idx_code error_code TYPE minmax GRANULARITY 4;

-- bloom filter for string equality
ALTER TABLE db.t ADD INDEX idx_trace trace_id TYPE bloom_filter(0.01) GRANULARITY 1;

MATERIALIZE INDEX idx_trace IN PARTITION ID 'all';

Skip indexes only help when they skip whole granules (8192 rows). They are useless on columns with near-random values per granule. Verify with EXPLAIN indexes = 1 SELECT ....


Projections and Materialized Views

Projections — embedded alternative sort orders stored inside the table. Use when you have a second common query shape with a different leading ORDER BY column:

sql
ALTER TABLE db.t ADD PROJECTION proj_by_user (
    SELECT * ORDER BY user_id, event_date
);
ALTER TABLE db.t MATERIALIZE PROJECTION proj_by_user;

Projections double storage for covered columns. Only add if the query pattern is frequent enough to justify the write amplification.

Materialized views — pre-aggregate or transform data into a separate table at insert time. Use for:

  • Pre-computed aggregates queried repeatedly (SUM, COUNT by dimension)
  • Different granularity (raw events → hourly rollups)
  • Derived columns computed at write time to avoid runtime cost

Prefer projections over MVs when the source schema and the query shape are stable. Prefer MVs when you need a different engine (AggregatingMergeTree), different TTL, or cross-table joins at insert time.


Cross-references

  • storage-optimization — TTL policies, tiered storage, part management, codec benchmarking workflow
  • query-tuning-advisor — EXPLAIN output, PREWHERE, JOIN ordering, index effectiveness
  • migration-patterns — ALTER TABLE procedures, mutation monitoring, zero-downtime schema changes
  • hardware-tuning — memory limits, merge thread tuning, MergeTree settings that affect schema trade-offs

© chmonitor, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/schema-design-advisor of chmonitor/chmonitor.

Open the folder on GitHubat commit fc39ef0

Compare with similar skills

Schema Design Advisor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Schema Design Advisor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Schema Design Advisor this skillchmonitor/chmonitor299—~2.2kAutomated safety check: PassGPL-3.0
Clickhouse Core Workflow Ajeremylongshore/tons-of-skills-marketplace2.8k—~1.6kAutomated safety check: PassMIT
Modelersidequery/sidemantic129—~4.2kAutomated safety check: PassApache-2.0
Keeper Stress AnalysisClickHouse/ClickHouse50k—~4.7kAutomated safety check: PassApache-2.0
Perf ComparisonClickHouse/ClickHouse50k—~3.9kAutomated safety check: NotesApache-2.0
Patch Release CheckClickHouse/ClickHouse50k—~4kAutomated safety check: NotesApache-2.0

Similar skills

  • Clickhouse Core Workflow A

    jeremylongshore/tons-of-skills-marketplace

    Design ClickHouse schemas with MergeTree engines, ORDER BY keys, and partitioning.

    2.8k GitHub stars~1.6k tokensUpdated today
    DatabasesAuto-check passed
  • Modeler

    sidequery/sidemantic

    Build, validate, and manage semantic models using Sidemantic.

    129 GitHub stars~4.2k tokensUpdated today
    DatabasesAuto-check passed
  • Keeper Stress Analysis

    ClickHouse/ClickHouse

    Analyze ClickHouse Keeper stress-test results from play.clickhouse.com / keeperstresstests data warehouse.

    50k GitHub stars~4.7k tokensUpdated today
    DatabasesAuto-check passed
  • Perf Comparison

    ClickHouse/ClickHouse

    Evaluate ClickHouse performance test results from existing CI/dashboard data or local perf.py runs.

    50k GitHub stars~3.9k tokensUpdated today
    DatabasesAuto-check: notes
  • Patch Release Check

    ClickHouse/ClickHouse

    Check whether ClickHouse's supported versions (last 3 majors + latest LTS) have recent stable patch releases, diagnose why the scheduled AutoReleases pipeline failed, and identify which releases…

    50k GitHub stars~4k tokensUpdated today
    DatabasesAuto-check: notes
  • MUST USE when designing ClickHouse architectures, selecting between ingestion or modeling patterns, or translating best practices into workload-specific system designs.

    394 GitHub starsUsed in 2 repos~791 tokens
    DatabasesAuto-check passed

More from chmonitor/chmonitor

All 53 skills in this repo
  • Hyperframes Creative

    chmonitor/chmonitor

    Non-animation creative direction for HyperFrames videos. An agent skill from chmonitor/chmonitor.

    299 GitHub starsUsed in 5 repos~1.3k tokens
    Auto-check passed
  • Hyperframes Media

    chmonitor/chmonitor

    Audio and media assets for HyperFrames compositions, produced by one shared audio engine (scripts/audio.mjs) — multi-provider TTS (HeyGen / ElevenLabs / Kokoro local), background music + sound…

    299 GitHub starsUsed in 1 repo~2.8k tokens
    Auto-check: notes
  • Remotion To Hyperframes

    chmonitor/chmonitor

    Port an existing Remotion (React) composition to HyperFrames HTML.

    299 GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Music To Video

    chmonitor/chmonitor

    A skill your agent uses when the user has a music track (an audio file, or a video to pull audio from) and wants a beat-synced HyperFrames video, calm to hard-hitting.

    299 GitHub starsUsed in 1 repo~4k tokens
    Auto-check: notes
  • Hyperframes Animation

    chmonitor/chmonitor

    All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus…

    299 GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • Faceless Explainer

    chmonitor/chmonitor

    turn arbitrary text — an article, notes, a topic, a brief — into a faceless explainer video, up to ~3 min (sweet spot 30-90s), where every visual is invented (typography, abstract graphics…

    299 GitHub stars~4.5k tokensUpdated 2 days ago
    Auto-check: notes

Works with

Categories

Questions about Schema Design Advisor

What does Schema Design Advisor do?

Recommend table ORDER BY keys, partition strategies, column data-type right-sizing, codecs, skip indexes, and projections for ClickHouse tables. Schema Design Advisor is an agent skill from chmonitor/chmonitor. Recommend table ORDER BY keys, partition strategies, column data-type right-sizing, codecs, skip indexes, and projections for ClickHouse tables.

When should I use Schema Design Advisor?

Schema Design Advisor fits situations like: tasks that involve Database schema design; tasks that involve Data warehousing.

How do I install Schema Design Advisor in Claude Code?

Run `npx skills add chmonitor/chmonitor --skill schema-design-advisor -a claude-code`. Or copy the skill folder (.agents/skills/schema-design-advisor in chmonitor/chmonitor) into .claude/skills/schema-design-advisor in your project. Claude Code loads it when a task matches its description.

How do I install Schema Design Advisor in Codex?

Run `npx skills add chmonitor/chmonitor --skill schema-design-advisor -a codex`. Or copy the skill folder (.agents/skills/schema-design-advisor in chmonitor/chmonitor) into .agents/skills/schema-design-advisor in your project. Codex loads it when a task matches its description.

Can I use Schema Design Advisor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add chmonitor/chmonitor --skill schema-design-advisor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/schema-design-advisor, .gemini/skills/schema-design-advisor, .github/skills/schema-design-advisor and .opencode/skills/schema-design-advisor in your project.

What does Schema Design Advisor need to run?

SKILL.md names no scripts, command-line tools or credentials: Schema Design Advisor is instructions for the agent only.

Does Schema Design Advisor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Schema Design Advisor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Schema Design Advisor use?

Schema Design Advisor is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Schema Design Advisor use?

About 2.2k tokens (SKILL.md is roughly 8.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Schema Design Advisor?

Skills that share tags, products or a category with Schema Design Advisor: Clickhouse Core Workflow A (jeremylongshore/tons-of-skills-marketplace, 2.8k stars), Modeler (sidequery/sidemantic, 129 stars), Keeper Stress Analysis (ClickHouse/ClickHouse, 50k stars) and Perf Comparison (ClickHouse/ClickHouse, 50k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Schema Design Advisor?

chmonitor (a GitHub organization) maintains it in chmonitor/chmonitor, which has 299 GitHub stars. The repository holds 53 skills in this directory. The repository was last updated on October 5, 2026.

Source: chmonitor/chmonitor on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.