From pi-dev
Use when creating a Data Model document. Derives entities from the domain model, then asks about storage details per entity. Writes to 02_business/.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pi-dev:data-modelThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Define the persistence model. Derives entity list from domain model — doesn't ask again for what's known.
Define the persistence model. Derives entity list from domain model — doesn't ask again for what's known.
Read domain model + business rules → Present entity list → Confirm which need storage
→ Per entity: fields + types → Relationships → Conventions → Write
Run:
find . -maxdepth 3 -type d -name "docs" | grep -v node_modules | grep -v ".git" | sort
./docs)docs/ and create it if missingRead docs/02_business/domain_model.md. Extract:
Read docs/02_business/business_rules.md if exists. Extract:
If domain model doesn't exist: tell user to run pi-dev:domain-model first.
Tell user:
"I found these entities in the domain model: [list]. I'll create a table for each. Some entities may be transient (no storage needed) — let me know which."
Q1: "Which entities from the domain model need persistent storage? Are any transient (calculated, in-memory only)?" (free text or "All need storage")
Remove transient entities from the table list.
Q2: "What type of storage?" (AskUserQuestion options: Relational SQL / Document NoSQL / Both / Not decided yet)
For each entity that needs storage, present what the domain model already defines (attributes) and ask for storage specifics:
Q3: "For [Entity]: the domain model defines attributes [list]. What are the data types, constraints, and any additional fields not in the domain model?" (free text)
Example guidance: "id (UUID, PK), amount (DECIMAL 10,2, NOT NULL, > 0), account_id (UUID, FK → accounts), created_at (TIMESTAMP, NOT NULL)"
For each validation rule from business_rules.md that applies to this entity, pre-fill it as a constraint.
Q4: "For [Entity]: what are the most common read queries? (affects indexes)" (free text) Example: "Find all transactions by account, ordered by date" → index on account_id + created_at
Q5: "Soft deletes or physical deletes?" (AskUserQuestion options: Soft delete (deleted_at) / Physical delete / Mixed — depends on entity / Not decided)
Q6: "Is data isolated per user, per organization, or shared?" (options: Per user / Per organization / Shared / Not applicable)
Q7: "What is the primary key convention?" (options: UUID / Auto-increment integer / Other)
# Data Model
**Project:** [name]
**Storage:** [Q2]
**Date:** [today]
**Source:** Derived from `docs/02_business/domain_model.md`
## Conventions
- **Primary keys:** [Q7]
- **Soft deletes:** [Q5]
- **Tenancy:** [Q6]
- **Timestamps:** all tables include `created_at`, `updated_at` (NOT NULL)
[deleted_at if soft delete]
## Tables
### [entity_name]
| Field | Type | Constraints | Notes |
|-------|------|-------------|-------|
| id | [type] | PRIMARY KEY | |
| [field from domain model] | [type] | [from validation rules] | |
| created_at | TIMESTAMP | NOT NULL | |
| updated_at | TIMESTAMP | NOT NULL | |
[| deleted_at | TIMESTAMP | NULLABLE | Soft delete |]
**Indexes:**
- `[field(s)]` — reason: [from Q4 query pattern]
**Domain model ref:** attributes match `docs/02_business/domain_model.md#[Entity]`
---
[Repeat per table]
## Relationships
| From | Type | To | Foreign key |
|------|------|----|-------------|
| [table_a] | has many | [table_b] | table_b.table_a_id |
## Validation Constraints (from business_rules.md)
| Table.Field | Constraint | Source rule |
|------------|-----------|-------------|
| [table.field] | CHECK (> 0) | [rule name] |
Write to docs/02_business/data_model.md. Create folder if missing.
npx claudepluginhub pirras-torres/pirras-marketplace --plugin pi-devFetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.