data-warehouse-schema

Design star and snowflake data warehouse schemas with fact tables, dimensions, and SCD handling.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill data-warehouse-schema-kalilurrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-warehouse-schema
Source: https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts/tree/main/03-data-analytics/data-warehouse-schema
Command: npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill data-warehouse-schema-kalilurrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing an analytics database is fundamentally different from designing an OLTP schema, and mistakes in grain selection, dimension modeling, or history tracking lead to slow queries and incorrect reports. This Skill guides the design of dimensional data warehouse schemas and outputs ready-to-use DDL. ## Core Features & Use Cases - Star and Snowflake Schema Design: Model fact tables with measures and foreign keys, plus de-normalized dimensions for time, customer, product, and store. - Slowly Changing Dimensions: Implement SCD Type 1, Type 2, and Type 3 patterns with surrogate keys, effective dates, and current-row flags. - Performance Optimization: Generate indexes, pre-aggregated summary tables, and common analytical queries such as customer lifetime value and top products by category. - Use Case: A data engineer building a sales analytics warehouse can produce the full DDL for fact_sales, dim_time (pre-populated for 10 years), and SCD Type 2 customer dimensions, along with ETL key-lookup logic. ## Quick Start Ask the AI to design a star schema for daily retail sales with customer, product, store, and time dimensions including Type 2 history tracking.

Frequently Asked Questions about data-warehouse-schema

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a star schema for a data warehouse?

Start by identifying the business process and choosing the grain, such as daily sales transactions. Then create a central fact table holding measures and foreign keys, surrounded by de-normalized dimension tables for time, customer, product, and store.

What is the difference between star schema and snowflake schema?

A star schema uses de-normalized dimensions joined directly to the fact table, giving faster queries with fewer joins. A snowflake schema normalizes dimensions into sub-tables, reducing storage for large hierarchies but adding join overhead.

How do I implement SCD Type 2 in SQL?

Expire the current dimension row by setting its expiration_date and is_current flag, then insert a new row with the updated attributes and a new surrogate key. Queries look up the row valid for a given date using effective_date and expiration_date ranges.

When should I use a snowflake schema instead of a star schema?

Use snowflake when dimension tables contain millions of rows, strong hierarchies exist such as geography or product taxonomy, or storage is constrained. Accept the trade-off of more joins and slower queries.

Why should fact tables use surrogate keys instead of natural keys?

Natural keys like customer IDs can change over time, breaking historical references. Integer surrogate keys never change, keep fact table rows narrow, and enable SCD Type 2 history where one natural key maps to multiple dimension versions.

How do I handle late-arriving dimensions in ETL loading?

Insert facts against a default Unknown dimension row rather than blocking the load when a dimension lookup fails. This keeps the ETL pipeline running while preserving referential integrity until the real dimension record arrives.