From er-bundle
Use this skill when the user wants to turn SQL DDL or design Markdown into a long-lived ER design bundle (.erd.json) that drives an interactive web page — not a one-shot Mermaid snippet. Trigger when the request mentions an ER / entity-relationship diagram together with color-coded layers / sub-domains, multiple diagram views of the same schema, a write-flow / data-flow narrative, or an old-vs-new design decision log. Also trigger when the user asks to update an existing .erd.json, to render / preview / view an existing bundle as HTML, or anything matching erd-bundle.schema.json. Do NOT trigger for pure 'draw a quick ER diagram' requests — Mermaid erDiagram is faster for that.
How this skill is triggered — by the user, by Claude, or both
Slash command
/er-bundle:er-bundleThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Primary output**: a JSON file conforming to `references/schema.json` (conventional extension `.erd.json`).
Primary output: a JSON file conforming to references/schema.json (conventional extension .erd.json).
Secondary output (produce by default unless the user explicitly only wants the JSON): inject the bundle into the bundled examples/demo.html template to produce a standalone interactive HTML viewer. Run scripts/render_html.py and open the result — the user should not have to drop to a terminal for this step.
| Need | bundle | Mermaid erDiagram |
|---|---|---|
| Color-coded layers | ✅ | ❌ |
| Multiple views of the same schema | ✅ diagrams[] | Manual: split into multiple code blocks |
| Flow cards / write paths | ✅ dataFlows | ❌ |
| Old-vs-new design decision logs | ✅ designDecisions | ❌ |
| Custom coordinates + localStorage drag memory | ✅ positions | ❌ |
| Renders natively on GitHub | ❌ needs a host page | ✅ |
Rule of thumb: static diagram in a README → Mermaid. Product design doc, evolves over time, multiple audiences → this skill.
references/schema.json lists required and optional fields. Read it once before starting — recent additions (tableConstraints / onDelete / cardinality / enumValues) are easy to miss.cols[*].tagtableConstraintsNOT NULL → nullable: false; DEFAULT → default (preserve SQL literal verbatim, including quotes or function names)ON DELETE / ON UPDATE → matching column fieldsenumValueslayers with colors; for each table set layer / status (existing / new / future) / comment.diagrams[] should have at least one "full view"; add sub-domain diagrams when there are many tables. connections.label is usually the FK column name. Set cardinality:
"1:N" (or "1:1" if the column is also UNIQUE)"0:N" (or "0:1") — represents an optional upstream"1:N" from the junction to each side0:1 and 0:N naturallydashed: true is only for "logical relations, not physical FKs" (e.g., reverse self-references, cross-service logical refs, semantically-present-but-not-yet-implemented relations). For a regular FK, do not set dashed; the rendering default is solid.isNew: true is only for "diff views" (this bundle vs. a previous version, highlighting newly added relations). On a first-time bundle, do not mark every connection with isNew — that erases the highlight.references/layout-heuristics.md.dataFlows (write paths, actor → action) and designDecisions (old vs. v3). Reference: examples/ecommerce.erd.json.python3 scripts/validate.py <your-bundle>.json. Mandatory — do not deliver if it fails.python3 <skill-path>/scripts/render_html.py <bundle.json> -o /tmp/<bundle-stem>.html && open /tmp/<bundle-stem>.html
If the user later says they want to re-render (e.g. after editing the JSON manually), do the same — they should never need to drop to a terminal for this.connections from / to references a table not in tables → schema doesn't catch it, but the host page breaks. Cross-check yourself.positions → that table won't appear on the diagram. Each diagram's positions keys must cover every table to be shown.tables[*].layer points at a non-existent layer key → schema doesn't catch it, but the host page can't find a color and crashes.tag: "PK" → semantically wrong. Composite keys go in tableConstraints only.default: active when you meant default: 'active' → invalid JSON or wrong semantics. default is a string holding the SQL literal verbatim (including quotes or function names).dashed: true or isNew: true on every connection → drains the meaning. dashed = logical relation; isNew = diff view only. Regular FKs need neither.references/schema.json — authoritative JSON Schemareferences/layout-heuristics.md — coordinate rulesexamples/minimal.erd.json — smallest example (two tables, one edge)examples/ecommerce.erd.json — full example (7 tables, 2 views, dataFlows + designDecisions)examples/ecommerce.sql — the DDL that derives itexamples/team.erd.json — 0:1 / 0:N example (optional relations)examples/team.sql — the DDL that derives itscripts/validate.py — schema + cross-check validatorProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
npx claudepluginhub loshinyen/agent_er_spec --plugin er-bundle