database-erd

Generates Mermaid erDiagram schema documentation from migration files and ORM models.

Updated May 21, 2026
One-click install
npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill database-erd-cagesthrottleus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-erd
Source: https://github.com/CagesThrottleUs/private-ai-harness/tree/main/skills/database-erd
Command: npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill database-erd-cagesthrottleus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Schema design decisions often go undocumented until implementation, leaving migrations without a traceable low-level design artifact. This Skill reads migration files, ORM models, or schema definitions and produces a Mermaid entity-relationship diagram with attributes, relationships, and index strategy before any code is written. ## Core Features & Use Cases - ERD Generation: Reads schema sources and produces a Mermaid erDiagram with crow's foot notation, PK/FK/UK annotations, and field constraints. - Index Strategy Documentation: Derives a table of required indexes from the query patterns in the spec and HLD, including composite indexes and drop conditions. - Design Decision Records: Captures non-obvious schema choices (e.g., integer cents vs. float, soft-delete patterns, ON DELETE behavior) as ADR-level rationale embedded in the LLD. - Reviewer Gate: Dispatches a database-erd-reviewer agent and iterates on Critical and Important findings before committing. - Use Case: When a feature adds a payments table with a foreign key from orders, run this Skill to produce .ai/YYYY-MM-DD-<feature-slug>/lld/lld-<feature-slug>-schema.md containing the full ERD, index plan, and design rationale linked back to the spec. ## Quick Start Ask the AI to generate a database ERD for the new feature by reading the migration files and saving the Mermaid diagram with index strategy to the LLD directory.

Frequently Asked Questions about database-erd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an ER diagram from migration files?

Point the Skill at your migration files, ORM models, or existing schema definitions. It identifies one entity per table, annotates fields with type and PK/FK/UK constraints, and outputs a Mermaid erDiagram with crow's foot relationship notation.

How to document database schema design decisions?

Record non-obvious choices in a design decisions table alongside the ERD, such as storing amounts as integer cents, using string enums, or choosing ON DELETE RESTRICT. Each decision gets a rationale so implementation traces back to the LLD.

Does Mermaid erDiagram render on GitHub?

Yes, Mermaid erDiagram syntax renders natively in GitHub Markdown files. It supports crow's foot cardinality notation and PK, FK, and UK field annotations, so the saved schema document displays without external tooling.

When should I skip creating an ERD for a feature?

Skip the ERD for config changes, documentation-only work, features with no database interaction, and tasks that only add endpoints to an existing schema with no structural changes. Any new table, column change, or relationship change requires one.

Why store monetary amounts as integer cents in a schema?

Floating-point arithmetic on decimal values introduces rounding errors in financial totals. Storing amounts as integer cents eliminates precision loss, and snapshotting unit prices on order items prevents retroactive changes to historical orders.