# DB

> Parse models, migrations, or schema and generate an ERD diagram + DB documentation Arguments: (no arguments — auto-detects models).

- Skill: `agents-store/db` (Agent Skill)
- Install (CLI): `npx get-skill add agents-store/db`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agents-store/db/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: agents-store (https://skillmd.com/u/agents-store)
- Updated: 2026-11-16
- Page: https://skillmd.com/skills/agents-store/db

---


# Database Schema ERD

Analyze the database schema and generate an Entity-Relationship Diagram + documentation.

## Instructions

1. Read the primary skill:
   - `${CLAUDE_PLUGIN_ROOT}/skills/codemap-diagram/SKILL.md` — ERD generation rules
2. Read ERD-specific guidance from `${CLAUDE_PLUGIN_ROOT}/skills/codemap-diagram/references/diagram-types.md`

3. Ensure output directories exist: `docs/codemap/diagrams/` — create if missing.

4. Launch the **diagrammer** agent with a prompt to:
   - Auto-detect the ORM (SQLAlchemy, Prisma, TypeORM, Django, raw SQL migrations)
   - Parse all model definitions — tables, columns, types, foreign keys, relationships
   - Review schema quality (missing indexes, naming inconsistencies, missing constraints)
   - Generate ERD as mxGraph XML → save to `docs/codemap/diagrams/erd.drawio` → call drawio-mcp
   - Generate `docs/codemap/DB.md` with table details, relationships, and quality notes
