data-modeling
Skill1 starsChanged 9 months agoMITView on GitHub
Designs domain models, entity relationships, and data shapes before writing code or schemas. Covers entity identification, relationship mapping, aggregate design, and access pattern validation. Use when designing data structures for new features or systems.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- bjornjee/skillstheir own version, first seen Sep 8, 2026
- khuynh22/agent-dev-teamtheir own version, first seen Aug 31, 2026
- TheArcForge/hades-plugintheir own version, first seen Aug 20, 2026
- arjunprabhulal/agent-skillstheir own version, first seen Aug 3, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Jul 14, 2026
- anurag-azure/skillstheir own version, first seen Jun 27, 2026
Used with
Projects with it also use incident-response and git-workflow.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
AnthropicSkillincident-response
Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.
Also in 4 projects that use this
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- nimadorostkar/Claude-Skills-collection★ 28same name
- jdm4pku/RE-Skills★ 26same name
- vshrinath/virtual-product-factory★ 16same name
- khuynh22/agent-dev-team★ 9same name
- arjunprabhulal/agent-skills★ 4same name
- MartinOlivero/saas-builder★ 4same name
- TheArcForge/hades-plugin★ 3same name
- bjornjee/skills★ 2same name
- mmondora/claude-skills★ 1same name
- anurag-azure/skills★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository48 other files it gives its agents.
- accessibilitySkill
- api-designSkill
- api-integrationSkill
- architectSkill
- async-patternsSkill
- best-practicesSkill
- bugSkill
- buildSkill
- cachingSkill
- ci-cdSkill
- config-managementSkill
- containerizeSkill
- database-designSkill
- data-pipelineSkill
- debug-latencySkill
- dependency-updateSkill
- deploySkill
- dev-setupSkill
- docsSkill
- error-handlingSkill
- estimateSkill
- feature-flag-opsSkill
- git-recoverySkill
- i18nSkill
- iacSkill
- incidentSkill
- load-testingSkill
- loggingSkill
- migrateSkill
- monitoringSkill
- observability-debugSkill
- onboardSkill
- perfSkill
- phase-gateSkill
- pr-authorSkill
- qaSkill
- refactorSkill
- reviewSkill
- rollbackSkill
- schema-evolutionSkill
- scope-checkSkill
- security-auditSkill
- state-managementSkill
- tech-debtSkill
- tech-stackSkill
- telemetrySkill
- testingSkill
- workflowSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Ownership: If A is deleted, should B be deleted too?
- Distinctive: line 74
Reference by ID: Don't embed other aggregates.
- Distinctive: line 92
Before finalizing the model, list every way the data will be read:
- Distinctive: line 108
Should anything be denormalized for read performance?
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Data Modeling
Model the domain, not the UI, not the database, not the API. The domain model is upstream of everything - get it wrong and every layer inherits the mistake.
Reference:
reference/modeling-patterns.md- Normalization levels, relationship patterns, soft delete, audit trails, ID types, polymorphic associations, temporal data.
Step 1: Identify Entities
An entity is a thing with identity that changes over time.
Ask These Questions
- What are the "nouns" in the domain? (User, Order, Product, Payment)
- Which things have a lifecycle? (Created → Active → Closed)
- Which things need to be referenced by other things? (Foreign keys)
- Which things are always accessed together? (Same aggregate)
Entity vs Value Object
| Entity | Value Object | |
| Identity | Has a unique ID | No ID, defined by its values |
| Lifecycle | Changes over time | Immutable |
| Example | User, Order, Invoice | Address, Money, DateRange |
| Storage | Own table/document | Embedded in parent entity |
Entity: User (id: 123, name: "Alice", email: "alice@x.com")
- Identity matters: User 123 is User 123 even if name changes
Value Object: Money (amount: 5000, currency: "USD")
- Identity doesn't matter: any Money(5000, "USD") is interchangeableStep 2: Map Relationships
| Relationship | Pattern | Example |
| One-to-One | FK on either side, or embed | User ↔ Profile |
| One-to-Many | FK on the "many" side | User → Orders |
| Many-to-Many | Junction table | Student ↔ Course (via Enrollment) |
| Self-referential | FK to same table | Employee → Manager (Employee) |
| Polymorphic | Type column + ID, or separate tables | Comment on Post or Photo |
Relationship Questions
- Ownership: If A is deleted, should B be deleted too? (cascade)
- Cardinality: One-to-one, one-to-many, many-to-many?
- Optionality: Is the relationship required or optional?
- Direction: Who needs to find whom? (This determines where indexes go)
Step 3: Define Aggregates
An aggregate is a cluster of entities that are always consistent together. The aggregate root is the entry point.
Aggregate: Order
Root: Order
Children: OrderItem, OrderDiscount
Rule: Total = sum of (item prices - discounts)
Invariant: Total must never be negative
→ You load/save the entire Order aggregate atomically
→ You NEVER modify OrderItems without going through Order
→ Other aggregates reference Order by ID onlyAggregate Design Rules
- Small aggregates. An aggregate that contains 1000 items is too big. Split.
- Consistency boundary. Everything inside must be consistent. Across aggregates = eventual consistency.
- Reference by ID. Don't embed other aggregates. Reference them by ID.
- One transaction per aggregate. Modifying two aggregates in one transaction = design smell.
Step 4: Choose IDs
| ID Type | Pros | Cons | Best For |
| Auto-increment (INT) | Simple, small, sortable | Not distributed-safe, predictable | Single-database systems |
| UUID v4 | Globally unique, no coordination | Large (16 bytes), random (bad for B-tree) | Distributed systems |
| UUID v7 | Globally unique + time-sortable | Relatively new | Modern distributed systems |
| ULID | Time-sortable, URL-safe | Less standard | APIs where URL appearance matters |
Prefixed ID (usr_abc123) | Human-readable, type-safe | Custom generation | User-facing APIs |
| Composite key | Natural meaning | Complex JOINs | Junction tables, time-series |
Recommendation: UUID v7 or prefixed IDs for new systems. Auto-increment if single database and no API exposure.
Step 5: Validate Against Access Patterns
Before finalizing the model, list every way the data will be read:
ACCESS PATTERNS:
1. Get user by ID → users table, PK lookup
2. List orders for a user → orders WHERE user_id = X
3. Search products by name → products WHERE name LIKE '%X%' (full-text search?)
4. Get order with all items → orders JOIN order_items
5. Dashboard: orders per day → orders GROUP BY date (materialized view?)
6. Get user's recent activity → needs cross-entity query (denormalize?)For each pattern:
- Can the model serve this efficiently?
- Does it require a JOIN? How many?
- Does it need an index? What kind?
- Should anything be denormalized for read performance?
If an access pattern is awkward, the model is wrong. Adjust the model, don't work around it.
Step 6: Handle State Machines
Most entities have a lifecycle. Model it explicitly.
Order States:
DRAFT → PLACED → PAID → SHIPPED → DELIVERED
↘ CANCELLED
Allowed Transitions:
DRAFT → PLACED (when submitted)
PLACED → PAID (when payment confirmed)
PLACED → CANCELLED (when cancelled before payment)
PAID → SHIPPED (when shipped)
SHIPPED → DELIVERED (when delivery confirmed)
Invalid Transitions (reject):
DELIVERED → DRAFT (can't go back)
CANCELLED → PAID (can't pay cancelled order)Rules:
- Enumerate all states explicitly
- Define allowed transitions
- Validate transitions in code (reject invalid state changes)
- Store timestamps for each transition (
placed_at,paid_at,shipped_at)
Model Documentation Template
## Entity: [Name]
### Fields
| Field | Type | Required | Notes |
|-------|------|----------|-------|
| id | UUID v7 | Yes | Primary key |
| ... | ... | ... | ... |
### Relationships
- Has many [Entity] (via [field])
- Belongs to [Entity] (via [field])
### States
[state diagram if applicable]
### Access Patterns
1. [Pattern] - [how it's served]
### Invariants
- [Business rule that must always be true]Common Mistakes
| Mistake | Problem | Fix |
| Model mirrors the UI | UI changes → model changes | Model the domain, not the screens |
| God entity | One entity with 40 fields, handles everything | Split into aggregates |
| Anemic model | Entities are just data bags, logic lives elsewhere | Put behavior with the data it operates on |
| Premature denormalization | Duplicated data, inconsistency risk | Normalize first, denormalize for measured performance needs |
| Missing state machine | State transitions unconstrained | Explicit states + allowed transitions |
| Stringly typed | Status as free-text string | Use enums with exhaustive handling |
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.

