// "AI-powered comprehensive codebase documentation generator. Analyzes project structure, identifies architecture patterns, creates C4 model diagrams, and generates professional technical documentation. Use when users need to document codebases, understand software architecture, create technical specs, or generate developer guides. Supports all programming languages. Alternative to Litho/deepwiki-rs that uses Claude Code subscription without external API costs."
| name | smart-docs |
| description | AI-powered comprehensive codebase documentation generator. Analyzes project structure, identifies architecture patterns, creates C4 model diagrams, and generates professional technical documentation. Use when users need to document codebases, understand software architecture, create technical specs, or generate developer guides. Supports all programming languages. Alternative to Litho/deepwiki-rs that uses Claude Code subscription without external API costs. |
| allowed-tools | ["Read","Glob","Write","Bash(tree:*)","Bash(find:*)","Bash(wc:*)","Bash(cloc:*)"] |
You are an expert software architect and technical writer. Your task is to generate comprehensive, professional codebase documentation similar to Litho/deepwiki-rs, but using Claude Code's native capabilities without external LLM API calls.
Objective: Understand project structure, technology stack, and scope
Steps:
Get Project Overview:
# Get directory structure
tree -L 3 -I 'node_modules|target|build|dist|vendor|__pycache__|.git'
# Or if tree not available:
find . -type d -maxdepth 3 -not -path '*/\.*' -not -path '*/node_modules/*' -not -path '*/target/*'
Count Lines of Code:
# If cloc is available:
cloc . --exclude-dir=node_modules,target,build,dist,vendor
# Or basic count:
find . -name '*.rs' -o -name '*.py' -o -name '*.java' -o -name '*.go' -o -name '*.js' -o -name '*.ts' | xargs wc -l
Identify Entry Points: Use Glob to find:
**/{README,Readme,readme}.md**/package.json, **/Cargo.toml, **/pom.xml, **/go.mod, **/setup.py**/main.*, **/index.*, **/app.*Read Key Files: Use Read tool to analyze:
Determine Technology Stack: Based on files found, identify:
Objective: Understand system architecture, modules, and relationships
Steps:
Identify Modules/Packages:
src/ subdirectories, Cargo.toml workspace members__init__.pysrc/main/java/.go filessrc/ or lib/ subdirectoriestsconfig.json pathsMap Dependencies:
Detect Architectural Patterns: Look for:
Identify Core Components:
Objective: Create comprehensive markdown documentation
Create ./docs/ directory structure:
./docs/
โโโ 1. Project Overview.md
โโโ 2. Architecture Overview.md
โโโ 3. Workflow Overview.md
โโโ 4. Deep Dive/
โโโ [Component1].md
โโโ [Component2].md
โโโ [Component3].md
Content Structure:
# Project Overview
## What is [Project Name]?
[Brief description of what the project does]
## Core Purpose
[Main goals and objectives]
## Technology Stack
- **Language**: [Primary language(s)]
- **Framework**: [Main framework]
- **Build Tool**: [Build system]
- **Key Dependencies**: [Important libraries]
## Key Features
- Feature 1
- Feature 2
- Feature 3
## Project Structure
[Directory tree of main components]
## Getting Started
[Quick start instructions based on README]
## Architecture Summary
[High-level architecture overview - detailed in next doc]
Content Structure:
# Architecture Overview
## System Context (C4 Level 1)
[Description of system boundaries and external actors]
```mermaid
C4Context
title System Context Diagram
Person(user, "User", "End user of the system")
System(system, "[Project Name]", "[Brief description]")
System_Ext(external1, "External System 1", "[Description]")
Rel(user, system, "Uses")
Rel(system, external1, "Integrates with")
[Description of major containers/services]
C4Container
title Container Diagram
Container(app, "Application", "[Tech]", "[Description]")
ContainerDb(db, "Database", "[DB Type]", "[Description]")
Container(api, "API", "[Tech]", "[Description]")
Rel(app, api, "Calls")
Rel(api, db, "Reads/Writes")
[Breakdown of major modules and their relationships]
graph TB
subgraph "Module A"
A1[Component A1]
A2[Component A2]
end
subgraph "Module B"
B1[Component B1]
B2[Component B2]
end
A1 --> B1
A2 --> B2
#### Document 3: Workflow Overview.md
**Content Structure**:
```markdown
# Workflow Overview
## Core Workflows
### Workflow 1: [Name]
[Description of workflow]
```mermaid
sequenceDiagram
participant User
participant Frontend
participant Backend
participant Database
User->>Frontend: Action
Frontend->>Backend: API Call
Backend->>Database: Query
Database-->>Backend: Results
Backend-->>Frontend: Response
Frontend-->>User: Display
Steps:
[Similar structure]
flowchart LR
Input[Input Data] --> Process1[Process 1]
Process1 --> Process2[Process 2]
Process2 --> Output[Output]
[How state is managed in the application]
[Error handling approach]
#### Documents 4+: Deep Dive Components
For each major module/component, create detailed documentation:
```markdown
# Deep Dive: [Component Name]
## Overview
[Detailed description of component]
## Responsibilities
- Responsibility 1
- Responsibility 2
- Responsibility 3
## Architecture
```mermaid
classDiagram
class ComponentA {
+method1()
+method2()
}
class ComponentB {
+method3()
}
ComponentA --> ComponentB : uses
file1.ext: [Description]file2.ext: [Description][Code explanation]
[Code explanation]
[If applicable, document public API]
[Testing approach for this component]
### Phase 4: Diagram Generation (10-15 minutes)
**Mermaid Diagram Types to Use**:
1. **System Context** - C4Context (use C4 plugin syntax if available, otherwise use graph)
2. **Container Diagram** - C4Container or deployment diagram
3. **Component Relationships** - Graph TB/LR
4. **Sequence Diagrams** - For workflows
5. **Class Diagrams** - For OOP architectures
6. **State Diagrams** - For state machines
7. **ER Diagrams** - For data models
8. **Flow Charts** - For processes
**Diagram Best Practices**:
- Keep diagrams focused (max 10-12 nodes)
- Use clear, descriptive labels
- Include legends when needed
- Test syntax before including
- Provide context before diagram
### Phase 5: Quality Assurance (5-10 minutes)
**Checklist**:
- [ ] All markdown files created
- [ ] Mermaid syntax validated
- [ ] Cross-references work
- [ ] File structure logical
- [ ] No Lorem ipsum placeholders
- [ ] Code examples accurate
- [ ] Diagrams render correctly
- [ ] Consistent formatting
**Present Summary**:
```markdown
## Documentation Generated โ
Created comprehensive documentation in `./docs/`:
- **1. Project Overview.md** - [X] lines
- Technology stack identified
- Core features documented
- **2. Architecture Overview.md** - [X] lines
- System context diagram (C4 Level 1)
- Container architecture (C4 Level 2)
- [N] component diagrams
- **3. Workflow Overview.md** - [X] lines
- [N] core workflows documented
- [N] sequence diagrams
- **4. Deep Dive/** - [N] component docs
- Detailed implementation documentation
- [N] technical diagrams
**Total**: ~[X] lines of documentation
**Diagrams**: [N] Mermaid diagrams
**Coverage**: [percentage]% of codebase analyzed
Next steps:
- Review generated documentation
- Customize as needed
- Integrate into project README
Cargo.toml, src/main.rs, src/lib.rssetup.py, pyproject.toml, __init__.pypom.xml, build.gradle, package structurepackage.json, tsconfig.jsonFor projects >1000 files:
Monitor token usage:
If you encounter issues:
Always use markdown with:
User: "Generate docs for this Rust project"
Response:
User: "Document this FastAPI application"
Response:
User: "Create architecture docs for this React app"
Response:
โ Use When:
โ Don't Use When:
Remember: This skill uses your Claude Code subscription exclusively. No external API calls, no additional costs. All analysis and generation happens within Claude Code's context.