Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

data-modeling

verified

Patterns for entity relationship design and data modeling

View on GitHub

Marketplace

alphaagent-team

the-answerai/alphaagent-team

Plugin

aai-dev-database

dev

Repository

the-answerai/alphaagent-team

plugins/aai-dev-database/skills/data-modeling/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/the-answerai/alphaagent-team/blob/main/plugins/aai-dev-database/skills/data-modeling/SKILL.md -a claude-code --skill data-modeling

Installation paths:

Claude
.claude/skills/data-modeling/
Powered by add-skill CLI

Instructions

# Data Modeling Skill

Patterns for designing effective data models.

## Entity-Relationship Design

### Identifying Entities

```
Questions to ask:
1. What are the core "things" in the system?
2. What data needs to be persisted?
3. What has its own identity/lifecycle?

Examples:
- User (has identity, persisted)
- Order (has identity, persisted)
- Session token (temporary, maybe not entity)
```

### Defining Relationships

```prisma
// One-to-One: Each user has exactly one profile
model User {
  profile Profile?
}
model Profile {
  userId String @unique
  user   User   @relation(fields: [userId], references: [id])
}

// One-to-Many: User has many posts
model User {
  posts Post[]
}
model Post {
  authorId String
  author   User   @relation(fields: [authorId], references: [id])
}

// Many-to-Many: Posts have many tags, tags have many posts
model Post {
  tags Tag[]
}
model Tag {
  posts Post[]
}
```

### Cardinality Decisions

| Relationship | When to Use | Example |
|--------------|-------------|---------|
| 1:1 | Optional extension data | User -> Profile |
| 1:N | Parent owns children | Order -> OrderItems |
| M:N | Independent association | Post <-> Tag |

## Common Domain Models

### User/Auth Model

```prisma
model User {
  id            String    @id @default(uuid())
  email         String    @unique
  passwordHash  String
  emailVerified Boolean   @default(false)

  // Profile data
  name          String?
  avatarUrl     String?

  // Auth
  sessions      Session[]
  apiKeys       ApiKey[]

  // Audit
  createdAt     DateTime  @default(now())
  updatedAt     DateTime  @updatedAt
  lastLoginAt   DateTime?
}

model Session {
  id        String   @id @default(uuid())
  userId    String
  token     String   @unique
  expiresAt DateTime
  userAgent String?
  ipAddress String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@index([userId])
  @@index([token])
}
```

### E-Commerce Model

```prisma
model Product {
  id          Strin

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6924 chars