Codemap Generator

VerifiedSafe

Automatically generates navigational codebase maps (CODEMAP.md) by analyzing project structure, detecting technologies, and creating annotated directory trees, architecture diagrams, and key file references. Helps developers onboard to new projects, understand repo layout, or create architecture documentation by producing an auto-updatable map that separates auto-generated navigation from hand-written design decisions.

Sby Skills Guide Bot
DocumentationIntermediate
6/2/2026
Claude Code
#codebase-mapping#architecture-diagrams#project-navigation#code-analysis#onboarding

Recommended for

Automated summary

Generates a CODEMAP.md file that serves as a navigational map for a codebase, including architecture diagrams and structural annotations.

Strengths

  • Automatically analyzes tech stack and directory structure
  • Generates Mermaid diagrams for application and IaC architectures
  • Intelligently adjusts depth based on project size
  • Supports merge/update mode to preserve manual additions

Limitations

  • Requires tools like terraform graph to be initialized for advanced IaC diagrams
  • May miss complex relationships in very large projects
  • Generated file can become stale without regeneration
When to use it

Use this skill to quickly create a comprehensive navigation map of a codebase, ideal for onboarding or project auditing.

When not to use it

Avoid using it on extremely large projects without prior filtering, or when execution time is limited as analysis can be heavy.

Security analysis

Safe
Quality score95/100

The skill uses only safe, prefixed Bash commands (ast-grep, terraform graph) for code analysis and infrastructure inspection. No destructive operations, network requests, or obfuscated payloads. Write access is limited to generating CODEMAP.md files. No exfiltration or privilege escalation risks.

No concerns found

How this analysis is made

Examples

Generate a codebase map
Generate a CODEMAP.md for this project, including an architecture diagram and tech stack summary.
Map infrastructure code
Create a detailed map of the infrastructure as code in this repository, with Terraform resource relationships.
Update existing codemap
Update the existing CODEMAP.md to reflect recent changes in the project structure, merging in any manual additions.

name: codemap description: 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. allowed-tools:

  • Read
  • Write(./**)
  • Glob
  • Grep
  • Bash(ast-grep:*)
  • Bash(terraform graph:*)
  • AskUserQuestion
  • Task

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)

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

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)

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:

ast-grep --pattern 'import $_ from "$SOURCE"' --lang ts
ast-grep --pattern 'require("$SOURCE")' --lang js

For Python:

ast-grep --pattern 'from $MODULE import $_' --lang python
ast-grep --pattern 'import $MODULE' --lang python

For Go:

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:

terraform graph | # convert DOT to mermaid

Note: terraform graph requires initialized state. Skip if .terraform/ missing or init incomplete.

Output Template

# 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.)

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/codemap-generator-mmbizjcj/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/codemap-generator-mmbizjcj' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/codemap-generator-mmbizjcj/download' --output '.skill-downloads/codemap-generator-mmbizjcj/SKILL.md.part' && mv '.skill-downloads/codemap-generator-mmbizjcj/SKILL.md.part' '.skill-downloads/codemap-generator-mmbizjcj/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/codemap-generator-mmbizjcj/SKILL.md' && test -s '.skill-downloads/codemap-generator-mmbizjcj/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/codemap' && cp -R '.skill-downloads/codemap-generator-mmbizjcj' '.claude/skills/codemap'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/codemap-generator-mmbizjcj'

openskills read 'codemap-generator-mmbizjcj'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/codemap-generator-mmbizjcj/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills