From ds
Creates and navigates hierarchical code maps (L0/L1/L2/L3) for AI agent and human orientation. Use when bootstrapping codebase understanding, creating navigation documentation, exploring architecture, or validating map integrity.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ds:code-mappingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<essential_principles>
references/domains.mdreferences/examples/l0-architecture.mdreferences/examples/l1-domain.mdreferences/examples/l2-module.mdreferences/examples/readme.mdreferences/format-spec.mdscripts/code_map.pyscripts/generate/__init__.pyscripts/generate/differ.pyscripts/generate/generator.pyscripts/generate/models.pyscripts/generate/parser.pyscripts/generate/renderer.pyscripts/generate/templates.pyscripts/generate/templates/ARCHITECTURE.mdscripts/generate/templates/README.mdscripts/generate/templates/domain.mdscripts/generate/templates/module.mdscripts/validate/__init__.pyscripts/validate/lsp_client.py<essential_principles>
Maps are hierarchical: L0 (architecture) links to L1 (domains) which link to L2 (modules) which link to L3 (source code). Always start at L0 and drill down as needed.
Anchors enable grep navigation: Headings contain [Lx:identifier] markers. Find any section with grep "\[L1:auth\]" docs/map/.
Size limits enforce abstraction:
If a doc exceeds its limit, split it into the next level down.
Code is truth, map is derivative: When code and map conflict, the code wins. Update the map to reflect reality.
Bootstrap pattern: Agents read README.md first, then ARCHITECTURE.md, then relevant domain docs based on task.
</essential_principles>
<auto_routing>
Route based on user intent (match first):
| User says | Action |
|---|---|
| "explore", "read", "understand", "navigate", "find", "where is" | Read workflows/explore.md, then follow it |
| "create", "generate", "new", "build", "document", "map" | Read workflows/create.md, then follow it |
| "validate", "check", "verify", "lint" | Run: uv run python scripts/code_map.py validate <map-dir> (path relative to this SKILL.md) |
If intent is ambiguous, ask:
What would you like to do?
- Explore - Navigate existing map to understand codebase
- Create - Generate a new code map
- Validate - Check map integrity
</auto_routing>
<quick_reference>
Directory structure:
docs/map/
├── README.md # Entry point + domains index
├── ARCHITECTURE.md # L0: System overview
└── domains/ # L1: Domain docs
├── auth.md
└── api.md
Anchor format: ## [L1:identifier] Heading Text
Code link format: [`symbol`](path/to/file.py#L42)
Cross-reference format: [Domain Name](domains/name.md)
</quick_reference>
<reference_index>
Domain Knowledge (references/):
| Reference | Purpose |
|---|---|
| format-spec.md | Format rules for anchors, links, and size limits |
| examples/ | Input/output examples (l0-architecture.md, l1-domain.md, l2-module.md, readme.md) |
| domains.md | What domain docs should capture |
</reference_index>
The scripts use Python 3.11+ stdlib only (no external dependencies).
Script paths are relative to this SKILL.md file (not the working directory). Derive the absolute script path from this file's location:
/path/to/code-mapping/SKILL.md/path/to/code-mapping/scripts/code_map.py# Validate an existing map
uv run python scripts/code_map.py validate <map-dir>
# Generate map skeletons from source
uv run python scripts/code_map.py generate <src-dir> <map-dir>
Generate command features:
.md file per source file (1:1 mapping)<!-- TODO: description --> placeholders<workflows_index>
Workflows (workflows/):
| Workflow | Purpose | Status |
|---|---|---|
| explore.md | Navigate existing map to understand codebase | Ready |
| create.md | Generate new map for a codebase | Ready |
Scripts (scripts/):
| Script | Purpose | Status |
|---|---|---|
| code_map.py | CLI entry point (validate, generate) | Ready |
| generate/ | Map skeleton generation from source | Ready |
| validate/ | Map validation (links, sizes, symbols) | Ready |
</workflows_index>
<success_criteria> A well-executed code map:
npx claudepluginhub durandom/skills --plugin dsGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Implements work from a spec or tickets using TDD at agreed seams, with regular typechecking and test runs, followed by code review.