codemap
Generate navigational codebase maps with architecture diagrams. Use when mapping a codebase, creating architecture docs, visualizing project structure, generating infrastructure diagrams, understanding repo layout, or onboarding to a new project.
Best use case
codemap is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Generate navigational codebase maps with architecture diagrams. Use when mapping a codebase, creating architecture docs, visualizing project structure, generating infrastructure diagrams, understanding repo layout, or onboarding to a new project.
Teams using codemap should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/codemap/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How codemap Compares
| Feature / Agent | codemap | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Generate navigational codebase maps with architecture diagrams. Use when mapping a codebase, creating architecture docs, visualizing project structure, generating infrastructure diagrams, understanding repo layout, or onboarding to a new project.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Codemap Generator
Generate `CODEMAP.md` files that help humans and AI agents navigate codebases.
## Output Separation
- **CODEMAP.md** = Auto-generated navigation map (this skill creates/updates)
- **ARCHITECTURE.md** = Hand-written design decisions (never touch)
## Workflow
### Phase 1: Project Analysis
1. **Count files** to determine project size:
- Use Glob with pattern `**/*` excluding vendored paths
- Exclude: `node_modules/`, `vendor/`, `__pycache__/`, `target/`, `.terraform/`, `.*`
- Count results to determine depth
2. **Detect project type(s)**:
- Check for IaC patterns (Terraform, Ansible, K8s, etc.)
- Check for application code (package.json, go.mod, requirements.txt, etc.)
- Projects can be mixed (app + infra)
3. **Set depth based on file count**:
| Files | Depth | Output |
|-------|-------|--------|
| <50 | shallow | Single root CODEMAP.md |
| 50-500 | medium | Root + key directories |
| >500 | deep | Root + 2 levels, skip vendored |
### Phase 2: Existing File Check
**STOP. Check for existing CODEMAP.md before proceeding.**
Before generating, check if `CODEMAP.md` exists.
**If exists**: Use `AskUserQuestion` with options:
- Overwrite completely
- Merge/update (preserve manual additions)
- Abort
**If not exists**: Proceed to generation.
**Do NOT proceed to Phase 3 until resolved.**
### Phase 3: Content Generation
Generate sections based on what's detected:
#### For Application Code
1. **Tech Stack** - languages, frameworks, key dependencies
2. **Directory Structure** - annotated tree with purpose per directory
3. **Entry Points** - main files, CLI commands, API servers
4. **Code Architecture Diagram** - mermaid showing component relationships
5. **Key Files Reference** - important files with one-line descriptions
#### For Infrastructure Code
1. **IaC Stack** - Terraform, Ansible, K8s, etc.
2. **Infrastructure Topology Diagram** - mermaid showing resource relationships
3. **Module/Role Hierarchy Diagram** - mermaid showing code organization
4. **Resource Inventory** - what's managed, providers used
#### For Mixed Repos
Include both sections with clear delineation.
### Phase 4: Output
Write `CODEMAP.md` to project root (and subdirectories if depth warrants).
## Detection Patterns
### Application Code
| Indicator | Stack |
|-----------|-------|
| `package.json` | Node.js/JavaScript/TypeScript |
| `go.mod` | Go |
| `Cargo.toml` | Rust |
| `requirements.txt`, `pyproject.toml`, `setup.py` | Python |
| `pom.xml`, `build.gradle` | Java |
| `Gemfile` | Ruby |
| `composer.json` | PHP |
| `*.csproj`, `*.sln` | .NET |
### Infrastructure as Code
| Indicator | Tool | Analysis Method |
|-----------|------|-----------------|
| `*.tf` files | Terraform | Parse resources, modules, use `terraform graph` if initialized |
| `playbook*.yml` + `roles/` | Ansible | Map playbooks → roles → tasks |
| `kind:` in YAML, `kustomization.yaml` | Kubernetes | Parse manifests, map services/deployments |
| `Chart.yaml` | Helm | Parse templates, values |
| `Pulumi.yaml` | Pulumi | Treat like application code |
| `AWSTemplateFormatVersion` | CloudFormation | Parse resources, nested stacks |
| `docker-compose.yml` | Docker Compose | Map services, networks, volumes |
## Mermaid Diagram Patterns
### Code Architecture (Component Relationships)
```mermaid
graph TD
subgraph "API Layer"
A[REST API]
B[GraphQL]
end
subgraph "Business Logic"
C[Services]
D[Domain Models]
end
subgraph "Data Layer"
E[Repositories]
F[Database]
end
A --> C
B --> C
C --> D
C --> E
E --> F
```
### Infrastructure Topology
```mermaid
graph LR
subgraph "AWS"
ALB[Load Balancer]
subgraph "ECS Cluster"
SVC1[Service A]
SVC2[Service B]
end
RDS[(PostgreSQL)]
REDIS[(Redis)]
end
ALB --> SVC1
ALB --> SVC2
SVC1 --> RDS
SVC2 --> RDS
SVC1 --> REDIS
```
### Module Hierarchy (Terraform)
```mermaid
graph TD
ROOT[Root Module]
ROOT --> VPC[modules/vpc]
ROOT --> ECS[modules/ecs]
ROOT --> RDS[modules/rds]
ECS --> SG[modules/security-groups]
RDS --> SG
```
## Analysis Techniques
### Import Graph (AST-based)
For JS/TS:
```bash
ast-grep --pattern 'import $_ from "$SOURCE"' --lang ts
ast-grep --pattern 'require("$SOURCE")' --lang js
```
For Python:
```bash
ast-grep --pattern 'from $MODULE import $_' --lang python
ast-grep --pattern 'import $MODULE' --lang python
```
For Go:
```bash
ast-grep --pattern 'import "$PKG"' --lang go
```
### Entry Point Detection
| File Pattern | Type |
|--------------|------|
| `main.go`, `main.py`, `main.ts` | Application entry |
| `index.ts`, `index.js` | Module entry |
| `cli.py`, `cli.ts`, `cmd/` | CLI entry |
| `server.ts`, `app.py`, `api/` | Server entry |
| `*_test.go`, `*.test.ts`, `test_*.py` | Test entry |
### Terraform Resource Parsing
Extract from `*.tf`:
- `resource` blocks → managed infrastructure
- `module` blocks → dependencies
- `provider` blocks → cloud targets
- `data` blocks → external references
If `.terraform/` exists and `terraform init` has been run, can use:
```bash
terraform graph | # convert DOT to mermaid
```
**Note**: `terraform graph` requires initialized state. Skip if `.terraform/` missing or init incomplete.
## Output Template
```markdown
# Codemap
> Auto-generated navigation map. Last updated: {date}
> For design decisions, see ARCHITECTURE.md (if exists)
## Tech Stack
- **Languages**: {detected languages}
- **Frameworks**: {detected frameworks}
- **Infrastructure**: {detected IaC tools}
## Directory Structure
\`\`\`
{annotated tree}
\`\`\`
## Code Architecture
\`\`\`mermaid
{component diagram}
\`\`\`
## Infrastructure Topology
\`\`\`mermaid
{infra diagram}
\`\`\`
## Entry Points
| Entry | Purpose | Command |
|-------|---------|---------|
| {file} | {purpose} | {how to run} |
## Key Files
| File | Purpose |
|------|---------|
| {path} | {description} |
```
## Edge Cases
- **Monorepos**: Detect workspace patterns (lerna, nx, turborepo, go workspaces), generate per-package maps
- **No clear structure**: Generate minimal map with warnings about organization
- **Vendored code**: Always exclude from analysis (node_modules, vendor, .terraform, __pycache__)
- **Generated code**: Detect and label (protobuf, OpenAPI, etc.)Related Skills
workflow-review
Reviews Claude Code sessions and proposes workflow improvements. Use when: (1) /workflow-review command, (2) "review my workflow", "how can I improve", (3) after long sessions when nudged, (4) start of session with pending review. Analyzes tool usage patterns, CLAUDE.md configuration, and compares against CC best practices. Proposes: CLAUDE.md updates, new skills, underused CC features. Saves session summaries to .claude/workflow-reviews/ for cross-session continuity.
voice-mode
Activates voice conversation mode using Pocket TTS Docker container. Use when user says "voice mode", "let's talk", "talk to me", "speak your responses", or wants Claude to respond with spoken audio. Speaks all responses through TTS and plays via speakers.
test-quality
Guides strong, effective unit test generation using proven testing techniques. Use when writing unit tests, reviewing test quality, improving existing tests, generating test cases, checking test coverage strength, or when tests exist but may be weak. Triggers on: unit test, test quality, test coverage, write tests, improve tests, review tests, test strength, mutation testing, boundary testing.
pr-review
Reviews code changes before merging. Use when reviewing PRs, checking staged changes, reviewing diffs, code review, merge readiness check, or validating changes before commit/push.
latex-presentation
Creates impressive LaTeX Beamer presentations with modern design. Generates .tex files with theme selection, font pairing, TikZ diagrams, overlays, and best practices. Use for LaTeX slides, Beamer presentations, scaffolding decks, slide design advice, or TikZ diagram generation.
git-commit
Plans and executes git commits with optional TICKET_ID prefix. Analyzes staged changes, proposes optimal commit structure (single or multiple), generates descriptive messages with technical context, and executes after user approval. Use when committing code changes, creating atomic commits, or splitting large changesets.
ctask
Manages tasks using the ctask CLI wrapper over a local SQLite database. Use when tracking work items, creating tasks, managing dependencies, adding comments, labeling, or reviewing task status. Triggers on task tracking, ticket management, work planning, backlog management.
codex
AI peer review via OpenAI Codex CLI. Use when reviewing code changes, validating technical decisions, comparing implementation approaches, or getting a second opinion on architecture choices. Triggers on /codex, /codex-review, or auto-triggers when presenting significant alternatives to user.
clarice
Conducts realistic mock interviews with detailed feedback and scoring. Use for interview prep, behavioral questions, technical interviews, STAR practice, system design interviews, or interview coaching.
c7
Fetches up-to-date library documentation from Context7 and saves to /tmp/context7/. Use when needing current API docs, code examples, library references, SDK documentation, or checking latest library versions. Triggers: context7, c7, library docs, fetch docs, current documentation, api reference.
swe-cli-skills
Senior engineer CLI expertise for AI agents — workflows, safety guardrails, gotchas, and anti-patterns across cloud, IaC, containers, databases, dev tools, and platforms
PicoClaw Fleet
Orchestrate a fleet of remote PicoClaw workers over SSH for fast, ephemeral one-shot tasks.