git clone https://github.com/ComeOnOliver/skillshub
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/Lum1104/Understand-Anything/understand" ~/.claude/skills/comeonoliver-skillshub-understand && rm -rf "$T"
skills/Lum1104/Understand-Anything/understand/SKILL.md/understand
Analyze the current codebase and produce a
knowledge-graph.json file in .understand-anything/. This file powers the interactive dashboard for exploring the project's architecture.
Options
may contain:$ARGUMENTS
— Force a full rebuild, ignoring any existing graph--full- A directory path — Scope analysis to a specific subdirectory
Phase 0 — Pre-flight
Determine whether to run a full analysis or incremental update.
-
Set
to the current working directory.PROJECT_ROOT -
Get the current git commit hash:
git rev-parse HEAD -
Create the intermediate output directory:
mkdir -p $PROJECT_ROOT/.understand-anything/intermediate -
Check if
exists. If it does, read it.$PROJECT_ROOT/.understand-anything/knowledge-graph.json -
Check if
exists. If it does, read it to get$PROJECT_ROOT/.understand-anything/meta.json
.gitCommitHash -
Decision logic:
Condition Action
flag in--full$ARGUMENTSFull analysis (all phases) No existing graph or meta Full analysis (all phases) Existing graph + unchanged commit hash Report "Graph is up to date" and STOP Existing graph + changed files Incremental update (re-analyze changed files only) For incremental updates, get the changed file list:
git diff <lastCommitHash>..HEAD --name-onlyIf this returns no files, report "Graph is up to date" and STOP.
Phase 1 — SCAN (Full analysis only)
Dispatch the project-scanner agent with this prompt:
Scan this project directory to discover all source files, detect languages and frameworks. Project root:
Write output to:$PROJECT_ROOT$PROJECT_ROOT/.understand-anything/intermediate/scan-result.json
After the agent completes, read
$PROJECT_ROOT/.understand-anything/intermediate/scan-result.json to get:
- Project name, description
- Languages, frameworks
- File list with line counts
- Complexity estimate
Gate check: If >200 files, inform the user and suggest scoping with a subdirectory argument. Proceed only if user confirms or add guidance that this may take a while.
Phase 2 — ANALYZE
Full analysis path
Batch the file list from Phase 1 into groups of 5-10 files each (aim for balanced batch sizes).
For each batch, dispatch a file-analyzer agent. Run up to 3 agents concurrently using parallel dispatch. Each agent gets this prompt:
Analyze these source files and produce GraphNode and GraphEdge objects. Project root:
Project:$PROJECT_ROOTLanguages:<projectName>Batch index:<languages>Write output to:<batchIndex>$PROJECT_ROOT/.understand-anything/intermediate/batch-<batchIndex>.jsonAll project files (for import resolution):
<full file path list from scan>Files to analyze in this batch:
(<sizeLines> lines)<path> (<sizeLines> lines) ...<path>
After ALL batches complete, read each
batch-<N>.json file and merge:
- Combine all
arrays. If duplicate node IDs exist, keep the later occurrence.nodes - Combine all
arrays. Deduplicate by the composite keyedges
.source + target + type
Incremental update path
Use the changed files list from Phase 0. Batch and dispatch file-analyzer agents using the same process as above, but only for changed files.
After batches complete, merge with the existing graph:
- Remove old nodes whose
matches any changed filefilePath - Remove old edges whose
orsource
references a removed nodetarget - Add new nodes and edges from the fresh analysis
Phase 3 — ASSEMBLE
Merge all file-analyzer results into a single set of nodes and edges. Then perform basic integrity cleanup:
- Remove any edge whose
orsource
references a node ID that does not exist in the merged node settarget - Remove duplicate node IDs (keep the last occurrence)
- Log any removed edges or nodes for the final summary
Phase 4 — ARCHITECTURE
Dispatch the architecture-analyzer agent with this prompt:
Analyze this codebase's structure to identify architectural layers. Project root:
Write output to:$PROJECT_ROOTProject:$PROJECT_ROOT/.understand-anything/intermediate/layers.json—<projectName><projectDescription>File nodes:
[list of {id, name, filePath, summary, tags} for all file-type nodes]Import edges:
[list of edges with type "imports"]
After the agent completes, read
$PROJECT_ROOT/.understand-anything/intermediate/layers.json to get the layer assignments.
For incremental updates: Always re-run architecture analysis on the full merged node set, since layer assignments may shift when files change.
Phase 5 — TOUR
Dispatch the tour-builder agent with this prompt:
Create a guided learning tour for this codebase. Project root:
Write output to:$PROJECT_ROOTProject:$PROJECT_ROOT/.understand-anything/intermediate/tour.json—<projectName>Languages:<projectDescription><languages>Nodes (summarized):
[list of {id, name, filePath, summary, type} for key nodes]Layers:
[layers from Phase 4]Key edges:
[imports and calls edges]
After the agent completes, read
$PROJECT_ROOT/.understand-anything/intermediate/tour.json to get the tour steps.
Phase 6 — REVIEW
Assemble the full KnowledgeGraph JSON object:
{ "version": "1.0.0", "project": { "name": "<projectName>", "languages": ["<languages>"], "frameworks": ["<frameworks>"], "description": "<projectDescription>", "analyzedAt": "<ISO 8601 timestamp>", "gitCommitHash": "<commit hash from Phase 0>" }, "nodes": [<all merged nodes from Phase 3>], "edges": [<all merged edges from Phase 3>], "layers": [<layers from Phase 4>], "tour": [<steps from Phase 5>] }
-
Write the assembled graph to
.$PROJECT_ROOT/.understand-anything/intermediate/assembled-graph.json -
Dispatch the graph-reviewer agent with this prompt:
Validate the knowledge graph at
. Project root:$PROJECT_ROOT/.understand-anything/intermediate/assembled-graph.json
Read the file and validate it for completeness and correctness. Write output to:$PROJECT_ROOT$PROJECT_ROOT/.understand-anything/intermediate/review.json -
After the agent completes, read
.$PROJECT_ROOT/.understand-anything/intermediate/review.json -
If
:approved: false- Review the
listissues - Apply automated fixes where possible:
- Remove edges with dangling references
- Fill missing required fields with sensible defaults (e.g., empty
->tags
, empty["untagged"]
->summary
)"No summary available" - Remove nodes with invalid types
- If critical issues remain after one fix attempt, save the graph anyway but include the warnings in the final report
- Review the
-
If
: Proceed to Phase 7.approved: true
Phase 7 — SAVE
-
Write the final knowledge graph to
.$PROJECT_ROOT/.understand-anything/knowledge-graph.json -
Write metadata to
:$PROJECT_ROOT/.understand-anything/meta.json{ "lastAnalyzedAt": "<ISO 8601 timestamp>", "gitCommitHash": "<commit hash>", "version": "1.0.0", "analyzedFiles": <number of files analyzed> } -
Clean up intermediate files:
rm -rf $PROJECT_ROOT/.understand-anything/intermediate -
Report a summary to the user containing:
- Project name and description
- Files analyzed / total files
- Nodes created (broken down by type: file, function, class)
- Edges created (broken down by type)
- Layers identified (with names)
- Tour steps generated (count)
- Any warnings from the reviewer
- Path to the output file:
$PROJECT_ROOT/.understand-anything/knowledge-graph.json
-
Automatically launch the dashboard by invoking the
skill./understand-dashboard
Error Handling
- If any agent dispatch fails, retry once with the same prompt plus additional context about the failure.
- If it fails a second time, skip that phase and continue with partial results.
- ALWAYS save partial results — a partial graph is better than no graph.
- Report any skipped phases or errors in the final summary so the user knows what happened.
- NEVER silently drop errors. Every failure must be visible in the final report.
Reference: KnowledgeGraph Schema
Node Types
| Type | Description | ID Convention |
|---|---|---|
| Source file | |
| Function or method | |
| Class, interface, or type | |
| Logical module or package | |
| Abstract concept or pattern | |
Edge Types (18 total)
| Category | Types |
|---|---|
| Structural | , , , , |
| Behavioral | , , , |
| Data flow | , , , |
| Dependencies | , , |
| Semantic | , |
Edge Weight Conventions
| Edge Type | Weight |
|---|---|
| 1.0 |
, | 0.9 |
, | 0.8 |
| 0.7 |
| 0.6 |
| 0.5 |
| All others | 0.5 (default) |