Skill

Document C4 Components and Generate Diagrams

Template skill for documenting C4 model Component-level diagrams - features, interfaces, dependencies, and Mermaid diagrams.

Works with github

91
Spark score
out of 100
Updated 21 days ago
Version 14.1.0

Add to Favorites

Why it matters

Automate the documentation of C4 model components, synthesizing code elements into logical groupings and generating visual component diagrams.

Outcomes

What it gets done

01

Synthesize code files into logical C4 components.

02

Define component boundaries, features, and interfaces.

03

Generate Mermaid component diagrams and master component indexes.

04

Provide guidance on C4 component best practices.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-c4-component | bash

Overview

C4 Component Level: [Component Name]

Template skill for C4 model Component-level documentation, capturing a component's purpose, features, interfaces, and dependencies within a single container, rendered as a Mermaid C4Component diagram and aggregated into a master component index. Use when documenting the logical component boundaries, interfaces, and relationships within a single container of a system's C4 model.

What it does

This skill produces C4 model Component-level documentation - the zoomed-in view showing the logical components living inside a single container and how they relate. Its template captures, per component: a name, short description, type (application/service/library/etc.), and primary technology; a detailed purpose statement; a software-features list; links to the individual code-level files that make up the component (c4-code-file-*.md); interfaces exposed (protocol - REST/GraphQL/gRPC/events - plus named operations with parameters and return types); and dependencies, split into other components used and external systems integrated with. It renders relationships as a Mermaid C4Component diagram scoped to a Container_Boundary, showing components, a component-level database if present, and relationships (Rel) both between components and out to external containers/systems - following c4model.com's component-diagram principles: zoom into a single container, focus on logical components and their responsibilities, show component interfaces, show inter-component interaction, and include external dependencies. A master component index template aggregates multiple components into a system overview with links to each component's individual documentation file and a combined relationship diagram. Example interactions include synthesizing a set of c4-code-*.md files into logical components, defining component boundaries for a specific subsystem (e.g. auth/authz), and grouping database-access code into components with documented relationships.

When to use - and when NOT to

Use this skill when documenting the component-level view of a system's C4 model - defining logical component boundaries within a single container, their interfaces, and their relationships - typically by synthesizing multiple lower-level code documentation files. It is not for documenting individual code elements (that's the companion C4-Code level), mapping components to deployment units (that's the C4-Container level), or producing a high-level whole-system diagram (that's the C4-Context level) - each of those is a distinct, named level in the same documentation system.

Inputs and outputs

Input is a container's constituent code files or an existing informal description of its logical structure. Output is per-component documentation (features, interfaces, dependencies) plus a Mermaid C4Component diagram and a master component index linking all documented components together.

Integrations

Produces Mermaid C4Component diagrams per the C4 model (c4model.com), linking to companion C4-Code (individual code elements), C4-Container (deployment mapping), and C4-Context (system-level) documentation levels.

C4Component
    title Component Diagram for [Container Name]

    Container_Boundary(container, "Container Name") {
        Component(component1, "Component 1", "Type", "Description")
        Component(component2, "Component 2", "Type", "Description")
    }
    Rel(component1, component2, "Uses")

Who it's for

Architects and engineers documenting a system's C4 model who need to define logical component boundaries, interfaces, and relationships within a single container, consistently formatted and linked to code- and container-level documentation.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.