/amplihack:code-atlasfrom amplihack
Builds multi-layer architecture atlases from code, generating Graphviz DOT and Mermaid diagrams. Uses graph-form reasoning to expose structural bugs, route/DTO mismatches, orphaned env vars, dead code paths, and stale docs. Language-agnostic with three-pass bug hunt verdicts.
Ships in amplihack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build exhaustive, regeneratable architecture atlases directly from code truth. A code-atlas is a living document set: diagrams, graphs, and inventory tables that form a navigable map of any codebase. Atlas-building is investigation: structured reasoning about code in graph form reveals structural bugs, API contract mismatches, and architectural drift that linear code review misses.
An atlas is complete when any engineer, given only the atlas and a bug report, can trace the full execution path without opening the source code.
Layer definitions are the single source of truth in LAYERS.yaml. All references below use slugs from that file.
| Slug | Name | Description | Recommended Diagram Type |
|---|---|---|---|
repo-surface | Repository Surface | All source files, project structure, build systems | Mermaid flowchart TD |
ast-lsp-bindings | AST+LSP Symbol Bindings | Cross-file symbol references, dead code, interface mismatches | Mermaid flowchart LR or DOT digraph |
compile-deps | Compile-time Dependencies | Package imports, dependency trees, circular deps | DOT digraph (handles large trees better) |
runtime-topology | Runtime Topology | Services, containers, ports, inter-service connections | DOT digraph with subgraph clusters |
api-contracts | API Contracts | HTTP routes, gRPC, GraphQL, middleware chains | Mermaid flowchart TD |
data-flow | Data Flow | DTO-to-storage chains, transformation steps | Mermaid flowchart LR |
service-components | Service Component Architecture | Per-service internal module/package structure | Mermaid graph TD (one per service) |
user-journeys | User Journey Scenarios | End-to-end paths from entry to outcome | Mermaid sequenceDiagram |
| Slug | Scope Target |
|---|---|
repo-surface | Top-level directories and build entry points. Do not enumerate every file. |
ast-lsp-bindings | Exported symbols and their cross-file references. Focus on public API surface. |
compile-deps | Direct dependencies and one level of transitive. Include version constraints. |
runtime-topology | All deployed services, their ports, and inter-service protocols. |
api-contracts | Every HTTP/gRPC/GraphQL endpoint with auth, DTOs, and middleware. |
data-flow | Primary read/write paths per service. Skip internal caching flows unless relevant. |
service-components | Top-level packages/modules within each service. Show coupling edges. |
user-journeys | Derive from api-contracts routes + pages/CLI entries. Trace 3-8 key journeys. |
code-atlas (this skill)
Responsibilities:
- Atlas layer orchestration (all 8 layers)
- Language-agnostic code exploration
- Python import reading for compile-deps and service-components (see reference.md)
- Three-pass bug-hunting workflow
- Staleness detection triggers
- Density management (split, not prompt)
- Publication workflow (GitHub Pages, mkdocs, SVG)
Delegates to:
compile-deps / service-components analyzer (language-pluggable; mode label always visible):
cargo metadata + rust-analyzer/ripgrep Rust repos: dependency + module static approximation
analyzer agent Any other language: static-approximation dep/module mapping
mermaid-diagram-generator Mermaid syntax generation and formatting
lsp-setup skill Layer ast-lsp-bindings: LSP-assisted symbol queries (optional)
architect Complex DOT graph rendering and cross-layer layouts
analyzer agent Deep codebase investigation and dependency mapping
reviewer agent Contradiction hunting (Passes 1, 2, 3)
The compile-deps / service-components analyzer is language-pluggable — no adapter is
hard-required and Python is never required for non-Python repositories. The active adapter
(python-ast | rust-cargo-metadata | static-approximation) is always stated via a visible
mode label; see Compile-deps / Service-components Analyzer Modes below for the full table.
| Trigger | Use Case |
|---|---|
| Starting work on an unfamiliar codebase | Full atlas build before coding |
| Onboarding a new engineer | Share atlas as navigation guide |
| Before a major refactor | Map current state; plan changes against topology |
| Bug hunt stalled | Pass 1 + Pass 2 bug-hunting through graphs |
| Docs feel stale | Staleness check + targeted rebuild |
| Adding CI/CD quality gate | Register atlas freshness checks |
| Publishing documentation site | GitHub Pages / mkdocs publication workflow |
| Reviewing an unfamiliar PR | PR impact view using diff against current atlas |
# Build a full atlas
User: Build a complete code atlas for this repository
# Run bug hunting
User: Run code atlas bug hunting passes on this service
# Check freshness
User: Are our architecture diagrams still accurate?
# Publish
User: Publish our code atlas to GitHub Pages
The skill defaults to building atlas diagrams in both formats because they find different bugs. A controlled experiment across 7 repos showed only ~15% overlap in bugs found -- running both finds ~1.7x the bugs of either alone. The different syntax forces different reasoning paths through the same code. Evidence is documented in PR #3221.
The user can override to a single format:
User: Build a code atlas using only Mermaid
User: Build a code atlas in DOT format only
There are no hard node/edge limits. Instead:
If a diagram would be unreadably dense, split into sub-diagrams by package or service boundary. In batch mode, auto-group without prompting the user. Each sub-diagram should target 15-40 nodes for readability.
For example, a runtime-topology diagram with 80 services should be split into sub-diagrams
by domain (e.g., runtime-topology-payments.mmd, runtime-topology-auth.mmd) plus one
high-level overview diagram showing inter-domain connections.
A table is only produced as a companion to a diagram, never as a replacement.
The atlas build follows these phases in order:
kuzu -> lbug -> neo4j -> portable-cypher-only), select the
compile-deps analyzer (python-ast | rust-cargo-metadata | static-approximation),
detect LSP modeingest-to-graph) -- ALWAYS emit the portable
OpenCypher artifact set (schema + per-layer node/rel data + queries) encoding all 8 layers
AND their inter-layer link relationships; then load those same artifacts into the selected
live backend (kuzu | lbug | neo4j), or record portable-cypher-only when no engine is
available. The selected backend is ALWAYS recorded in index.md and staleness-map.yaml;
never a silent skip.After each build phase, diagrams are written to docs/atlas/{slug}/ with .mmd source,
.dot source, rendered *-mermaid.svg and *-dot.svg, and a README.md that embeds the
SVGs inline using  syntax.
The atlas is an active investigation tool. Three passes transform it from a map into a high-confidence bug-detection engine. Each pass runs in a fresh context window to prevent anchoring bias.
Full checklists, templates, and output formats: bug-hunt-guide.md
Layer ast-lsp-bindings operates in one of two modes, always labelled on line 1 of its README:
| Mode | Trigger | Mechanism |
|---|---|---|
lsp-assisted | lsp-setup reports active LSP server | Delegates symbol queries to LSP |
static-approximation | LSP unavailable | ripgrep + source inspection |
The mode label is never absent, never defaulted silently.
The atlas produces a queryable graph representation of the code across all 8 layers, with first-class links between the layers. This goal is engine-neutral. It is satisfied by two things working together:
Portable graph artifacts (mandatory, always emitted). The artifact set under
docs/atlas/cypher/ is the required, engine-neutral deliverable. It encodes every layer's
nodes and relationships PLUS the inter-layer link relationships in portable OpenCypher.
This is generated on every build regardless of which live database (if any) is present.
Live-DB ingestion (pluggable, selectable backend). Loading the artifacts into a running graph engine is an optional convenience, never a hard dependency. Supported backends:
graph_backend | Engine | Notes |
|---|---|---|
kuzu | Kuzu embedded graph DB (Python/CLI) | CREATE NODE/REL TABLE ... PRIMARY KEY schema adapter |
lbug | Embedded lbug/ladybug Rust graph store | Native to Simard and other native-Rust/amplihack projects |
neo4j | Neo4j or any OpenCypher-compatible server | Standard OpenCypher schema adapter |
portable-cypher-only | None — emit portable artifacts only | First-class recorded outcome when no engine is available |
Selection. Pass an explicit graph_backend option to force a backend; otherwise the skill
auto-detects in this order: kuzu -> lbug -> neo4j -> portable-cypher-only. Absence of
kuzu (or Python) MUST NOT hard-fail the build.
Fail-visible, never silent. portable-cypher-only is a visible, recorded outcome, never
a silent skip. Every build records graph_backend: <kuzu|lbug|neo4j|portable-cypher-only> in
both docs/atlas/index.md (generation metadata) and docs/atlas/staleness-map.yaml (top-level
field). The portable cypher graph is always emitted.
Native-Rust / Simard guidance. For Simard and other native-Rust/amplihack projects the graph
backend is lbug — the embedded graph store already linked into the Rust binary — loaded from the
same portable cypher artifacts. Under those projects' hard NO-kuzu / NO-Python policy, kuzu and
Python are NOT used; the analyzer runs in rust-cargo-metadata or static-approximation mode and
the backend is lbug (or portable-cypher-only if the store is not being populated).
The canonical engine-neutral graph model and the per-backend schema emission adapters (kuzu, lbug/ladybug, neo4j) are defined in reference.md. The inter-layer link relationships are mandatory in every adapter.
Compile-deps and service-components analysis is language-pluggable and its mode is always labelled (mirroring ast-lsp-bindings):
| Mode | Trigger | Mechanism |
|---|---|---|
python-ast | Python repo detected | Reads imports using reference.md |
rust-cargo-metadata | Rust repo detected | cargo metadata + rust-analyzer/ripgrep approximation |
static-approximation | Any other language / fallback | ripgrep + analyzer agent static mapping |
The analyzer mode label is never absent and never defaulted silently. Python is never required for non-Python repositories.
docs/atlas/
index.md (records graph_backend: <kuzu|lbug|neo4j|portable-cypher-only>)
staleness-map.yaml (top-level graph_backend: <...> field)
{slug}/
README.md (embeds SVG diagrams inline with )
*-mermaid.svg (rendered Mermaid diagrams)
*-dot.svg (rendered Graphviz diagrams)
*.mmd (Mermaid source)
*.dot (Graphviz source)
inventory.md (where applicable)
cypher/ (ALWAYS emitted — the mandatory, engine-neutral graph deliverable)
schema.cypher (canonical graph model; backend-specific schema adapter selected)
atlas-layers.cypher (per-layer node/rel data for all 8 layers)
atlas-services.cypher
atlas-bugs.cypher
atlas-relationships.cypher (inter-layer link relationships — DEPENDS_ON, CALLS, EXPOSES,
USES_DTO, REFERENCES, READS_FROM, WRITES_TO, USES_ENV, TRAVERSES)
queries.cypher (ready-to-run example queries)
Three non-negotiable output rules:
code-atlas-bughunt label.graph_backend: <kuzu|lbug|neo4j|portable-cypher-only> in
index.md and staleness-map.yaml). Absence of kuzu (or Python) never hard-fails the build.
Never silently drop graph output.docs/atlas/cypher/ — schema,
per-layer node/rel data for all 8 layers, and the inter-layer link relationships — regardless
of which live backend is selected. This is what satisfies "a graph representation of the code
across layers with links between them."Staleness triggers are defined per-layer in LAYERS.yaml as glob patterns.
When git diff matches a trigger pattern, the corresponding layer is marked stale.
Full trigger table, rebuild commands, and incremental rebuild strategy: reference.md
Three GitHub Actions patterns are available:
Full workflow YAML and configuration: publication-guide.md
Outputs GitHub Pages-ready docs/atlas/ structure. Compatible with mkdocs-material and
plain GitHub Pages. SVGs are committed so no render step is needed at read time.
SVG generation commands, mkdocs integration, and deployment workflows: publication-guide.md
Per-layer Mermaid and DOT examples with recommended diagram types: examples.md
All security controls (SEC-01 through SEC-19) are defined in SECURITY.md. Key controls:
Typed contracts for all skill delegations and filesystem layout: API-CONTRACTS.md
Error codes, canonical engine-neutral graph model + per-backend schema adapters, staleness trigger table: reference.md
A complete atlas satisfies:
docs/atlas/{slug}/python-ast, rust-cargo-metadata, or static-approximation).
Python is not required for non-Python repos; the active mode is always labelled.Diagramming is investigation, not just documentation.
The most valuable output of a code atlas is the bugs and contradictions discovered while reasoning about the system in graph form.
Five rules that are never negotiable:
kuzu | lbug | neo4j | portable-cypher-only) is always recorded. Never silently drop
graph output; absence of kuzu never hard-fails the build.Rebuild from code truth. Hunt contradictions. File evidence-backed bugs. Repeat.
API-CONTRACTS.md (opens in a new tab)LAYERS.yaml (opens in a new tab)README.md (opens in a new tab)SECURITY.md (opens in a new tab)bug-hunt-guide.md (opens in a new tab)examples.md (opens in a new tab)publication-guide.md (opens in a new tab)reference.md (opens in a new tab)tests/run_all_tests.sh (opens in a new tab)tests/test_atlas_output_structure.sh (opens in a new tab)tests/test_bug_hunt_workflow.sh (opens in a new tab)tests/test_ci_workflow.sh (opens in a new tab)tests/test_graph_backend.sh (opens in a new tab)tests/test_layer7_8.sh (opens in a new tab)tests/test_layer_contracts.sh (opens in a new tab)tests/test_no_silent_degradation.sh (opens in a new tab)tests/test_publication_workflow.sh (opens in a new tab)tests/test_rebuild_script.sh (opens in a new tab)tests/test_scenarios.md (opens in a new tab)tests/test_security_controls.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub rysweet/amplihack-rs --plugin amplihack30 skills in this plugin
/agentic-workflow-firstStart new work as a deterministic workflow of agentic steps, prompts, and tools instead of code. Use when designing a feature, deciding how to build something, choosing code vs recipe, or asking "how should I structure this"./amplihack-expertComprehensive knowledge of amplihack framework architecture, patterns, and usage/code-philosophyMulti-pass code philosophy audit skill. Performs three distinct passes
over target code to verify adherence to the project's PHILOSOPHY.md
principles. Produces a structured report with findings and delegates
fixes to dev-orchestrator. This is an advisory audit-only skill — it
does not modify code directly.
/crusty-old-engineerCurmudgeonly engineering advisor that provides grounded skepticism, evidence-linked judgment,
and constructive progress on architectural decisions, legacy refactors, tooling choices, and
broad "how should I start?" questions. Sounds like a senior systems engineer who has reviewed
too many designs to be impressed, but still cares about correctness.
Use when: architectural decisions, legacy replacements, new tooling evaluation, broad planning questions.
/default-workflowDevelopment workflow for features, bugs, refactoring. Normally executed as a
sub-recipe by dev-orchestrator/smart-orchestrator. Supports direct invocation
via recipe runner for standalone use.
/dev-orchestratorDefault task orchestrator for all development and investigation work.
Classifies tasks, decomposes into parallel workstreams if appropriate,
and routes execution through the recipe runner.
Other plugins' skills for the same job