c4-code
Documentation & ProductivitéExpert C4 Code-level documentation specialist. Analyzes code
Documentation
C4 Code Level: [Directory Name]
Use this skill when
Do not use this skill when
Instructions
resources/implementation-playbook.md.Overview
Code Elements
Functions/Methods
functionName(param1: Type, param2: Type): ReturnTypeClasses/Modules
ClassNameDependencies
Internal Dependencies
External Dependencies
Relationships
Optional Mermaid diagrams for complex code structures. Choose the diagram type based on the programming paradigm. Code diagrams show the internal structure of a single component.
Object-Oriented Code (Classes, Interfaces)
Use classDiagram for OOP code with classes, interfaces, and inheritance:
---
title: Code Diagram for [Component Name]
---
classDiagram
namespace ComponentName {
class Class1 {
+attribute1 Type
+method1() ReturnType
}
class Class2 {
-privateAttr Type
+publicMethod() void
}
class Interface1 {
<<interface>>
+requiredMethod() ReturnType
}
}
Class1 ..|> Interface1 : implements
Class1 --> Class2 : uses
### Functional/Procedural Code (Modules, Functions)
For functional or procedural code, you have two options:
**Option A: Module Structure Diagram** - Use `classDiagram` to show modules and their exported functions:
---
title: Module Structure for [Component Name]
---
classDiagram
namespace DataProcessing {
class validators {
<
+validateInput(data) Result~Data, Error~
+validateSchema(schema, data) bool
+sanitize(input) string
}
class transformers {
<
+parseJSON(raw) Record
+normalize(data) NormalizedData
+aggregate(items) Summary
}
class io {
<
+readFile(path) string
+writeFile(path, content) void
}
}
transformers --> validators : uses
transformers --> io : reads from
**Option B: Data Flow Diagram** - Use `flowchart` to show function pipelines and data transformations:
---
title: Data Pipeline for [Component Name]
---
flowchart LR
subgraph Input
A[readFile]
end
subgraph Transform
B[parseJSON]
C[validateInput]
D[normalize]
E[aggregate]
end
subgraph Output
F[writeFile]
end
A -->|raw string| B
B -->|parsed data| C
C -->|valid data| D
D -->|normalized| E
E -->|summary| F
**Option C: Function Dependency Graph** - Use `flowchart` to show which functions call which:
---
title: Function Dependencies for [Component Name]
---
flowchart TB
subgraph Public API
processData[processData]
exportReport[exportReport]
end
subgraph Internal Functions
validate[validate]
transform[transform]
format[format]
cache[memoize]
end
subgraph Pure Utilities
compose[compose]
pipe[pipe]
curry[curry]
end
processData --> validate
processData --> transform
processData --> cache
transform --> compose
transform --> pipe
exportReport --> format
exportReport --> processData
### Choosing the Right Diagram
| Code Style | Primary Diagram | When to Use |
| -------------------------------- | -------------------------------- | ------------------------------------------------------- |
| OOP (classes, interfaces) | `classDiagram` | Show inheritance, composition, interface implementation |
| FP (pure functions, pipelines) | `flowchart` | Show data transformations and function composition |
| FP (modules with exports) | `classDiagram` with `<<module>>` | Show module structure and dependencies |
| Procedural (structs + functions) | `classDiagram` | Show data structures and associated functions |
| Mixed | Combination | Use multiple diagrams if needed |
**Note**: According to the [C4 model](https://c4model.com/diagrams), code diagrams are typically only created when needed for complex components. Most teams find system context and container diagrams sufficient. Choose the diagram type that best communicates the code structure regardless of paradigm.
## Notes
[Any additional context or important information]
Example Interactions
Object-Oriented Codebases
Functional/Procedural Codebases
Mixed Paradigm
Key Distinctions
Output Examples
When analyzing code, provide:
Compétences similaires
Explorez d'autres agents de la catégorie Documentation & Productivité
claude-win11-speckit-update-skill
"Windows 11 system management"
internal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).
csharp-pro
Write modern C# code with advanced features like records, pattern