modeling-dimension-tables
This skill builds reusable lookup tables (dimensions) like country, plan, and date for star-schema analytics on PostHog or dbt.
Identity proven by GitHub's verified organisation badge (PostHog)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- MIT (permissive)
- Pin
- 244c70dpinned Oct 9, 2026
- Context cost
- about 1,100 tokenswhen the skill loads
- GitHub stars
- 40,191on posthog/posthog
- Scripts
- None found
What it does
“Build reusable dimension / lookup tables for a star schema — country/region, timezone, currency, date, plan/product, and other descriptive attributes — on either PostHog data-warehouse views (HogQL) or an external dbt project. Use when the user wants to model dimension tables, lookup tables, a star schema, conformed dimensions, or wants to enrich events/revenue/usage with country, region, timezone, plan, or currency attributes without repeating JOINs. Covers sourcing the dimension data (upload, warehouse source, or derive from events), shaping it into an aliased one-row-per-entity view (optionally materialized on a slow schedule since dimensions change rarely), and attaching it to facts via a saved or person join so its columns read as native fields. Key rule: for currency use the built-in convertCurrency() instead of a hand-rolled rate table. Read modeling-warehouse-foundations first; dimensions here are reused by the revenue, conversion, activation, and product-usage modeling skills.”
Generated summary from the skill's own text
This skill builds reusable lookup tables (dimensions) like country, plan, and date for star-schema analytics on PostHog or dbt. It teaches how to source dimension data, shape it into clean aliased views with one row per entity, and attach it to fact tables via joins so descriptive columns appear natively in queries.
When to use it
- Modeling lookup tables for country, region, timezone, plan, or date attributes
- Enriching events or revenue data with descriptive columns without repeated joins
- Building a star schema with conformed dimensions across multiple models
- Materializing static lookup tables that change rarely but are queried constantly
When not to
- Converting currency amounts; use the built-in convertCurrency() function instead
- First time modeling a warehouse; read modeling-warehouse-foundations before this skill
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add posthog/posthog --skill modeling-dimension-tablesInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install posthog/posthog modeling-dimension-tables@244c70d066c0b441e3b8cc6875f914c5e09c42b3Installs the commit we checked (244c70d).
Copy by hand
Download the folder at 244c70d and put it in .claude/skills/modeling-dimension-tables for Claude Code and in .agents/skills/modeling-dimension-tables for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install posthog@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "modeling-dimension-tables" by PostHog. Source, pinned to commit 244c70d066c0b441e3b8cc6875f914c5e09c42b3: https://github.com/posthog/posthog/tree/244c70d066c0b441e3b8cc6875f914c5e09c42b3/products/data_modeling/skills/modeling-dimension-tables 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/modeling-dimension-tables/ for Claude Code and .agents/skills/modeling-dimension-tables/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/posthog/modeling-dimension-tables-posthog
SKILL.md at the pin
--- name: modeling-dimension-tables description: > Build reusable dimension / lookup tables for a star schema — country/region, timezone, currency, date, plan/product, and other descriptive attributes — on either PostHog data-warehouse views (HogQL) or an external dbt project. Use when the user wants to model dimension tables, lookup tables, a star schema, conformed dimensions, or wants to enrich events/revenue/usage with country, region, timezone, plan, or currency attributes without repeating JOINs. Covers sourcing the dimension data (upload, warehouse source, or derive from events), shaping it into an aliased one-row-per-entity view (optionally materialized on a slow schedule since dimensions change rarely), and attaching it to facts via a saved or person join so its columns read as native fields. Key rule: for currency use the built-in convertCurrency() instead of a hand-rolled rate table. Read modeling-warehouse-foundations first; dimensions here are reused by the revenue, conversion, activation, and product-usage modeling skills. --- # Modeling dimension tables (star schema) Dimensions are the descriptive tables (`dim_country`, `dim_plan`, `dim_date`) that fact tables join to for slicing. This skill builds them once, cleanly, so every other model reuses them instead of re-deriving lookups. Read `modeling-warehouse-foundations` first (joins + `convertCurrency()` live there). Catalog of common dimensions: [`references/dimension-catalog.md`](references/dimension-catalog.md); recipes in [`references/posthog/`](references/posthog/) and [`references/dbt/`](references/dbt/). ## Star schema in one screen **Facts** (events, charges, revenue items) are long, keyed, and additive. **Dimensions** are short, one row per entity, descriptive. You model a dimension in three moves: 1. **Source it** — where does the dimension data come from? - _Upload / seed_ a lookup (country→region, plan→tier) as a CSV (warehouse source or dbt seed). - _Sync_ it from a system of record (your app DB, Stripe products) as a warehouse source. - _Derive_ it from events (distinct countries seen, a plan property observed per person). 2. **Shape it** — an **aliased** `SELECT` with clean column names, **one row per entity** (dedupe hard). Save as a view; **materialize** it on a **slow** `sync_frequency` (`7day`/`30day`) since dimensions change rarely and are read constantly. 3. **Attach it** — a **saved join** (dimension → a fact table) or **person join** (dimension → persons) so its columns appear as native fields in any query, filter, or breakdown. See foundations `joins-and-dimensions.md`. ## Currency is already a managed dimension — don't build it PostHog ships exchange rates behind `convertCurrency(from, to, amount, timestamp?)` (Open Exchange Rates, historical-rate-correct). Use it directly for any money conversion. Only build a currency dimension yourself in **dbt** (which has no equivalent), or if you need a rate provider PostHog doesn't offer. ## Rules before you model 1. **One row per entity, unique key.** A dimension with duplicate keys silently fan-outs every fact it joins. Test uniqueness (PostHog: verify in the shaping query; dbt: `unique` + `not_null`). 2. **Drop NULL keys when you derive a dimension from events.** HogQL keeps a row whose property is missing when the filter only compares it to `''`, so add `isNotNull(...)` as well. A NULL key becomes a dimension row of its own and it matches nothing on the fact side. 3. **Alias to clean, stable names** — `country_code`, `region`, `plan_tier`. These names become the join surface everything else depends on. 4. **Materialize static dimensions on a slow schedule**; don't leave a constantly-read lookup virtual. 5. **Register and certify.** Annotate the dimension and, if it's load-bearing, certify it in the catalog (foundations `governance.md`) so other models discover it and don't build a rival copy. 6. **Prefer built-in currency** (`convertCurrency`) over a hand-rolled FX table on PostHog. ## Build it **PostHog:** shape an aliased dimension view, then materialize + join. Recipes: [`references/posthog/dim_country.sql`](references/posthog/dim_country.sql) (derive + enrich from events), [`dim_plan.sql`](references/posthog/dim_plan.sql) (lookup/upload pattern). **dbt:** conformed `dim_*` models with `unique`/`not_null`/`relationships` tests, plus a generated `dim_date`. Recipes: [`references/dbt/`](references/dbt/). ## File map | File | Read when | | -------------------------------------------------------------------- | ----------------------------------------------------------- | | [`references/dimension-catalog.md`](references/dimension-catalog.md) | Common dimensions, how to source each, and the natural key. | | [`references/posthog/`](references/posthog/) | HogQL aliased-dimension view recipes. | | [`references/dbt/`](references/dbt/) | dbt `dim_date` / `dim_country` + `schema.yml` tests. | ## Companions `modeling-warehouse-foundations` (joins + currency), `setting-up-a-data-warehouse-source` / `suggesting-data-imports` (sync/upload the source data), and the models that consume these dimensions: `modeling-revenue-metrics`, `modeling-conversion-metrics`, `modeling-activation-metrics`, `modeling-product-usage-metrics`.
From posthog/posthog at 244c70d, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 244c70dFiles
- SKILL.md5.5 KB · 1192e8ed6d72
- references/
- dbt/
- dim_country.sql567 B · ef6757a1a873
- dim_date.sql917 B · 7bd4e73bb31f
- schema.yml686 B · 01f49e148fe9
- dimension-catalog.md3.3 KB · ce767ea62288
- posthog/
- dim_country.sql1.2 KB · 92da1b631f84
- dim_plan.sql775 B · 54cc8994eaf4
7 files, 13 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 244c70dAlso in
The same SKILL.md content appears in these places too. We list it once and credit the oldest public source.
More from PostHog
analyzing-experiment-session-replays
This skill enables agents to analyze session recordings from experiment variants to identify behavioral differences between control and test groups.
Claude Code, Codex, Cursor +4 · about 2.3K tokens · pinned 6 days ago
analyzing-offline-evaluations
This skill inspects and compares offline AI evaluation experiments stored in PostHog, diagnoses case-level regressions, and tracks scorer changes across…
Claude Code, Codex, Cursor +4 · about 1.5K tokens · pinned 6 days ago
auditing-warehouse-view-health
Audits materialized views in a PostHog data warehouse to identify failed views and flag unused ones that waste compute resources.
Claude Code, Codex, Cursor +4 · about 1.4K tokens · pinned 6 days ago
authoring-data-quality-checks
This skill adds data quality checks (like dbt tests) on warehouse tables, views, and HogQL metrics, supporting assertions such as not-null, uniqueness…
Claude Code, Codex, Cursor +4 · about 2.5K tokens · pinned 6 days ago
authoring-scouts
This skill helps engineers write, edit, and adapt PostHog Signals scouts, scheduled agents that scan projects and report findings to an inbox.
Claude Code, Codex, Cursor +4 · about 10.6K tokens · pinned 6 days ago
building-a-dashboard
This skill constructs or modifies PostHog dashboards by selecting and arranging insight tiles.
Claude Code, Codex, Cursor +4 · about 2.1K tokens · pinned 6 days ago
Related in Data and databases
modeling-product-usage-metrics
This skill helps build reusable product engagement models, retention, stickiness, and lifecycle, using either PostHog HogQL or dbt.
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 1.1K tokens · pinned 6 days ago
modeling-revenue-metrics
Build revenue models for MRR, ARR, gross revenue, churn, ARPU, and LTV on PostHog managed revenue views or dbt marts.
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 1.8K tokens · pinned 6 days ago
configuring-experiment-analytics
Configures how PostHog measures experiment impact by setting exposure criteria (who counts in the analysis), choosing metrics to track (mean, funnel, ratio…
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.4K tokens · pinned 6 days ago
configuring-experiment-rollout
Configures variant split and overall rollout percentage for PostHog experiments, determining who sees which test variant and what percentage of users enter…
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.6K tokens · pinned 6 days ago
diagnosing-experiment-health
This skill diagnoses problems with a PostHog experiment's setup, exposures, results, and changes during its run.
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 5.6K tokens · pinned 6 days ago
querying-posthog-data
This skill teaches the agent how to query PostHog data using typed runners for product analytics or SQL for complex analysis.
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 4K tokens · pinned 6 days ago