lc-model-diagram
Generate an ER diagram of Eloquent models in Mermaid format.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate an ER diagram of Eloquent models in Mermaid format.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create a Larascraper scraper (v2 or v3) for a target website, chaining browser actions (click, type, wait, scroll), conditional flow (when/repeatUntil), captcha solving, and file/PDF downloads. Detects the installed major and generates the matching style.
Add or edit a Laracrate file collection in config/laracrate.php with the correct anatomy (disk, access, types, variants, previews, extract/embed, flags, per-model scoping).
Runtime-verified Laravel inspection using the Laravel Boost MCP server (Tinker, Database Query/Schema, Last Error) instead of static grep. Falls back to Docker/Tinker if Boost is not installed.
Scaffold spatie/laravel-permission setup - add the HasRoles trait to a model and generate a roles & permissions seeder.
Audit spatie/laravel-permission usage - permissions used in code but undefined, defined but unused, unprotected routes, guard mismatches, and cache pitfalls.
Extract business logic from a controller or Livewire component method into a Laractions Action class.
| name | lc:model-diagram |
| description | Generate an ER diagram of Eloquent models in Mermaid format. |
| argument-hint | [all | ModelName] |
| user-invocable | true |
| allowed-tools | Read Grep Bash Edit Write Glob |
Generate an Entity-Relationship diagram of Eloquent models in Mermaid syntax. The output can be pasted into GitHub markdown, Notion, Mermaid Live Editor, or any tool that supports Mermaid diagrams.
| Subcommand | Description |
|---|---|
| (no argument) | Generate an ER diagram of all models and their relationships. |
all | Same as no argument -- diagram all models. |
[ModelName] | Generate a focused diagram showing one model and its direct relationships (1 level deep). |
This is a generator skill -- it produces diagram output.
Glob to find all app/Models/*.php files.[ModelName] argument is provided, start with that model and include only directly related models.For each model, use Read to extract:
$table property or derive from class name (Laravel convention: Property -> properties)Parse the corresponding migration to extract important columns:
Limit to the most important 8-12 columns per model to keep the diagram readable. Always include:
Extract from model methods:
belongsTo -> Many-to-one (FK on this model)hasMany -> One-to-many (FK on related model)hasOne -> One-to-one (FK on related model)belongsToMany -> Many-to-many (pivot table)morphTo, morphMany, morphOne -> PolymorphichasManyThrough, hasOneThrough -> Through relationshipsBuild the Mermaid erDiagram syntax:
erDiagram
ORGANIZATIONS {
bigint id PK
string name
string code
string color_scheme
timestamp created_at
}
USERS {
bigint id PK
bigint organization_id FK
bigint office_id FK
string name
string email
boolean active
}
PROPERTIES {
bigint id PK
bigint organization_id FK
bigint office_id FK
bigint user_id FK
string name
string reference
string status
decimal price
}
CLIENTS {
bigint id PK
bigint organization_id FK
bigint office_id FK
string name
string email
string phone
}
OPERATIONS {
bigint id PK
bigint property_id FK
bigint client_seller_id FK
string type
string status
decimal price
}
ORGANIZATIONS ||--o{ USERS : "has many"
ORGANIZATIONS ||--o{ PROPERTIES : "has many"
ORGANIZATIONS ||--o{ CLIENTS : "has many"
USERS ||--o{ PROPERTIES : "manages"
PROPERTIES ||--o{ OPERATIONS : "has many"
CLIENTS ||--o{ OPERATIONS : "sells"
Use Mermaid ER diagram relationship types:
| Eloquent | Mermaid | Symbol | Meaning |
|---|---|---|---|
belongsTo / hasOne | one-to-one | ||--|| | Exactly one to exactly one |
hasMany | one-to-many | ||--o{ | One to zero or more |
belongsToMany | many-to-many | }o--o{ | Zero or more to zero or more |
morphMany | polymorphic | ||--o{ | One to zero or more (labeled as polymorphic) |
For projects with many models (20+):
[ModelName] is provided, show:
Polymorphic relationships cannot be represented as standard ER relationships. Add notes:
erDiagram
ACTIVITIES {
bigint id PK
string activitable_type
bigint activitable_id
string field
string old_value
string new_value
}
PROPERTIES ||--o{ ACTIVITIES : "morphMany"
CLIENTS ||--o{ ACTIVITIES : "morphMany"
Include a text note below the diagram:
Note: ACTIVITIES uses polymorphic relationships via activitable_type/activitable_id.
Types: property, client (see morph map in AppServiceProvider)
Present the Mermaid diagram in a fenced code block:
```mermaid
erDiagram
...
```
Also provide:
If the diagram is very large, suggest splitting by domain area (e.g., Property domain, Client domain, Calendar domain).
belongsToMany are typically not shown as separate entities unless they have additional columns beyond the two FK columns.