diagram
Create effective D2/Mermaid diagrams optimized for terminal display
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Create effective D2/Mermaid diagrams optimized for terminal display
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Create architecture decision records using MADR 4.0 format
Add an image to a decision document — rename, move to docs/assets/, insert reference
Create blameless incident reports and post-mortems
Complete Mermaid flowchart reference — shapes, edges, subgraphs, styling
Complete Mermaid sequence diagram reference — participants, arrows, activations, control flow
Create business opportunity documents with thorough questioning
| name | diagram |
| description | Create effective D2/Mermaid diagrams optimized for terminal display |
Create effective D2 or Mermaid diagrams optimized for terminal display.
Diagrams render as ASCII art in the terminal. Follow these rules for clean output.
Aim for 5-7 nodes max. Terminals are typically 80-120 columns wide. More nodes = unreadable overlaps.
If you need more, use containers to group related nodes:
vpc: VPC {
api: API
db: Database {shape: cylinder}
api -> db
}
client: Client
client -> vpc.api
Edge labels over ~15 characters get moved to a legend at the bottom, disconnecting them from context.
api -> db: "sends authenticated read requests for user data"api -> db: readsNode labels should also be concise. Use the key as short ID and label for display:
pg: PostgreSQL {shape: cylinder}
Default is top-to-bottom. For terminal, direction: right often works better as it uses horizontal space:
direction: right
a: Service A
b: Service B
a -> b: calls
Supported shapes that render distinctly:
shape: cylinder — databases, connection pools, queuesshape: diamond — decision pointsshape: hexagon — APIs or key servicesshape: circle — users, external actorsA cycle like A -> B -> C -> A triggers a D002 warning. This is informational — cycles in incident/failure diagrams are often intentional. To avoid warnings on return paths, restructure as:
# Instead of A -> B and B -> A, use:
a <-> b: request/response
Both work. D2 is simpler for architecture diagrams. Mermaid is better for state machines and sequence diagrams.
stateDiagram-v2
proposed --> accepted
proposed --> rejected
accepted --> deprecated
accepted --> superseded
users: Users {shape: circle}
api: API
db: Database {shape: cylinder}
users -> api: requests
api -> db: queries
api -> users: 503 errors
direction: right
client: Browser
api: API {shape: hexagon}
db: PostgreSQL {shape: cylinder}
cache: Redis {shape: cylinder}
client -> api: HTTPS
api -> db: reads/writes
api -> cache: cached reads
direction: right
start: Request
auth: Authenticated? {shape: diamond}
allow: Allow
deny: Deny
start -> auth
auth -> allow: yes
auth -> deny: no
dg show DOC-ID shows actual terminal output# ... in D2) to document intent without affecting renderingstateDiagram-v2 for lifecycles