data-model
Skill3 starsChanged 8 months agoMITView on GitHub
Use when designing database schema, entity relationships, or index strategy before writing migrations — for PostgreSQL with Go or Python
5 other projects use a version of this.
Adopted by
Most recently taken up by
- gonimar/claude-web-studiotheir own version, first seen Sep 27, 2026
- ryktara/Foundrytheir own version, first seen Sep 25, 2026
- augments-labs/sdlc-skillstheir own version, first seen Aug 8, 2026
- genkovich/sddtheir own version, first seen Jun 11, 2026
- Modular-Earth-LLC/solutions-architecture-agenttheir own version, first seen Mar 15, 2026
Used with
Projects with it also use design-system.
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.
AnthropicSkilldesign-system
Audit, document, or extend your design system. Use when checking for naming inconsistencies or hardcoded values across components, writing documentation for a component's variants, states, and accessibility notes, or designing a new pattern that fits the existing system.
Also in 3 projects that use this
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- genkovich/sdd★ 170same name
- gonimar/claude-web-studio★ 5same name
- Modular-Earth-LLC/solutions-architecture-agent★ 2same name
- augments-labs/sdlc-skills★ 1same name
- ryktara/Foundry★ 0same name
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 repository36 other files it gives its agents.
- adrSkill
- analyticsSkill
- api-contractSkill
- api-designSkill
- ci-pipelineSkill
- claude-mdSkill
- code-qualitySkill
- db-migrateSkill
- debugSkill
- deploySkill
- dep-updateSkill
- disk-cleanupSkill
- docker-buildSkill
- eng-leadSkill
- event-drivenSkill
- fullstack-healthcheckSkill
- go-featureSkill
- go-integration-testSkill
- go-refactorSkill
- go-scaffoldSkill
- incident-responseSkill
- interactive-clarifySkill
- observabilitySkill
- onboardingSkill
- product-specSkill
- py-featureSkill
- py-integration-testSkill
- py-migrateSkill
- py-refactorSkill
- py-scaffoldSkill
- react-featureSkill
- react-refactorSkill
- react-scaffoldSkill
- review-codeSkill
- securitySkill
- system-designSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 85
Always add created_at (when was this relationship created?)
- Distinctive: line 86
Consider adding metadata (role, permissions, status)
- Very specific: line 88
Consider if soft-delete is needed (deleted_at)
- Distinctive: line 122
Before finalizing, list the queries your app will run and verify each one is covered:
“Common” is measured: kept by at least 6 in 10 of the 5 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 Model Design
Overview
Design your database schema before writing migrations. Think about entities, relationships, access patterns, and indexes upfront.
Core principle: Your schema is your most permanent decision. Code is easy to refactor, schema migrations on production data are not.
When to Use
- Starting a new project (before first migration)
- Adding a new domain area with multiple tables
- Redesigning existing schema
- Performance issues traced to schema problems
Design Process
1. Identify Entities
From user stories, extract the nouns — these are your entities:
"User creates an organization and invites members"
→ Entities: User, Organization, Membership, Invitation
"User writes posts and receives comments"
→ Entities: User, Post, Comment2. Define Attributes
For each entity, define columns with types:
## Users
| Column | Type | Constraints | Notes |
|--------|------|------------|-------|
| id | UUID | PK, default gen_random_uuid() | |
| email | TEXT | NOT NULL, UNIQUE | |
| name | TEXT | NOT NULL | |
| role | user_role ENUM | NOT NULL, default 'member' | admin, member, viewer |
| avatar_url | TEXT | nullable | |
| metadata | JSONB | NOT NULL, default '{}' | extensible fields |
| created_at | TIMESTAMPTZ | NOT NULL, default NOW() | |
| updated_at | TIMESTAMPTZ | NOT NULL, default NOW() | |Type conventions (PostgreSQL):
| Use Case | Type | Not |
| Identifiers | UUID | SERIAL, BIGINT (unless performance-critical) |
| Text | TEXT | VARCHAR(n) (Postgres treats them identically) |
| Timestamps | TIMESTAMPTZ | TIMESTAMP (always include timezone) |
| Money | BIGINT (cents) or NUMERIC | FLOAT, DOUBLE |
| Booleans | BOOLEAN | INT |
| Flexible data | JSONB | JSON (JSONB is indexed, JSON is not) |
| Enums | CREATE TYPE ... AS ENUM | TEXT with CHECK |
| Arrays | TEXT[], UUID[] | Separate table (unless truly array data) |
3. Define Relationships
## Relationships
### One-to-Many
- Organization (1) → Users (N) — via org_id FK on users
- User (1) → Posts (N) — via author_id FK on posts
### Many-to-Many
- User ↔ Organization — via memberships junction table
- memberships(user_id, org_id, role, joined_at)
- UNIQUE(user_id, org_id)
### One-to-One
- User (1) → Profile (1) — via user_id UNIQUE FK on profilesJunction table rules:
- Always add
created_at(when was this relationship created?) - Consider adding metadata (role, permissions, status)
- Composite unique index on both FKs
- Consider if soft-delete is needed (
deleted_at)
4. Index Strategy
Rule: Every WHERE, JOIN ON, and ORDER BY column needs an index if the table will grow beyond 10k rows.
## Indexes
### users
- email (UNIQUE) — login lookup
- org_id — list users by org
- created_at — sort/filter by date
### posts
- author_id — user's posts
- (org_id, created_at DESC) — feed query
- (org_id, status) WHERE status = 'published' — partial index
### memberships
- (user_id, org_id) UNIQUE — prevent duplicates
- org_id — list org membersIndex types:
| Type | When |
| B-tree (default) | Equality, range, sorting |
| GIN | JSONB fields, array fields, full-text search |
Partial (WHERE condition) | Queries that filter on a specific value |
Composite (a, b) | Queries that filter on a + b together |
5. Access Pattern Analysis
Before finalizing, list the queries your app will run and verify each one is covered:
## Access Patterns
| Query | Frequency | Indexed? |
|-------|-----------|----------|
| Get user by email | Very high (every auth) | ✅ users.email UNIQUE |
| List org members | High | ✅ memberships.org_id |
| Get user's orgs | High | ✅ memberships.user_id |
| Feed: org posts by date | High | ✅ posts(org_id, created_at DESC) |
| Search posts by title | Medium | ❌ Need GIN index on title |
| Count users by plan | Low (admin) | ❌ OK — sequential scan fine |6. Soft Delete vs Hard Delete
## Deletion Strategy
| Entity | Strategy | Reason |
|--------|----------|--------|
| User | Soft (deleted_at) | Legal retention, audit trail |
| Post | Soft (deleted_at) | User might want to recover |
| Session | Hard | No retention need, high volume |
| Invitation | Hard after expiry | Short-lived, no audit need |Soft delete pattern:
-- Add to table
deleted_at TIMESTAMPTZ DEFAULT NULL
-- Partial index (only query active records)
CREATE INDEX idx_users_active ON users (email) WHERE deleted_at IS NULL;
-- All queries must include WHERE deleted_at IS NULL7. Schema Review Checklist
- Every table has
id UUID PRIMARY KEY DEFAULT gen_random_uuid() - Every table has
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() - Every table has
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() - All foreign keys have explicit
ON DELETEbehavior (CASCADE, SET NULL, or RESTRICT) - All high-frequency WHERE columns have indexes
- No
VARCHAR(n)— useTEXT - No
TIMESTAMP— useTIMESTAMPTZ - JSONB columns have GIN indexes if queried
- Enum types are used for fixed value sets
- Junction tables have composite unique indexes
- Soft-delete tables have partial indexes on active records
Chains
- Before:
product-specfor user stories,system-designfor architecture - After:
db-migrateorpy-migrateto implement the schema - Document:
adrfor significant schema decisions
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.

