원클릭으로
diagram-knowledge
Diagram knowledge base. Provides Mermaid syntax, C4 model, diagram types, and best practices for technical diagrams.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Diagram knowledge base. Provides Mermaid syntax, C4 model, diagram types, and best practices for technical diagrams.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Access Control knowledge base. Provides ACL, RBAC, ABAC, ReBAC models, multi-tenancy patterns, and PHP implementations (Symfony Voters, Laravel Gates) for security audits and generation.
API Design knowledge base. Provides REST constraints, Richardson Maturity Model, HTTP semantics, content negotiation, and GraphQL/gRPC comparison for API audits and generation.
Caching Strategies knowledge base. Provides caching patterns (Cache-Aside, Read-Through, Write-Through, Write-Behind), invalidation approaches, multi-level caching, and Redis data structures for caching audits and generation.
Analyzes PHP code for 12-Factor App compliance. Detects hardcoded configuration, file-based state, env-specific conditionals, non-streaming logs, and missing environment variable usage.
Analyzes PHP code for access control issues. Detects inline role checks, hardcoded permissions, mixed ACL/RBAC models, missing Voter/Policy pattern, and authorization logic in controllers.
Analyzes PHP code for database scaling issues. Detects single DB connection for all queries, missing read replica configuration, SELECT queries hitting master, and missing connection pooling.
| name | diagram-knowledge |
| description | Diagram knowledge base. Provides Mermaid syntax, C4 model, diagram types, and best practices for technical diagrams. |
Quick reference for technical diagrams, Mermaid syntax, and C4 model.
| Type | Use Case | When to Use |
|---|---|---|
| C4 Context | System boundaries | External actors, systems |
| C4 Container | Deployable units | Apps, databases, services |
| C4 Component | Internal structure | Classes, modules in container |
| Sequence | Interactions | Request flows, protocols |
| Class | Structure | Domain model, relationships |
| ER | Data | Database schema |
| Flowchart | Process | Algorithms, decisions |
| State | Lifecycle | Entity states, transitions |
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
Syntax:
flowchart TD|TB|BT|LR|RL
id[Rectangle]
id(Rounded)
id{Diamond}
id([Stadium])
id[[Subroutine]]
id[(Database)]
id((Circle))
sequenceDiagram
participant C as Client
participant A as API
participant D as Database
C->>A: POST /users
A->>D: INSERT user
D-->>A: user_id
A-->>C: 201 Created
Syntax:
->> Solid arrow (sync)
-->> Dashed arrow (async/response)
-) Open arrow
--) Dashed open arrow
Note right of A: Note text
loop Loop name
actions
end
alt Condition
actions
else Other
actions
end
classDiagram
class Order {
-OrderId id
-OrderStatus status
+confirm() void
+cancel() void
}
class OrderItem {
-ProductId productId
-int quantity
}
Order "1" *-- "*" OrderItem : contains
Relationships:
<|-- Inheritance
*-- Composition
o-- Aggregation
--> Association
-- Link
..> Dependency
..|> Implementation
stateDiagram-v2
[*] --> Pending
Pending --> Confirmed : confirm()
Pending --> Cancelled : cancel()
Confirmed --> Shipped : ship()
Confirmed --> Cancelled : cancel()
Shipped --> Delivered : deliver()
Delivered --> [*]
Cancelled --> [*]
erDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ ORDER_ITEM : contains
ORDER_ITEM }o--|| PRODUCT : references
USER {
uuid id PK
string email UK
string name
}
ORDER {
uuid id PK
uuid user_id FK
string status
}
Cardinality:
||--|{ One to many
}|--|{ Many to many
||--|| One to one
||--o{ One to zero-or-many
Shows system and external actors.
flowchart TB
subgraph boundary[System Boundary]
S[("🖥️ E-Commerce System")]
end
U[("👤 Customer")]
PS[("💳 Payment Service")]
ES[("📧 Email Service")]
U -->|"Browse, Order"| S
S -->|"Process payment"| PS
S -->|"Send notifications"| ES
Shows deployable units.
flowchart TB
subgraph boundary[E-Commerce System]
WA[("🌐 Web App\nReact")]
API[("⚙️ API\nPHP/Symfony")]
DB[("🗄️ Database\nPostgreSQL")]
CACHE[("💾 Cache\nRedis")]
MQ[("📬 Queue\nRabbitMQ")]
end
WA -->|"REST/JSON"| API
API -->|"SQL"| DB
API -->|"Cache"| CACHE
API -->|"Publish"| MQ
Shows internal structure.
flowchart TB
subgraph api[API Container]
direction TB
subgraph presentation[Presentation]
AC[Action]
RS[Responder]
end
subgraph application[Application]
UC[UseCase]
SV[Service]
end
subgraph domain[Domain]
EN[Entity]
VO[ValueObject]
RP[Repository Interface]
end
subgraph infra[Infrastructure]
RI[Repository Impl]
AD[Adapter]
end
end
AC --> UC
UC --> EN
UC --> RP
RI -.-> RP
| Principle | Description | Example |
|---|---|---|
| 7±2 Rule | Max 5-9 elements | Aggregate related items |
| Clear labels | Descriptive names | "User Service" not "S1" |
| Consistent style | Same shapes = same type | Rectangles for services |
| Flow direction | Top-down or left-right | Pick one per diagram |
| Context first | Start high-level | C4 Context → Container |
✅ Good:
- "Payment Service" (descriptive)
- "PostgreSQL Database" (specific)
- "POST /orders" (action-based)
❌ Bad:
- "Service A" (meaningless)
- "DB" (ambiguous)
- "Process" (vague)
# Top-down flow (recommended for hierarchies)
flowchart TD
# Left-right (recommended for timelines)
flowchart LR
# Subgraphs for grouping
subgraph name[Label]
content
end
# Styling
style id fill:#f9f,stroke:#333
classDef className fill:#f9f
class id1,id2 className
| Antipattern | Problem | Fix |
|---|---|---|
| Spaghetti | Too many crossing lines | Reorder, use subgraphs |
| Kitchen sink | Everything in one diagram | Split by level/aspect |
| Mystery meat | Cryptic labels | Use full names |
| Outdated | Doesn't match code | Automate from code |
| No legend | Unknown symbols | Add legend/key |
| Invisible boundaries | Unclear scope | Add subgraphs |
| Tool | Type | Best For | Pros | Cons |
|---|---|---|---|---|
| Mermaid | Text-based | Documentation-as-code | Git-friendly, embeds in MD, live preview | Limited styling, complex layouts hard |
| PlantUML | Text-based | UML diagrams | Full UML support, more diagram types | Requires Java, slower rendering |
| Draw.io | GUI | Quick prototypes, business diagrams | Free, intuitive, many templates | Binary files, merge conflicts |
| Excalidraw | GUI | Sketches, whiteboarding | Hand-drawn style, collaborative | Less precise, limited exports |
| Lucidchart | GUI | Enterprise, presentations | Professional output, integrations | Paid, not text-based |
| Scenario | Recommended Tool |
|---|---|
| Code documentation (README, docs/) | Mermaid |
| Strict UML compliance required | PlantUML |
| Quick whiteboard session | Excalidraw |
| Stakeholder presentations | Draw.io or Lucidchart |
| CI/CD pipeline diagrams | Mermaid (auto-generate) |
| Living documentation (auto-update) | Mermaid + code generation |
| Feature | Mermaid | PlantUML | Draw.io | Excalidraw |
|---|---|---|---|---|
| Version control friendly | ✅ | ✅ | ❌ | ⚠️ JSON |
| GitHub/GitLab rendering | ✅ | ❌ | ❌ | ❌ |
| No install required | ✅ | ❌ | ✅ | ✅ |
| Offline support | ⚠️ | ✅ | ✅ | ✅ |
| C4 model support | ✅ | ✅ | Manual | Manual |
| Export to PNG/SVG | ✅ | ✅ | ✅ | ✅ |
| Real-time collaboration | ❌ | ❌ | ✅ | ✅ |
What are you documenting?
│
├─ System overview → C4 Context
│
├─ Deployment units → C4 Container
│
├─ Internal structure → C4 Component / Class
│
├─ Data flow
│ ├─ Request/Response → Sequence
│ └─ Data processing → Flowchart
│
├─ Data structure
│ ├─ Domain model → Class
│ └─ Database → ER
│
└─ Behavior
├─ State machine → State
└─ Algorithm → Flowchart
flowchart TB
subgraph presentation[Presentation Layer]
direction LR
A[Action]
R[Responder]
end
subgraph application[Application Layer]
direction LR
UC[UseCase]
DTO[DTO]
end
subgraph domain[Domain Layer]
direction LR
E[Entity]
VO[Value Object]
DS[Domain Service]
RI[Repository Interface]
end
subgraph infrastructure[Infrastructure Layer]
direction LR
RImpl[Repository]
Adapter[Adapter]
end
presentation --> application
application --> domain
infrastructure -.-> domain
flowchart LR
subgraph commands[Write Side]
CMD[Command] --> CH[CommandHandler]
CH --> AR[Aggregate]
AR --> EV[Event]
end
subgraph queries[Read Side]
Q[Query] --> QH[QueryHandler]
QH --> RM[ReadModel]
end
EV -.-> RM
For detailed information, load these reference files:
references/mermaid-syntax.md — Complete Mermaid syntax referencereferences/c4-model.md — C4 model detailed guidereferences/sequence-patterns.md — Common sequence diagram patternsreferences/diagram-tools.md — Tools and automation