c4-level4-code
Installation
SKILL.md
C4 Level 4: Code Diagram
The Code diagram is the lowest level of detail, showing how a single component is implemented. It's usually optional β only use it when the internal implementation is too complex to understand without a visual map.
"The code level is typically only used to describe complex parts of the codebase, or when you want to generate diagrams from the code." β Simon Brown
π― When to Use Level 4
| Situation | Diagram Type | Why |
|---|---|---|
| Complex domain model with many entities | UML Class Diagram | Show inheritance, composition, associations |
| Database schema with 10+ tables | ER Diagram | Show relationships, keys, constraints |
| State machine logic | State Diagram | Show states and transitions |
| Complex algorithm | Activity/Sequence Diagram | Show flow and decision points |
| API contract design | OpenAPI/Interface Diagram | Show endpoints, request/response types |
When NOT to use: Simple CRUD, standard patterns, or when the code is self-explanatory.