/humaninloop:patterns-entity-modelingfrom humaninloop
Extracts and models domain entities from requirements using DDD principles. Covers entity identification, attribute definition, relationship modeling, and state machine documentation.
Ships in humaninloop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Extract and model domain entities from requirements using Domain-Driven Design principles. This skill covers entity identification, attribute definition, relationship modeling, and state machine documentation.
humaninloop:patterns-api-contracts insteadhumaninloop:patterns-technical-decisionsLook for entities in:
| Source | Pattern | Example |
|---|---|---|
| User stories | "As a [Role]..." | User, Admin, Guest |
| Subjects | "The [Entity] must..." | Task, Order, Product |
| Actions | "...create a [Entity]" | Comment, Message, Report |
| Possessives | "[Entity]'s [attribute]" | User's profile, Order's items |
| Status mentions | "[Entity] status" | TaskStatus, OrderState |
IF concept has its own lifecycle → Entity
IF concept only exists within another → Attribute
IF concept connects two entities → Relationship (possibly join entity)
IF concept has just one value → Attribute
Examples:
- "user email" → Attribute of User (just one value)
- "user address" → Could be Entity (if reused) or Attribute (if embedded)
- "order items" → Separate entity (has own lifecycle)
- "task status" → Enum/attribute (limited values)
When modeling in brownfield projects:
| Status | Meaning | Action |
|---|---|---|
[NEW] | Entity doesn't exist | Create full definition |
[EXTENDS EXISTING] | Adding to existing entity | Document new fields only |
[REUSES EXISTING] | Using existing as-is | Reference only |
[RENAMED] | Avoiding collision | Document new name + reason |
Every entity typically needs:
| Field | Type | Required | Description |
|---|---|---|---|
| id | Identifier | Yes | Primary key |
| createdAt | Timestamp | Yes | Creation time |
| updatedAt | Timestamp | Yes | Last modification |
| deletedAt | Timestamp | No | Soft delete marker |
| Attribute | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| id | UUID | Yes | auto-generated | Unique identifier |
| email | Email | Yes | - | User's email address |
| name | Text(100) | No | null | Display name |
| role | Enum[admin,member,guest] | Yes | member | Access level |
| isVerified | Boolean | Yes | false | Email verified flag |
Use conceptual types (not database-specific):
| Conceptual Type | Description |
|---|---|
Identifier / UUID | Unique identifier |
Text / Text(N) | String with optional max length |
Email | Email format string |
URL | URL format string |
Integer | Whole number |
Decimal / Decimal(P,S) | Decimal with precision |
Boolean | True/false |
Timestamp | Date and time |
Date | Date only |
Enum[values] | Fixed set of values |
JSON | Structured data |
Reference(Entity) | Foreign key reference |
Mark sensitive fields:
| Attribute | Type | Required | PII | Description |
|-----------|------|----------|-----|-------------|
| email | Email | Yes | **PII** | User's email |
| phone | Text(20) | No | **PII** | Phone number |
| ssn | Text(11) | No | **PII-SENSITIVE** | Social security |
Relationships connect entities with defined cardinality: One-to-One (1:1), One-to-Many (1:N), or Many-to-Many (N:M).
See RELATIONSHIP-PATTERNS.md for detailed patterns, join entity examples, and documentation formats.
## Entity Relationships
User ──1:N──▶ Task (owns) User ──1:N──▶ Session (has) User ◀──N:M──▶ Project (via ProjectMember) Task ──N:1──▶ Project (belongs to)
Entities with status fields need state transition documentation.
See STATE-MACHINES.md for patterns, diagram formats, and common workflows.
Model state machines when:
status or state fieldConstraints and validation rules ensure data integrity.
See VALIDATION-RULES.md for constraint patterns, format validations, and business rule documentation.
# Data Model: {feature_id}
> Entity definitions and relationships for the feature.
> Generated by Domain Architect.
---
## Summary
| Entity | Attributes | Relationships | Status |
|--------|------------|---------------|--------|
| User | 8 | 3 | [EXTENDS EXISTING] |
| Session | 5 | 1 | [NEW] |
| ...
---
## Entity: User [EXTENDS EXISTING]
> Existing entity extended with authentication fields.
### Attributes
| Attribute | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| passwordHash | Text | Yes | - | Hashed password |
| lastLoginAt | Timestamp | No | null | Last login time |
### Existing Attributes (Not Modified)
| Attribute | Type | Description |
|-----------|------|-------------|
| id | UUID | Existing primary key |
| email | Email | Existing email field |
---
## Entity: Session [NEW]
> User authentication session.
### Attributes
| Attribute | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| id | UUID | Yes | auto | Session identifier |
| userId | Reference(User) | Yes | - | Owning user |
| token | Text(255) | Yes | - | Session token |
| expiresAt | Timestamp | Yes | - | Expiration time |
| createdAt | Timestamp | Yes | auto | Creation time |
### Relationships
| Relationship | Type | Target | Description |
|--------------|------|--------|-------------|
| user | N:1 | User | Session belongs to user |
---
## Relationships
[Relationship documentation]
---
## State Machines
[State machine documentation if applicable]
---
## Traceability
| Entity | Source Requirements |
|--------|---------------------|
| User | FR-001, FR-002, US#1 |
| Session | FR-003, US#2 |
Before finalizing entity model, verify:
❌ Skipping entities mentioned in requirements ("we'll add that later") ✅ Evaluate every noun from requirements for entity status
❌ Entity with only id field and no attributes
✅ Every entity needs meaningful attributes that describe its purpose
❌ Using VARCHAR(255), INT(11), BIGINT in data model
✅ Use conceptual types: Text(100), Integer, Identifier
❌ Reference attributes without relationship documentation
✅ Every Reference(Entity) needs cardinality and relationship description
❌ Status/state fields without transition documentation ✅ Every status field needs state machine diagram and valid transitions
❌ Email, phone, address fields without PII markers
✅ Always mark sensitive data with **PII** or **PII-SENSITIVE**
❌ Entities with no relationships to other entities ✅ Every entity connects to at least one other entity (or is explicitly standalone)
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub deepeshbodh/human-in-loop --plugin humaninloop29 skills in this plugin
/analysis-codebaseThis skill MUST be invoked when the user says "analyze codebase", "scan project", "detect tech stack", "codebase analysis", "collision risk", or "brownfield". SHOULD also invoke when user mentions "existing code" or "project context"./analysis-iterativeThis skill MUST be invoked when the user says "brainstorm", "deep analysis", "let's think through", "analyze this with me", or "help me think through". SHOULD also invoke when feature descriptions lack Who/Problem/Value clarity during specification enrichment./analysis-screenshotThis skill MUST be invoked when the user says "analyze screenshot", "extract design tokens", "pull colors from screenshot", "component inventory", "break down this UI", or "design extraction". SHOULD also invoke when user mentions "screenshot", "color palette", "typography", "spacing", or "component catalog"./analysis-specificationsThis skill MUST be invoked when the user says "review spec", "find gaps", "what's missing", or "clarify requirements". SHOULD also invoke when reviewing spec.md for completeness. Focuses on product decisions and generates clarifying questions with concrete options./authoring-constitutionThis skill MUST be invoked when the user says "write principles", "define governance", "create constitution", or "write a constitution". SHOULD also invoke when user mentions "governance", "principles", "enforcement", or "amendment process". Core skill for greenfield projects./authoring-design-systemThis skill MUST be invoked when the user says "assemble design system", "build design system", "merge extractions", "consolidate tokens", "unify design tokens", or "synthesize design system". SHOULD also invoke when user mentions "design system", "token consolidation", "component normalization", or "multi-screenshot synthesis".Other plugins' skills for the same job