agentleFS
Microsoft AzureKnown publisherAzure/documentdb-agent-kit/skills/data-modeling/SKILL.md

documentdb-data-modeling

Skill7 starsChanged 4 months agoMITView on GitHub

Data modeling patterns for Azure DocumentDB — embed vs reference, 16 MB document limit, denormalization for read-heavy workloads, schema versioning. Use when designing new schemas, reviewing existing data models, migrating from SQL, deciding between embedding and referencing, modeling one-to-one / one-to-many / many-to-many relationships, or troubleshooting document-size and query-performance problems that stem from the data model.

The file

Files
SKILL.md

Data Modeling — Azure DocumentDB

Guiding principle: "Data that is accessed together should be stored together."

Each rule follows the same shape — why it matters → incorrect example → correct example → references.

Rules

  • model-embed-vs-reference — Embed data accessed together; reference unbounded N-sides.
  • model-16mb-limit — Stay well under the 16 MB BSON document limit; plan for steady-state growth.
  • model-denormalize-reads — Denormalize for read-heavy workloads; pre-compute aggregates to avoid $lookup.
  • model-schema-versioning — Add a schemaVersion field and migrate documents lazily.
  • model-large-field-split — Split a large, low-compressibility field into a side collection keyed by _id to avoid the PostgreSQL TOAST detoast tax on scans. Companion tool: scripts/toast-split-advisor.sh.

Companion tool (analysis only)

scripts/toast-split-advisor.sh measures heap vs TOAST bytes on a live local container and reports where a large field should be split out — it never moves data:

bash scripts/toast-split-advisor.sh --db <name> [--json]

Decision framework

RelationshipCardinalityAccess patternRecommendation
One-to-One1:1Always togetherEmbed
One-to-Few1:N (N < ~100)Usually togetherEmbed array
One-to-Many1:N (N > ~100)Often separateReference
Many-to-ManyM:NVariesTwo-way reference or junction collection

See each rule file for the full reasoning and code examples.

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.