agentleFS
patonkikhpatonkikh/APES/skills/architecture/component-diagram-builder/skill.md

component-diagram-builder

Skill3 starsChanged 4 months agoMITView on GitHub

Produce a C4 Level 3 (Component) diagram for a selected container, showing internal components, responsibilities, and dependencies. Use when working on solution architecture, C4 diagrams, APIs, ADRs, or system design.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Must exist in container diagram

    line 29
  2. Distinctive:

    Keep inside one container boundary.

    line 63
  3. Distinctive:

    Follow C4 Level 3 scope strictly.

    line 114

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

Component Diagram Builder

Purpose

Produce a C4 Level 3 (Component) diagram for a selected container, showing internal components, responsibilities, and dependencies.

Input: Container diagram, target container name, component responsibilities (optional)
Output: Component diagram document with Mermaid diagram and component inventory Examples: See examples.md for worked input/output.


Workflow

Step 1: Select target container

Confirm which container to decompose:

  • One container per Skill execution
  • Must exist in container diagram
  • Identify primary technology/framework

Step 2: Identify components

Decompose container into logical components:

ComponentTypeResponsibility

Types: controller, service, repository, adapter, domain module, UI module.

Components are code-level groupings, not individual classes.

Step 3: Map component interactions

FromToInterfacePurpose

Show dependency direction. Avoid circular dependencies.

Step 4: Draw component diagram

flowchart TB
    subgraph container [Container Name]
        comp1[Component A]
        comp2[Component B]
        comp3[Component C]
    end
    comp1 --> comp2
    comp2 --> comp3

Keep inside one container boundary.

Step 5: Map to patterns

Identify applied patterns:

  • Layered architecture, hexagonal, CQRS, repository, etc.
  • Note pattern violations or technical debt

Step 6: Validate

Run Validation checklist.


Decision Rules

ConditionAction
No container diagramStop; run container-diagram-builder
Container not foundAsk user to select valid container
More than 15 componentsGroup into sub-modules; simplify diagram
Circular dependenciesRefactor component boundaries; flag as debt
Component = single classMerge into logical module

Validation

  • Target container identified from container diagram
  • 3–12 components with clear responsibilities
  • All interactions documented with direction
  • Mermaid diagram within container boundary
  • No other containers' internals shown
  • Applied patterns noted
  • Circular dependencies flagged if present

Anti-patterns

  • Class diagram as component diagram — every class as a node.
  • God component — single component doing everything.
  • Leaking containers — showing other containers' internals.
  • Unlabeled dependencies — arrows without interface description.
  • Missing adapters — external calls directly from domain logic.

Best Practices

  • Follow C4 Level 3 scope strictly.
  • Align with DDD bounded context if applicable.
  • Separate adapters from domain components.
  • One diagram per complex container; simple containers may need fewer components.
  • Link components to FR/NFR responsibilities.

Output Structure

# Component Diagram: [Container Name]

## Container Context
- **Technology:** [stack]
- **Responsibility:** [from container diagram]

## Components
| Component | Type | Responsibility |
|-----------|------|----------------|

## Interactions
| From | To | Interface | Purpose |
|------|----|-----------|---------|

## Diagram
```mermaid
[diagram]

Patterns Applied

Technical Debt

IssueImpactRecommendation

---

# Next Skills

| Outcome | Recommended Skill |
|---------|-------------------|
| Design container API | `architecture/api-designer` |
| Review component design | `architecture/architecture-review` |
| Analyze data through components | `architecture/data-flow-analyzer` |
| Other containers | `architecture/component-diagram-builder` |

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.