C4 Architecture C4 Architecture
C4 Architecture C4 Architecture is an learning AI skill with a core value of Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach. It
helps developers solve real-world problems in the learning domain, boosting
efficiency, automating repetitive tasks, and optimizing workflows.
Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
Quick Facts
mkdir -p ./skills/c4-architecture-c4-architecture && curl -sfL https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/c4-architecture-c4-architecture/SKILL.md -o ./skills/c4-architecture-c4-architecture/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
# C4 Architecture Documentation Workflow
Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
[Extended thinking: This workflow implements a complete C4 architecture documentation process following the C4 model (Context, Container, Component, Code). It uses a bottom-up approach, starting from the deepest code directories and working upward, ensuring every code element is documented before synthesizing into higher-level abstractions. The workflow coordinates four specialized C4 agents (Code, Component, Container, Context) to create a complete architectural documentation set that serves both technical and non-technical stakeholders.]
Use this skill when
- Working on c4 architecture documentation workflow tasks or workflows
- Needing guidance, best practices, or checklists for c4 architecture documentation workflow
Do not use this skill when
- The task is unrelated to c4 architecture documentation workflow
- You need a different domain or tool outside this scope
Instructions
- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
- If detailed examples are required, open `resources/implementation-playbook.md`.
Overview
This workflow creates comprehensive C4 architecture documentation following the [official C4 model](https://c4model.com/diagrams) by:
1. **Code Level**: Analyzing every subdirectory bottom-up to create code-level documentation
2. **Component Level**: Synthesizing code documentation into logical components within containers
3. **Container Level**: Mapping components to deployment containers with API documentation (shows high-level technology choices)
4. **Context Level**: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)
**Note**: According to the [C4 model](https://c4model.com/diagrams), you don't need to use all 4 levels of diagram - the system context and container diagrams are sufficient for most software development teams. This workflow generates all levels for completeness, but teams can choose which levels to use.
All documentation is written to a new `C4-Documentation/` directory in the repository root.
Phase 1: Code-Level Documentation (Bottom-Up Analysis)
1.1 Discover All Subdirectories
- Use codebase search to identify all subdirectories in the repository
- Sort directories by depth (deepest first) for bottom-up processing
- Filter out common non-code directories (node_modules, .git, build, dist, etc.)
- Create list of directories to process
1.2 Process Each Directory (Bottom-Up)
For each directory, starting from the deepest:
- Use Task tool with subagent_type="c4-architecture::c4-code"
- Prompt: |
Analyze the code in directory: [directory_path]
Create comprehensive C4 Code-level documentation following this structure:
1. **Overview Section**:
- Name: [Descriptive name for this code directory]
- Description: [Short description of what this code does]
- Location: [Link to actual directory path relative to repo root]
- Language: [Primary programming language(s) used]
- Purpose: [What this code accomplishes]
2. **Code Elements Section**:
- Document all functions/methods with complete signatures:
- Function name, parameters (with types), return type
- Description of what each function does
- Location (file path and line numbers)
- Dependencies (what this function depends on)
- Document all classes/modules:
- Class name, description, location
- Methods and their signatures
- Dependencies
3. **Dependencies Section**:
- Internal dependencies (other code in this repo)
- External dependencies (libraries, frameworks, services)
4. **Relationships Section**:
- Optional Mermaid diagram if relationships are complex
Save the o
🎯 Best For
- Technical writers
- API documentation teams
- Developers scaffolding new projects
- Prototype builders
- Claude users
💡 Use Cases
- Generating JSDoc/TSDoc comments
- Writing README files for new projects
- Bootstrapping React components
- Creating API route handlers
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply C4 Architecture C4 Architecture to Your Work
Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.
- 4
Review and Refine
Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.
❓ Frequently Asked Questions
Does it follow my documentation style?
Most documentation skills respect existing style. Provide a style guide or example in your prompt.
Can I customize the generated output?
Yes — modify the skill's prompt instructions to match your project conventions and coding style.
How do I install C4 Architecture C4 Architecture?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/c4-architecture-c4-architecture/SKILL.md, ready to use.
Can I customize this skill for my team?
Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.
⚠️ Common Mistakes to Avoid
Auto-generating without reviewing
AI documentation can contain inaccuracies. Always verify technical accuracy.
Using generated code without understanding
Understand what generated code does before shipping it to production.
Not reading the full skill
Skills contain important context and edge cases beyond the quick start.