clickhouse-migrations
Skill by PostHog
Gives AI assistants PostHog's ClickHouse migration patterns and rules, including node roles, table engines and safety rules. Use it when creating or changing ClickHouse migrations in the PostHog repository.
Install clickhouse-migrations
Built from the published package, never by AI.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/.agents/skills/clickhouse-migrations ~/.claude/skills/clickhouse-migrationsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/posthog/.agents/skills/clickhouse-migrations ~/.gemini/antigravity-cli/skills/clickhouse-migrationsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install clickhouse-migrations in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
The clickhouse-migrations skill is a quick reference for writing ClickHouse migrations in the PostHog codebase. It points the assistant to posthog/clickhouse/migrations/AGENTS.md for full patterns and covers the migration structure, NodeRole choices for each cluster, table engine settings, and a Kafka engine baseline. It also lists critical rules, such as never using ON CLUSTER and never writing a DROP COLUMN migration directly.
It asks the assistant to check dev, prod-us and prod-eu through the ClickHouse MCP before choosing where a new object lives, and to keep local dev tables and HCL declarations in step with migrations. It is aimed at engineers working on the PostHog repository who create or modify ClickHouse migrations and need the cluster and safety conventions.
Written from the project's SKILL.md and checked against it.
What it can do
- Migration structureShows the run_sql_with_exceptions pattern with node_roles, sharded and is_alter_on_replicated_table flags.
- Node role selectionPicks a NodeRole based on which cluster owns the object, such as DATA, APM or AUX.
- Live cluster checkUses the ClickHouse MCP to check table placement on dev, prod-us and prod-eu before writing a migration.
- Table engine referenceLists MergeTree, Distributed and Kafka engine options and a Kafka SETTINGS baseline.
- Critical rulesFlags forbidden patterns such as ON CLUSTER, CODEC(ZSTD(1)) and direct DROP COLUMN migrations.
- PR scope guidanceAsks that migration changes ship in migration-only pull requests, separate from feature code.
- Local setup parityGates cloud-only migrations with run_mode and adds new tables to schema.py so they exist locally.
- Dictionary credentialsResolves dictionary source credentials through get_clickhouse_creds with the dict_reader user.
- HCL agreementReminds the assistant to update declarative HCL in the same PR when a managed role changes.
What you need
- Access to the PostHog repository
- ClickHouse MCP for live cluster checks
- Python code in the PostHog repository
Try asking
- Write a ClickHouse migration that adds a sharded events rollup table
- Which NodeRole should a new Kafka consumer migration use?
- Check the live dev, prod-us and prod-eu clusters before adding this table
Good to know
- Never use ON CLUSTER in SQL statements.
- DROP COLUMN must be done by the ClickHouse team on the cluster first.
- kafka_events_json_ws and events_json_ws_mv must not be dropped or recreated.
- Migration PRs must contain only migration-related files.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/clickhouse-migrations/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to clickhouse-migrations
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
clickhouse-migrations: common questions
Can the assistant drop a column with a migration?
Not on its own. The ClickHouse team drops the column on the cluster first, and then a matching DROP COLUMN migration is written.
How does it choose the cluster for a new table?
It depends on which cluster owns the object. The skill says to check the live clusters and state the choice and reference in the PR description.
Does it cover Kafka tables?
Yes. It gives a Kafka engine SETTINGS baseline and notes that columns and settings are fixed at creation.
How do I install clickhouse-migrations?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is clickhouse-migrations free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is clickhouse-migrations safe to use?
It scores 80 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to clickhouse-migrations?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
