ClickHouse Analytics Patterns workflow skill. Use this skill when the user needs ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing off.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
ClickHouse Analytics Patterns workflow skill. Use this skill when the user needs ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing off.
This public intake copy packages plugins/antigravity-awesome-skills/skills/cc-skill-clickhouse-io from https://github.com/sickn33/antigravity-awesome-skills into the native Omni Skills editorial shape without hiding its origin.
Use it when the operator needs the upstream workflow, support files, and repository context to stay intact while the public validator and private enhancer continue their normal downstream flow.
This intake keeps the copied upstream files intact and uses the external_source block in metadata.json plus ORIGIN.md as the provenance anchor for review.
ClickHouse Analytics Patterns ClickHouse-specific patterns for high-performance analytics and data engineering.
Imported source sections that did not map cleanly to the public headings are still preserved below or in the support files. Notable imported sections: Table Design Patterns, Query Optimization Patterns, Data Insertion Patterns, Materialized Views, Performance Monitoring, Common Analytics Queries.
When to Use This Skill
Use this section as the trigger filter. It should make the activation boundary explicit before the operator loads files, runs commands, or opens a pull request.
This skill is applicable to execute the workflow or actions described in the overview.
Use when the request clearly matches the imported source intent: ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Use when the operator should preserve upstream workflow detail instead of rewriting the process from scratch.
Use when provenance needs to stay visible in the answer, PR, or review packet.
Use when copied upstream references, examples, or scripts materially improve the answer.
Use when the workflow should remain reviewable in the public intake repo before the private enhancer takes over.
Operating Table
Situation
Start here
Why it matters
First-time use
metadata.json
Confirms repository, branch, commit, and imported path through the external_source block before touching the copied workflow
Provenance review
ORIGIN.md
Gives reviewers a plain-language audit trail for the imported source
Workflow execution
SKILL.md
Starts with the smallest copied file that materially changes execution
Supporting context
SKILL.md
Adds the next most relevant copied source file without loading the entire package
Handoff decision
## Related Skills
Helps the operator switch to a stronger native skill when the task drifts
Workflow
This workflow is intentionally editorial and operational at the same time. It keeps the imported source useful to the operator while still satisfying the public intake standards that feed the downstream enhancer flow.
Confirm the user goal, the scope of the imported workflow, and whether this skill is still the right router for the task.
Read the overview and provenance files before loading any copied upstream support files.
Load only the references, examples, prompts, or scripts that materially change the outcome for the current request.
Execute the upstream workflow while keeping provenance and source boundaries explicit in the working notes.
Validate the result against the upstream expectations and the evidence you can point to in the copied files.
Escalate or hand off to a related skill when the work moves out of this imported workflow's center of gravity.
Before merge or closure, record what was used, what changed, and what the reviewer still needs to verify.
Imported Workflow Notes
Imported: Overview
ClickHouse is a column-oriented database management system (DBMS) for online analytical processing (OLAP). It's optimized for fast analytical queries on large datasets.
Use @cc-skill-clickhouse-io-v2 to handle <task>. Start from the copied upstream workflow, load only the files that change the outcome, and keep provenance visible in the answer.
Explanation: This is the safest starting point when the operator needs the imported workflow, but not the entire repository.
Example 2: Ask for a provenance-grounded review
Review @cc-skill-clickhouse-io-v2 against metadata.json and ORIGIN.md, then explain which copied upstream files you would load first and why.
Explanation: Use this before review or troubleshooting when you need a precise, auditable explanation of origin and file selection.
Example 3: Narrow the copied support files before execution
Use @cc-skill-clickhouse-io-v2 for <task>. Load only the copied references, examples, or scripts that change the outcome, and name the files explicitly before proceeding.
Explanation: This keeps the skill aligned with progressive disclosure instead of loading the whole copied package by default.
Example 4: Build a reviewer packet
Review @cc-skill-clickhouse-io-v2 using the copied upstream files plus provenance, then summarize any gaps before merge.
Explanation: This is useful when the PR is waiting for human review and you want a repeatable audit packet.
Best Practices
Treat the generated public skill as a reviewable packaging layer around the upstream repository. The goal is to keep provenance explicit and load only the copied source material that materially improves execution.
Partition by time (usually month or day)
Avoid too many partitions (performance impact)
Use DATE type for partition key
Put most frequently filtered columns first
Consider cardinality (high cardinality first)
Order impacts compression
Use smallest appropriate type (UInt32 vs UInt64)
Imported Operating Notes
Imported: Best Practices
1. Partitioning Strategy
Partition by time (usually month or day)
Avoid too many partitions (performance impact)
Use DATE type for partition key
2. Ordering Key
Put most frequently filtered columns first
Consider cardinality (high cardinality first)
Order impacts compression
3. Data Types
Use smallest appropriate type (UInt32 vs UInt64)
Use LowCardinality for repeated strings
Use Enum for categorical data
4. Avoid
SELECT * (specify columns)
FINAL (merge data before query instead)
Too many JOINs (denormalize for analytics)
Small frequent inserts (batch instead)
5. Monitoring
Track query performance
Monitor disk usage
Check merge operations
Review slow query log
Remember: ClickHouse excels at analytical workloads. Design tables for your query patterns, batch inserts, and leverage materialized views for real-time aggregations.
Troubleshooting
Problem: The operator skipped the imported context and answered too generically
Symptoms: The result ignores the upstream workflow in plugins/antigravity-awesome-skills/skills/cc-skill-clickhouse-io, fails to mention provenance, or does not use any copied source files at all.
Solution: Re-open metadata.json, ORIGIN.md, and the most relevant copied upstream files. Check the external_source block first, then restate the provenance before continuing.
Problem: The imported workflow feels incomplete during review
Symptoms: Reviewers can see the generated SKILL.md, but they cannot quickly tell which references, examples, or scripts matter for the current task.
Solution: Point at the exact copied references, examples, scripts, or assets that justify the path you took. If the gap is still real, record it in the PR instead of hiding it.
Problem: The task drifted into a different specialization
Symptoms: The imported skill starts in the right place, but the work turns into debugging, architecture, design, security, or release orchestration that a native skill handles better.
Solution: Use the related skills section to hand off deliberately. Keep the imported provenance visible so the next skill inherits the right context instead of starting blind.
Related Skills
@00-andruia-consultant - Use when the work is better handled by that native specialization after this imported skill establishes context.
@00-andruia-consultant-v2 - Use when the work is better handled by that native specialization after this imported skill establishes context.
@10-andruia-skill-smith - Use when the work is better handled by that native specialization after this imported skill establishes context.
@10-andruia-skill-smith-v2 - Use when the work is better handled by that native specialization after this imported skill establishes context.
Additional Resources
Use this support matrix and the linked files below as the operator packet for this imported skill. They should reflect real copied source material, not generic scaffolding.
Resource family
What it gives the reviewer
Example path
references
copied reference notes, guides, or background material from upstream
references/n/a
examples
worked examples or reusable prompts copied from upstream
examples/n/a
scripts
upstream helper scripts that change execution or validation
scripts/n/a
agents
routing or delegation notes that are genuinely part of the imported package
agents/n/a
assets
supporting assets or schemas copied from the source package
assets/n/a
Imported Reference Notes
Imported: Query Optimization Patterns
Efficient Filtering
-- ✅ GOOD: Use indexed columns firstSELECT*FROM markets_analytics
WHEREdate>='2025-01-01'AND market_id ='market-123'AND volume >1000ORDERBYdateDESC
LIMIT 100;
-- ❌ BAD: Filter on non-indexed columns firstSELECT*FROM markets_analytics
WHERE volume >1000AND market_name LIKE'%election%'ANDdate>='2025-01-01';
Aggregations
-- ✅ GOOD: Use ClickHouse-specific aggregation functionsSELECT
toStartOfDay(created_at) ASday,
market_id,
sum(volume) AS total_volume,
count() AS total_trades,
uniq(trader_id) AS unique_traders,
avg(trade_size) AS avg_size
FROM trades
WHERE created_at >= today() -INTERVAL7DAYGROUPBYday, market_id
ORDERBYdayDESC, total_volume DESC;
-- ✅ Use quantile for percentiles (more efficient than percentile)SELECT
quantile(0.50)(trade_size) AS median,
quantile(0.95)(trade_size) AS p95,
quantile(0.99)(trade_size) AS p99
FROM trades
WHERE created_at >= now() -INTERVAL1HOUR;
Window Functions
-- Calculate running totalsSELECTdate,
market_id,
volume,
sum(volume) OVER (
PARTITIONBY market_id
ORDERBYdateROWSBETWEEN UNBOUNDED PRECEDING ANDCURRENTROW
) AS cumulative_volume
FROM markets_analytics
WHEREdate>= today() -INTERVAL30DAYORDERBY market_id, date;
// For continuous data ingestionimport { createWriteStream } from'fs'import { pipeline } from'stream/promises'asyncfunctionstreamInserts() {
const stream = clickhouse.insert('trades').stream()
forawait (const batch of dataSource) {
stream.write(batch)
}
await stream.end()
}
Imported: Materialized Views
Real-time Aggregations
-- Create materialized view for hourly statsCREATE MATERIALIZED VIEW market_stats_hourly_mv
TO market_stats_hourly
ASSELECT
toStartOfHour(timestamp) AShour,
market_id,
sumState(amount) AS total_volume,
countState() AS total_trades,
uniqState(user_id) AS unique_users
FROM trades
GROUPBYhour, market_id;
-- Query the materialized viewSELECThour,
market_id,
sumMerge(total_volume) AS volume,
countMerge(total_trades) AS trades,
uniqMerge(unique_users) AS users
FROM market_stats_hourly
WHEREhour>= now() -INTERVAL24HOURGROUPBYhour, market_id;
Imported: Performance Monitoring
Query Performance
-- Check slow queriesSELECT
query_id,
user,
query,
query_duration_ms,
read_rows,
read_bytes,
memory_usage
FROM system.query_log
WHERE type ='QueryFinish'AND query_duration_ms >1000AND event_time >= now() -INTERVAL1HOURORDERBY query_duration_ms DESC
LIMIT 10;
Table Statistics
-- Check table sizesSELECT
database,
table,
formatReadableSize(sum(bytes)) AS size,
sum(rows) ASrows,
max(modification_time) AS latest_modification
FROM system.parts
WHERE active
GROUPBY database, tableORDERBYsum(bytes) DESC;
Imported: Common Analytics Queries
Time Series Analysis
-- Daily active usersSELECT
toDate(timestamp) ASdate,
uniq(user_id) AS daily_active_users
FROM events
WHEREtimestamp>= today() -INTERVAL30DAYGROUPBYdateORDERBYdate;
-- Retention analysisSELECT
signup_date,
countIf(days_since_signup =0) AS day_0,
countIf(days_since_signup =1) AS day_1,
countIf(days_since_signup =7) AS day_7,
countIf(days_since_signup =30) AS day_30
FROM (
SELECT
user_id,
min(toDate(timestamp)) AS signup_date,
toDate(timestamp) AS activity_date,
dateDiff('day', signup_date, activity_date) AS days_since_signup
FROM events
GROUPBY user_id, activity_date
)
GROUPBY signup_date
ORDERBY signup_date DESC;
Funnel Analysis
-- Conversion funnelSELECT
countIf(step ='viewed_market') AS viewed,
countIf(step ='clicked_trade') AS clicked,
countIf(step ='completed_trade') AS completed,
round(clicked / viewed *100, 2) AS view_to_click_rate,
round(completed / clicked *100, 2) AS click_to_completion_rate
FROM (
SELECT
user_id,
session_id,
event_type AS step
FROM events
WHERE event_date = today()
)
GROUPBY session_id;
Cohort Analysis
-- User cohorts by signup monthSELECT
toStartOfMonth(signup_date) AS cohort,
toStartOfMonth(activity_date) ASmonth,
dateDiff('month', cohort, month) AS months_since_signup,
count(DISTINCT user_id) AS active_users
FROM (
SELECT
user_id,
min(toDate(timestamp)) OVER (PARTITIONBY user_id) AS signup_date,
toDate(timestamp) AS activity_date
FROM events
)
GROUPBY cohort, month, months_since_signup
ORDERBY cohort, months_since_signup;