data-model-design
Skill5 starsChanged 2 months agoMITView on GitHub
Dimensional modeling and schema design for data products. Star schema patterns, slowly changing dimensions, denormalization decisions, and architecture decision records. Use when designing data models, reviewing schema designs, choosing between normalization strategies, or when someone asks "how should I model this data?" or "should I denormalize?" For OMOP CDM patterns specifically, see healthcare-data-domain.
In this repository24 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- analystSkill
- arbitrage-audit-dataSkill
- dashboards-to-decisionsSkill
- databricks-data-product-reviewSkill
- data-consumer-discoverySkill
- data-pipeline-qualitySkill
- data-product-operatorSkill
- data-product-thinkingSkill
- data-product-validationSkill
- data-quality-assessmentSkill
- data-storytellingSkill
- data-team-operating-modelSkill
- data-team-positioningSkill
- duckdb-data-profilingSkill
- ethical-risk-assessmentSkill
- grill-me-dataSkill
- healthcare-cohort-designSkill
- healthcare-data-domainSkill
- healthcare-data-readiness-debriefSkill
- healthcare-data-reconciliationSkill
- metrics-definitionSkill
- research-synthesis-dataSkill
- stakeholder-alignmentSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Never fully denormalize into One Big Table.
- Distinctive: line 30
Start with the query patterns.
- Very specific: line 36
Type 2: - Add a new row with effective dates.
- Distinctive: line 38
Type 3: - Add a column for the previous value.
- Distinctive: line 40
Default to Type 2 for any dimension where the business asks "what was it at the time of X?" Start with Type 1 for everything else and …
- Distinctive: line 50
Keep ADRs in the repo alongside the schema.
- Distinctive: line 54
Before building, validate with limited data:
- Distinctive: line 56
Run the top 10 expected queries
- Distinctive: line 57
Verify results match expectations
- Distinctive: line 58
Check query performance against SLA
- Distinctive: line 69
NOT NULL on required fields (nullable everything = garbage in)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Star Schema as Default
For analytics data products, default to star schema with strategic denormalization:
Fact tables contain events at the lowest useful grain:
- One row per event (transaction, visit, measurement, interaction)
- Foreign keys to dimension tables
- Numeric measures (amount, count, duration)
- Timestamps at the grain of the analysis
Dimension tables contain context:
- Descriptive attributes for filtering and grouping
- Human-readable labels alongside codes
- Hierarchies for drill-down (region -> state -> city)
Never fully denormalize into One Big Table. Many-to-many relationships cause exponential row growth. A patient with 10 conditions and 5 medications creates 50 rows instead of 15.
Start with the query patterns. What questions will consumers ask? Design the schema to make those queries simple. If 80% of queries filter by date and group by category, those should be the primary dimensions.
Slowly Changing Dimensions (SCD)
Type 1 - Overwrite the old value. Use when history doesn't matter (correcting a typo in a name).
Type 2 - Add a new row with effective dates. Use when you need to track what was true at a point in time (patient address at time of visit, product price at time of sale). Add effective_start_date, effective_end_date, and is_current flag.
Type 3 - Add a column for the previous value. Use when you only need one level of history (current_category, previous_category).
Default to Type 2 for any dimension where the business asks "what was it at the time of X?" Start with Type 1 for everything else and upgrade when the need emerges.
Architecture Decision Records
For every non-obvious modeling decision, write a lightweight ADR:
- Context: What situation prompted the decision?
- Options: What alternatives were considered?
- Decision: What was chosen and why?
- Consequences: What are the tradeoffs?
Keep ADRs in the repo alongside the schema. Future team members will ask "why is it modeled this way?" The ADR answers before they have to ask.
Design Validation
Before building, validate with limited data:
- Load a representative sample (1-5% of volume)
- Run the top 10 expected queries
- Verify results match expectations
- Check query performance against SLA
- Confirm grain is correct (no unexpected row multiplication)
Source Schema Evaluation
You probably won't design the OLTP schema. But you'll need to evaluate whether it's a reliable source for your data product.
Quick checklist before building on a source system:
- Primary keys defined and enforced (not just implied by convention)
- Foreign keys constrained at the database level (not just in the application)
- Indexes on FK columns (missing indexes = slow extracts)
- NOT NULL on required fields (nullable everything = garbage in)
- Migrations are reversible (no destructive ALTER TABLE without a rollback plan)
Anti-patterns to flag immediately:
VARCHAR(255)on every string column (signals no thought about data types)FLOATorDOUBLEfor money (useDECIMALor integer cents)- Missing FK constraints ("the app handles it" means orphaned rows)
- Dates stored as strings ("2024-01-15" in a
VARCHARbreaks sorting and comparison)
See schema-patterns.md for common dimensional modeling patterns.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

