schema-diagram
БесплатноБез исполняемых скриптовНе проверенGenerates a self-contained interactive ERD document from a Laravel project's live database — a single standalone HTML file with domain-coloured table cards…
от nasrulhazim★ 26 звёзд на GitHubОб этом скилле
Schema diagram
Produces one file: docs/03-architecture/03-database-erd.html. It opens off a filesystem, on
a plane, with no network and no toolchain — and it draws every table, column, index and
foreign key in the database.
The shape of it
| Piece | Lives in | Needs | Committed |
|---|---|---|---|
| Schema extractor | app/Support/Erd/ErdSchema.php + app/Console/Commands/GenerateErdCommand.php |
A migrated database | — |
| Domain map | app/Support/Erd/ErdDomains.php |
A human | — |
| Payload | docs/03-architecture/erd-schema.json |
— | Yes |
| Diagram app | resources/js/erd/ (React Flow island) |
— | — |
| Coverage tests | tests/Feature/Docs/ErdDomainCoverageTest.php |
— | — |
| Document | docs/03-architecture/03-database-erd.html |
Node | Yes |
| Companion page | docs/03-architecture/03-database-erd.md |
— | Yes |
php artisan docs:erd # database -> JSON (needs a DB, no Node)
npm run build:erd # JSON -> HTML (needs Node, no DB)
The split is the design. Either half runs alone, and the committed JSON means the document rebuilds on a machine that has never seen the database.
The three rules
1. Read the database, never the migrations. Migrations are the instructions; only the database is the result. A mature project's migration folder is full of column changes, index swaps, renames and drops whose net effect is exactly what a parser gets wrong — silently.
2. Every table gets a domain, assigned by a person. A prefix heuristic mis-files tables and
gives no sign that it did. The generator refuses to write when the map has a gap in either
direction. That friction is the feature; do not add a default => arm to make it pass.
3. Commit both outputs. The JSON so schema drift shows up in a pull request diff. The HTML so a reader needs nothing but a browser.
Workflow
1. Confirm the ground
php artisan migrate:status | tail -5 # is the schema at head?
A diagram of a half-migrated schema is worse than none. But do not migrate someone's dev database to build a document — that is a side effect they did not ask for, and it can be destructive. Build in a throwaway instead, and drop it:
mysql -e "CREATE DATABASE erd_tmp"
DB_DATABASE=erd_tmp php artisan migrate --force
DB_DATABASE=erd_tmp php artisan docs:erd
mysql -e "DROP DATABASE erd_tmp"
Say plainly in the summary that you did this and that their database is untouched. The About panel records the migration head it was read at, so the document proves its own provenance.
2. Build the domain map first
This is the only part that takes judgement, and everything else is mechanical once it exists.
Read references/domain-map.md. Draft it from the code, then correct it by hand:
ls database/migrations | sed 's/^[0-9_]*//;s/\.php$//' | sort
ls app/Models
Aim for 8–14 domains named after the product's own nouns — never layers. Framework and
package tables (cache, jobs, sessions, media, telescope_*) all go in one system
domain that starts switched off.
Show the user the proposed map before writing it. Getting deployment_mail_sandboxes filed
under Data Services rather than Deployment is a decision they own.
3. Scaffold the extractor
references/schema-extractor.md has both PHP files verbatim. Copy them, then run:
php artisan docs:erd
It will fail listing unmapped tables. That is the gate working — fill them in and re-run.
4. Scaffold the diagram app
references/diagram-app.md (seven modules) and references/diagram-styles.md (the
stylesheet). Copy verbatim, then change exactly two things: PRODUCT in ErdBoard.jsx and
About.jsx, and the brand faces at the top of erd.css.
Rewrite the prose in About.jsx for the product. It is the only writing in the document
and the first thing anyone reads.
5. Build and check
npm i @xyflow/react @dagrejs/dagre react react-dom
npm i -D @vitejs/plugin-react vite
npm run build:erd
open docs/03-architecture/03-database-erd.html
Verify before calling it done — see the checklist below.
6. Write the companion page
A 1 MB generated HTML file is not readable in a pull request, does not appear in a grep, and
does not render on GitHub. Write docs/03-architecture/03-database-erd.md beside it: a link,
the four figures, the domain table with per-domain counts, what it does not draw, the two
regeneration commands, and a source-file table. That page is what the docs tree indexes and
what a reviewer actually reads.
7. Pin it with tests
references/coverage-tests.md. docs:erd --check protects the document; the suite protects
the repository — it fails on the pull request that adds the table, not six weeks later.
- run: php artisan docs:erd --check
Refreshing an existing diagram
php artisan migrate
php artisan docs:erd # fails if a new table has no domain — add it
npm run build:erd
php artis
Установить schema-diagram в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл schema-diagram?
Generates a self-contained interactive ERD document from a Laravel project's live database — a single standalone HTML file with domain-coloured table cards, foreign-key edges anchored to the actual columns, search across tables and columns, a per-table inspector showing both directions of every relation, and a committed JSON schema payload that makes schema drift reviewable in a diff. Use this skill whenever the user asks to draw, generate, refresh or document a database schema — "generate an ERD", "buat ERD", "draw the database diagram", "visualise my schema", "document the database", "lukis rajah pangkalan data", "update the ERD", "refresh the schema diagram", "erd dah lapuk", "diagram untuk database", "show table relationships", "map my tables to domains", or "what references this table". Reads the live schema by introspection, never by parsing migrations. Does NOT cover designing or writing migrations (`project-laravel`), domain boundary discovery (`project-ddd`), or the wider docs tree (`project-docs`).
Как установить скилл schema-diagram?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл schema-diagram запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic