Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add closedloop-ai/claude-plugins --skill erd-diagramgit clone --depth 1 https://github.com/closedloop-ai/claude-pluginsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/closedloop-ai/claude-plugins/erd-diagram)<a href="https://agentmods.dev/skills/closedloop-ai/claude-plugins/erd-diagram"><img src="https://agentmods.dev/badge/skills/closedloop-ai/claude-plugins/erd-diagram/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/closedloop-ai/claude-plugins/erd-diagram"><img src="https://agentmods.dev/badge/skills/closedloop-ai/claude-plugins/erd-diagram.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00131 | $0.01854 |
| Opus 5.5 | $0.00052 | $0.00742 |
| Sonnet 5.5 | $0.00026 | $0.00371 |
| Haiku 4.5 | $0.00013 | $0.00185 |
Grade A, and why
erd-diagram scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ERD diagram
Builds a self-contained, offline HTML ERD from schema code, or updates one this skill made earlier.
Code only. Never connect to, query, or test against any database, local or remote, and never start one (no psql, no Docker Postgres). Every fact in the diagram comes from files in the repository.
Arguments: $ARGUMENTS
The tool is scripts/dist/erd.mjs in this skill's directory. It needs only Node 18 or later, with no install step; the layout engine (elkjs) is bundled into it. Run it as node <skill-dir>/scripts/dist/erd.mjs <command>, where <skill-dir> is the absolute path of the directory you read this SKILL.md from, not the repository you are diagramming.
1. Read the arguments
Split $ARGUMENTS into words.
canvas-sidebarorschema-exploreris the style.- Everything else, joined back with spaces, is the path of an existing diagram. Expand a leading
~.
Then choose the mode:
- Path given, file missing: stop. Tell the user the file does not exist and they may have mistyped the path, quoting the path you checked. Do nothing else: no new diagram, no guessing a nearby file.
- Path given, file exists: update mode (section 3).
- No path: new-diagram mode (section 2).
2. New diagram
- Style. If no style was passed, ask with
AskUserQuestion, one question, header "Style", options:canvas-sidebar: "Every table on one pannable, zoomable canvas, with a searchable table list grouped by domain on the left and a detail panel."schema-explorer: "Overview of domains, a focused table view (its references on the left, what references it on the right), and a pannable diagram per domain."
- Repo. Use the git root of the current directory. If the user named another repo, pass
--repo <dir>. - Source. Run
erd.mjs detect. It lists Prisma schemas, SQL dumps (structure.sql,schema.sql) and SQL migration folders, each with itsdatabase.- Only use sources whose
databaseispostgresorunknown; never one markedsqlite,mysqlor another engine. - Prefer a Prisma schema (it carries doc comments), then a SQL dump, then a migrations folder.
- One candidate: use it. Several of the same kind: ask the user which one with
AskUserQuestion. - None: the schema lives in ORM code (Rails
schema.rb, Django models, TypeORM or Sequelize entities, SQLAlchemy, Drizzle TypeScript without generated SQL, and so on). Read that code and write the model JSON yourself, in the shape described in the model format. Save it as~/.claude/erd-diagram/models/<repo-name>.json, check it witherd.mjs validate-model <file>, fix every problem it reports, and use--source json:<that path>. Name each model after its table; record a column's database name incolumnand doc comments indoc.
- Only use sources whose
- Domains. These group tables in the sidebar, and are the per-domain diagrams in schema-explorer.
- 20 tables or fewer: skip this step; the build uses one "All tables" group.
- Otherwise run
erd.mjs draft-domains --source <spec> --out <scratch>/domains.jsonanderd.mjs extract --source <spec> --out <scratch>/model.json. The draft is a clustering of the foreign-key graph and its names are placeholders. Read the table names, docs and relations inmodel.jsonand rewrite the draft into roughly 6 to 15 domains named for what they hold ("Billing", "Auth & sessions"), each table in exactly one domain, ids in lowercase-with-dashes. Hub tables that nearly everything references (the build reports them ashubs) go with the domain they belong to by meaning, usually accounts or organizations.
- Output path.
~/Desktop/<repo-name>-erd-<style>.htmlunless the user named one. If that file already exists, ask whether to update it or write a different name. Never pass--forcewithout the user saying to replace it. - Build.
erd.mjs build --style <style> --out <path> --source <spec> [--domains <file>] [--repo <dir>]. It refuses an existing--out(exit code 3), rejects a domain map that names unknown tables or lists a table twice, and puts any table the map leaves out under "Unsorted". - Verify.
node <skill-dir>/scripts/dist/verify.mjs <path>renders the file headlessly (no window). It checks for script errors, that every table renders, that each domain diagram draws, and that search lands on a column. It printsok; fix any failure before reporting. If it printsskipped(no puppeteer installed), say the render check was skipped. - Report. Give the file path, style, source and commit, and the counts of tables, relations and domains. List any
unsortedtables, and note that the diagram reflects the schema code at that commit, not any running database.
What ships with it
6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 67 lines · 131 tokens per session scan A 0dea38e0a716
erd-diagram is a skill published in the GitHub repository closedloop-ai/claude-plugins (123 stars, last pushed yesterday), licensed Apache-2.0. It adds 131 tokens to every session and 1,854 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-04.
erd-diagram compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| erd-diagramclosedloop-ai/claude-plugins | Skill | 123 | yesterday | Apache-2.0 | A | 131 | Claude Code |
| postgres-patternsaffaan-m/ECC | Skill | 298k | 4d ago | MIT | A | 45 | Claude Code, Kiro |
| postgresql-table-designwshobson/agents | Skill | 42k | yesterday | MIT | A | 37 | Claude Code |
| data-sql-optimizationvasilyu1983/AI-Agents-public | Skill | 101 | 21d ago | MIT | A | 41 | Claude Code, Codex |
| software-database-designvasilyu1983/AI-Agents-public | Skill | 101 | 21d ago | MIT | A | 43 | Claude Code, Codex |
| postgresql-expertpersonamanagmentlayer/pcl | Skill | 44 | 11d ago | Apache-2.0 | A | 56 | Claude Code |
| ai-vector-brainvasilyu1983/AI-Agents-public | Skill | 101 | 21d ago | MIT | A | 40 | Claude Code, Codex |