c4-code
Expert C4 Code-level documentation specialist. Analyzes code directories to create comprehensive C4 code-level documentation including function signatures, arguments, dependencies, and code structure. Use when documenting code at the lowest C4 level for individual directories and code modules.
Author
Category
Development ToolsInstall
Download and extract to your skills directory
Copy command and send to OpenClaw for auto-install:
c4-code: C4 Code-level Documentation Generation Expert
Skill Overview
c4-code is the code-level documentation generation expert in the C4 model, specialized in analyzing code directories and creating detailed documentation of function signatures, parameter types, dependencies, and code structure.
Applicable Scenarios
1. Codebase Documentation
When taking over a new project or maintaining legacy code, c4-code can quickly analyze the code directory and generate comprehensive documentation that includes function signatures, class structures, and module dependencies, helping the team understand design intent and implementation details.
2. Architecture Design Records
In software architecture design, the code-level view of the C4 model shows the most granular details. c4-code can convert actual code into structured Mermaid diagrams (class diagrams, flowcharts, dependency graphs), keeping architecture documentation in sync with code implementation.
3. Code Refactoring & Review
Before refactoring you need to understand existing dependencies; during code review you need to quickly grasp function responsibilities. The code-level documentation provided by c4-code clearly shows call relationships between functions, class inheritance hierarchies, and module dependency structures.
Core Capabilities
1. Code Element Analysis
Automatically analyze functions, methods, classes, and modules in a code directory, extract complete function signatures (including parameter types and return types), class attributes and method lists, and annotate each element with its exact source location (file path and line numbers).
2. Dependency Mapping
Identify internal dependencies (inter-module call relationships) and external dependencies (third-party libraries, frameworks), producing a structured dependency list to help understand coupling and impact scope.
3. Multi-paradigm Diagram Generation
Automatically select appropriate Mermaid diagram types based on the code’s programming paradigm: object-oriented code generates class diagrams showing inheritance and interface implementations; functional code generates flowcharts showing data pipelines; mixed-paradigm code supports combining multiple chart types.
Frequently Asked Questions
Which programming languages does the c4-code skill support?
c4-code can analyze a variety of mainstream programming languages, including but not limited to Python, JavaScript/TypeScript, Java, Go, Rust, Elixir, etc. The skill automatically recognizes the programming paradigm (object-oriented, functional, procedural) based on code characteristics and selects suitable documentation templates and diagram types.
What does the code documentation generated by c4-code include?
The output documentation includes a complete list of code elements (function signatures, class definitions, module exports), descriptions and source location links for each element, lists of internal and external dependencies, and Mermaid structural diagrams (class diagrams, flowcharts, or dependency graphs) automatically generated according to code complexity.
What is the difference between c4-code and the c4-component skill?
c4-code focuses on the micro level of a single code directory or module, analyzing specific functions, classes, and their dependencies; c4-component works at a higher level, aggregating multiple code files and abstracting them as system components. c4-code is the lowest-level view in the C4 model, suited for scenarios that require deep code-level detail.