posthog/ai-plugin

modeling-dimension-tables

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,…

First seen Aug 12, 2026

Installation

$ npx skills add posthog/ai-plugin --skill modeling-dimension-tables

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from posthog/ai-plugin · top by installs.

npx skills add posthog/ai-plugin

Browse all from posthog/ai-plugin

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 80
License MIT
Default branch main
Open issues 10
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,258 B
  • docs SUMMARY.md 1,037 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 32 installs

SKILL.md

Modeling dimension tables (star schema)

Dimensions are the descriptive tables (dimcountry, dimplan, 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).

  1. 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.

  1. 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).

  1. Alias to clean, stable namescountrycode, region, plantier. These names become the join

surface everything else depends on.

  1. Materialize static dimensions on a slow schedule; don't leave a constantly-read lookup virtual.
  2. 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.

  1. 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/dimcountry.sql](references/posthog/dimcountry.sql) (derive + enrich from events), [dimplan.sql](references/posthog/dimplan.sql) (lookup/upload pattern).

dbt: conformed dim* models with unique/notnull/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 dimdate / dimcountry + 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.