/laraclaude:lc:model-diagram [all | ModelName]from laraclaude
Generates Entity-Relationship diagrams from Laravel Eloquent models in Mermaid syntax for visualizing database schema and relationships in documentation or during development.
Ships in laraclaude. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub edulazaro/laraclaude --plugin laraclaude32 skills in this plugin
/lc:analyze-errorPaste a Laravel stacktrace and get root cause analysis with suggested fix./lc:analyze-modelDeep analysis of a Laravel Eloquent model - relationships, scopes, casts, fillable, observers, keepers, actions./lc:api-docsGenerate API documentation from routes, controllers, and form requests./lc:blade-auditDetect hardcoded text without @text(), duplicate CSS classes, unused Blade components, and accessibility issues./lc:boost-inspectRuntime-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./lc:cache-opportunitiesDetect repeated queries and computations that should be cached.Other plugins' skills for the same job