acc-diagram-knowledge

Diagram knowledge base. Provides Mermaid syntax, C4 model, diagram types, and best practices for technical diagrams.

16 stars

Best use case

acc-diagram-knowledge is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Diagram knowledge base. Provides Mermaid syntax, C4 model, diagram types, and best practices for technical diagrams.

Teams using acc-diagram-knowledge should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/acc-diagram-knowledge/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/data-ai/acc-diagram-knowledge/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/acc-diagram-knowledge/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How acc-diagram-knowledge Compares

Feature / Agentacc-diagram-knowledgeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Diagram knowledge base. Provides Mermaid syntax, C4 model, diagram types, and best practices for technical diagrams.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Diagram Knowledge Base

Quick reference for technical diagrams, Mermaid syntax, and C4 model.

## Diagram Types Overview

| 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 |

## Mermaid Basics

### Flowchart

```mermaid
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))
```

### Sequence Diagram

```mermaid
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
```

### Class Diagram

```mermaid
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
```

### State Diagram

```mermaid
stateDiagram-v2
    [*] --> Pending
    Pending --> Confirmed : confirm()
    Pending --> Cancelled : cancel()
    Confirmed --> Shipped : ship()
    Confirmed --> Cancelled : cancel()
    Shipped --> Delivered : deliver()
    Delivered --> [*]
    Cancelled --> [*]
```

### ER Diagram

```mermaid
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
```

## C4 Model

### Level 1: Context Diagram

Shows system and external actors.

```mermaid
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
```

### Level 2: Container Diagram

Shows deployable units.

```mermaid
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
```

### Level 3: Component Diagram

Shows internal structure.

```mermaid
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
```

## Best Practices

### Diagram Guidelines

| 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 |

### Naming Conventions

```markdown
✅ Good:
- "Payment Service" (descriptive)
- "PostgreSQL Database" (specific)
- "POST /orders" (action-based)

❌ Bad:
- "Service A" (meaningless)
- "DB" (ambiguous)
- "Process" (vague)
```

### Layout Tips

```markdown
# 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
```

## Common Antipatterns

| 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 Comparison

| 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 |

### Tool Selection Guide

| 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 |

### Tool Features Matrix

| 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 | ❌ | ❌ | ✅ | ✅ |

## Diagram Selection Guide

```
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
```

## PHP-Specific Diagrams

### DDD Layers

```mermaid
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
```

### CQRS Pattern

```mermaid
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
```

## References

For detailed information, load these reference files:

- `references/mermaid-syntax.md` — Complete Mermaid syntax reference
- `references/c4-model.md` — C4 model detailed guide
- `references/sequence-patterns.md` — Common sequence diagram patterns
- `references/diagram-tools.md` — Tools and automation

Related Skills

beautiful-mermaid-diagrams

16
from diegosouzapw/awesome-omni-skill

Create beautiful diagrams using Mermaid syntax including flowcharts, sequence diagrams, class diagrams, ER diagrams, and state diagrams. Use when users ask to diagram, visualize, model, map out, or show the flow of systems, processes, architectures, or interactions.

ac-knowledge-graph

16
from diegosouzapw/awesome-omni-skill

Manage knowledge graph for autonomous coding. Use when storing relationships, querying connected knowledge, building project understanding, or maintaining semantic memory.

adr-knowledge-base

16
from diegosouzapw/awesome-omni-skill

ADR知見の体系的参照・適用。主要ADR抜粋(ADR_010, 013, 016, 019, 020, 021)・ADR検索・参照方法・技術決定パターン集・ADR作成判断基準。Phase C以降の技術決定時に使用。

mermaid-diagrams

16
from diegosouzapw/awesome-omni-skill

Mermaid diagram creation for flowcharts, sequences, ERDs, and more. Generate diagrams from text in markdown files. Use for documentation, architecture diagrams, and visual representations. Triggers on mermaid, flowchart, sequence diagram, ERD, entity relationship, gantt chart, pie chart, class diagram, state diagram, journey map.

mermaid-diagram-generator

16
from diegosouzapw/awesome-omni-skill

Creates Mermaid diagrams for flowcharts, sequence diagrams, ERDs, and architecture visualizations in markdown. Use when users request "Mermaid diagram", "flowchart", "sequence diagram", "ERD diagram", or "architecture diagram".

Knowledge

16
from diegosouzapw/awesome-omni-skill

Personal knowledge management using Graphiti knowledge graph with Neo4j/FalkorDB, supporting remote MCP access with connection profiles and TLS, OSINT/CTI ontology, and investigative search. USE WHEN 'store this', 'remember this', 'add to knowledge', 'search my knowledge', 'what do I know about', 'find in knowledge base', 'save to memory', 'graphiti', 'knowledge graph', 'entity extraction', 'relationship mapping', 'semantic search', 'episode', 'install knowledge', 'setup knowledge system', 'configure knowledge graph', 'remote knowledge server', 'connect to knowledge', 'knowledge profile', knowledge capture, retrieval, synthesis, memory decay, decay scoring, lifecycle state, importance classification, stability classification, health metrics, run maintenance, permanent memory, soft-delete, 'investigate entity', 'find connections', 'graph traversal', 'threat hunting', 'list ontology', 'custom entity types', 'CTI entities', 'OSINT entities', 'import STIX', 'STIX bundle', 'threat intel import'.

django-6-knowledge

16
from diegosouzapw/awesome-omni-skill

Provides knowledge about Django 6.0 features and implementation patterns. Use when working with Django projects, when the user mentions Django features, or when implementing Django functionality that may have changed in version 6.0.

agent-knowledge-synthesizer

16
from diegosouzapw/awesome-omni-skill

Expert knowledge synthesizer specializing in extracting insights from multi-agent interactions, identifying patterns, and building collective intelligence. Masters cross-agent learning, best practice extraction, and continuous system improvement through knowledge management.

agent-hierarchy-diagram

16
from diegosouzapw/awesome-omni-skill

Generate visual hierarchy diagrams of agent system showing levels and delegation. Use for documentation or onboarding.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

moai-lang-r

16
from diegosouzapw/awesome-omni-skill

R 4.4+ best practices with testthat 3.2, lintr 3.2, and data analysis patterns.

moai-lang-python

16
from diegosouzapw/awesome-omni-skill

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.