Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(skills): add writing-clickhouse-queries skill (#55242)

posthog[bot]f114d7a299ad
diff --git a/.agents/skills/writing-clickhouse-queries/SKILL.md b/.agents/skills/writing-clickhouse-queries/SKILL.md
new file mode 100644
index 000000000000..3bd8f859162c
--- /dev/null
+++ b/.agents/skills/writing-clickhouse-queries/SKILL.md
@@ -0,0 +1,24 @@
+---
+name: writing-clickhouse-queries
+description: Guide for writing performant ClickHouse queries in PostHog product code. Use when writing HogQL query runners, designing ClickHouse tables for a new product, adding materialized columns or skip indexes, or debugging slow ClickHouse queries.
+---
+
+# Writing ClickHouse queries for new products
+
+Read [`docs/published/handbook/engineering/databases/clickhouse-queries-new-products.md`](../../../docs/published/handbook/engineering/databases/clickhouse-queries-new-products.md) for the authoritative guide.
+
+Then pull in whichever related docs the task touches:
+
+- [`hogql-python.md`](../../../docs/published/handbook/engineering/databases/hogql-python.md) — HogQL in Python
+- [`materialized-columns.md`](../../../docs/published/handbook/engineering/databases/materialized-columns.md)
+- [`query-performance-optimization.md`](../../../docs/published/handbook/engineering/databases/query-performance-optimization.md)
+
+## When to use
+
+- Writing or reviewing a `QueryRunner` subclass in `posthog/hogql_queries/` or `products/*/backend/`
+- Adding a new ClickHouse table or ALTER for a product (`posthog/clickhouse/migrations/`)
+- Choosing a row ID format for a new table
+- Adding or removing materialized columns, skip indexes, or projections
+- Investigating a slow ClickHouse query
+
+Not the right skill for: customer-facing ad-hoc HogQL via Max / `posthog:execute-sql` — use `query-examples` for that. For migration mechanics (node roles, engines, replication), use `clickhouse-migrations`.