mcpbeat Sign in

Modeling Dimension Tables Agent Skill

> 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 hand-rolled rate table. Read modeling-warehouse-foundations first; dimensions here are reused by the revenue, conversion, activation, and product-usage modeling skills.

3k tokens
context cost
the whole folder, loaded on every use
7
files
instructions only
0
copies elsewhere
how many repositories repackaged it
690
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/PostHog/posthog --skill modeling-dimension-tables

What comes with it

7 289 bytes besides the instruction
references/dbt/dim_country.sql
references/dbt/dim_date.sql
references/dbt/schema.yml
references/dimension-catalog.md
references/posthog/dim_country.sql
references/posthog/dim_plan.sql

The instruction itself

7 sections, as written by the author

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; recipes in

references/posthog/ and 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:

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

  • 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

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

  • Alias to clean, stable namescountry_code, region, plan_tier. These names become the join

surface everything else depends on.

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

  • 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 (derive + enrich from events),

dim_plan.sql (lookup/upload pattern).

dbt: conformed dim_* models with unique/not_null/relationships tests, plus a generated

dim_date. Recipes: references/dbt/.

File map

| File | Read when |

| -------------------------------------------------------------------- | ----------------------------------------------------------- |

| references/dimension-catalog.md | Common dimensions, how to source each, and the natural key. |

| references/posthog/ | HogQL aliased-dimension view recipes. |

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

Other skills for the same job

different authors, same section of the catalogue
Content Creator
by ComeOnOliver
×2

Create SEO-optimized marketing content with consistent brand voice. Includes brand voice analyzer, SEO optimizer, content frameworks, and social media templates. Use when writing blog posts, creating social media content, analyzing brand voice, optimizing SEO, planning content calendars, or when user mentions content creation, brand voice, SEO optimization, social media marketing, or content strategy.

17k tokens scripts
SEO Content Planner
by ComeOnOliver
×2

Creates comprehensive content outlines and topic clusters for SEO. Plans content calendars and identifies topic gaps. Use PROACTIVELY for content strategy and planning.

3k tokens
Crisis Response Protocol
by BioTender-max
×1

Handle mental health crisis situations in AI coaching safely. Use when implementing crisis detection, safety protocols, emergency escalation, or suicide prevention features. Activates for crisis keywords, safety planning, hotline integration, and risk assessment.

3k tokens
Social Content
by ComeOnOliver
×1

When the user wants help creating, scheduling, or optimizing social media content for LinkedIn, Twitter/X, Instagram, TikTok, Facebook, or other platforms. Also use when the user mentions 'LinkedIn post,' 'Twitter thread,' 'social media,' 'content calendar,' 'social scheduling,' 'engagement,' or 'viral content.' This skill covers content creation, repurposing, and platform-specific strategies.

9k tokens
Gtm Partnership Architecture
by github
vendor

Build and scale partner ecosystems that drive revenue and platform adoption. Use when building partner programs from scratch, tiering partnerships, managing co-marketing, making build-vs-partner decisions, or structuring crawl-walk-run partner deployment.

4k tokens
Monetization Strategy
by phuryn

Brainstorm 3-5 monetization strategies with audience fit, risks, and validation experiments. Use when exploring revenue models, evaluating pricing strategies, or deciding how to monetize a product.

2k tokens
Positioning Ideas
by phuryn

Brainstorm product positioning ideas differentiated from competitors. Identifies top competitors and generates positioning statements with rationale. Use when developing product positioning, differentiating from competitors, or crafting brand positioning strategy.

750 tokens
Campaign Plan
by anthropics
vendor

Generate a full campaign brief with objectives, audience, messaging, channel strategy, content calendar, and success metrics. Use when planning a product launch, lead-gen push, or awareness campaign, when you need a week-by-week content calendar with dependencies, or when translating a marketing goal into a structured, executable plan.

4k tokens

How to use it

Copy the folder

Take posthog/modeling-dimension-tables from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.