agentleFS
chatquillchatquill/claude-code-websites/.claude/skills/data-model/SKILL.md

data-model

Skill1 starsChanged 23 days agoMITView on GitHub

Designs or updates the data model: entities, fields, relations, constraints, indexes, tenancy, retention and migration plan, with a mermaid ER diagram, for the configured database (Postgres via Prisma/Drizzle, MongoDB, Supabase, Firebase). Use when a feature adds or changes stored data.

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use code-review.

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.
  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 0

    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
  1. Very specific:

    If personal or sensitive data is added and privacy.regions is set, ask privacy-compliance-specialist to review retention and lawful basis.

    line 61
  2. Very specific:

    Ask "May I write this to docs/architecture/data-model.md?" Show only changed entities on updates.

    line 67

“Common” is measured: kept by at least 6 in 10 of the 6 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Data Model

Produces or updates docs/architecture/data-model.md. It designs the schema on paper first; migrations are written later by /db-migration. It never touches a database.

Inputs

  • Argument: a feature slug or all
  • docs/specs/features/*.md (data needs, permissions, edge cases)
  • docs/architecture/api/openapi.yaml / contract sections
  • Existing docs/architecture/data-model.md; for brownfield projects the real schema (prisma/schema.prisma, drizzle/**, db/schema.rb, migrations/**, Django models.py, supabase/migrations/**)
  • project.yaml: stack.database, stack.orm, privacy.regions

Phases

Phase 1: Gather needs

List the nouns the spec stores, the queries the UX and contract imply (filters, sorts, lookups by), expected volumes and growth, and the tenancy model (single user, organisation/workspace, marketplace). Ask about anything unstated that changes the design (e.g. "can a user belong to several workspaces?").

Phase 2: Design

Spawn data-engineer together with the configured data specialist (postgres-specialist, mongodb-specialist or baas-specialist, from stack.database). For each entity:

  • Fields with types, nullability, defaults; money as integer minor units + currency; timestamps timestamptz (UTC); IDs (UUIDv7, cuid2 or bigint, per ADR)
  • Relations and cardinality; on-delete behaviour
  • Constraints: unique, check, foreign keys; invariants enforced in the database
  • Indexes derived from Phase 1 queries (composite order explained)
  • Tenancy: tenant column on every tenant-owned row + RLS policy or scoped repository
  • Personal data classification (none / personal / sensitive) and retention rule
  • Soft delete or hard delete + audit, with the reason

For MongoDB: embed vs reference per relation with the access pattern; for Firebase/Supabase: the security rules / RLS policies required.

Phase 3: Diagram and plan

  • Mermaid erDiagram of the affected entities.
  • Migration plan for changes to existing tables: expand → backfill → contract steps, locking risks on large tables, and backward compatibility with the currently deployed code.

Phase 4: Review

If personal or sensitive data is added and privacy.regions is set, ask privacy-compliance-specialist to review retention and lawful basis. Show the model, diagram and plan.

Phase 5: Approve and write

Ask "May I write this to docs/architecture/data-model.md?" Show only changed entities on updates.

Output

docs/architecture/data-model.md from .claude/docs/templates/data-model.md.

Next step

/db-migration when the story that needs it is in progress, or /create-stories.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.