Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
feat(skill): add smart graph reading protocol to query skills
Lum110400d9919ba310
diff --git a/understand-anything-plugin/skills/understand-chat/SKILL.md b/understand-anything-plugin/skills/understand-chat/SKILL.mdindex 58e0c57e..cfe3bb4c 100644--- a/understand-anything-plugin/skills/understand-chat/SKILL.md+++ b/understand-anything-plugin/skills/understand-chat/SKILL.md@@ -8,11 +8,46 @@ argument-hint: [query]Answer questions about this codebase using the knowledge graph at `.understand-anything/knowledge-graph.json`.+## Graph Structure Reference++The knowledge graph JSON has this structure:+- `project` — {name, description, languages, frameworks, analyzedAt, gitCommitHash}+- `nodes[]` — each has {id, type, name, filePath, summary, tags[], complexity, languageNotes?}+ - Node types: file, function, class, module, concept+ - IDs: `file:path`, `func:path:name`, `class:path:name`+- `edges[]` — each has {source, target, type, direction, weight}+ - Key types: imports, contains, calls, depends_on+- `layers[]` — each has {id, name, description, nodeIds[]}+- `tour[]` — each has {order, title, description, nodeIds[]}++## How to Read Efficiently++1. Use Grep to search within the JSON for relevant entries BEFORE reading the full file+2. Only read sections you need — don't dump the entire graph into context+3. Node names and summaries are the most useful fields for understanding+4. Edges tell you how components connect — follow imports and calls for dependency chains+## Instructions-1. Read the knowledge graph file at `.understand-anything/knowledge-graph.json` in the current project root-2. If the file doesn't exist, tell the user to run `/understand` first to analyze the project-3. Use the knowledge graph context to answer the user's query: "$ARGUMENTS"-4. Reference specific files, functions, and relationships from the graph-5. If the project has layers defined, explain which layer(s) are relevant-6. Be concise but thorough -- link concepts to actual code locations+1. Check that `.understand-anything/knowledge-graph.json` exists in the current project root. If not, tell the user to run `/understand` first.++2. **Read project metadata only** — use Grep or Read with a line limit to extract just the `"project"` section from the top of the file for context (name, description, languages, frameworks).++3. **Search for relevant nodes** — use Grep to search the knowledge graph file for the user's query keywords: "$ARGUMENTS"+ - Search `"name"` fields: `grep -i "query_keyword"` in the graph file+ - Search `"summary"` fields for semantic matches+ - Search `"tags"` arrays for topic matches+ - Note the `id` values of all matching nodes++4. **Find connected edges** — for each matched node ID, Grep for that ID in the `edges` section to find:+ - What it imports or depends on (downstream)+ - What calls or imports it (upstream)+ - This gives you the 1-hop subgraph around the query++5. **Read layer context** — Grep for `"layers"` to understand which architectural layers the matched nodes belong to.++6. **Answer the query** using only the relevant subgraph:+ - Reference specific files, functions, and relationships from the graph+ - Explain which layer(s) are relevant and why+ - Be concise but thorough — link concepts to actual code locations+ - If the query doesn't match any nodes, say so and suggest related terms from the graphdiff --git a/understand-anything-plugin/skills/understand-diff/SKILL.md b/understand-anything-plugin/skills/understand-diff/SKILL.mdindex eae9dbb4..33adbfaf 100644--- a/understand-anything-plugin/skills/understand-diff/SKILL.md+++ b/understand-anything-plugin/skills/understand-diff/SKILL.md@@ -7,21 +7,51 @@ description: Use when you need to analyze git diffs or pull requests to understaAnalyze the current code changes against the knowledge graph at `.understand-anything/knowledge-graph.json`.+## Graph Structure Reference++The knowledge graph JSON has this structure:+- `project` — {name, description, languages, frameworks, analyzedAt, gitCommitHash}+- `nodes[]` — each has {id, type, name, filePath, summary, tags[], complexity, languageNotes?}+ - Node types: file, function, class, module, concept+ - IDs: `file:path`, `func:path:name`, `class:path:name`+- `edges[]` — each has {source, target, type, direction, weight}+ - Key types: imports, contains, calls, depends_on+- `layers[]` — each has {id, name, description, nodeIds[]}+- `tour[]` — each has {order, title, description, nodeIds[]}++## How to Read Efficiently++1. Use Grep to search within the JSON for relevant entries BEFORE reading the full file+2. Only read sections you need — don't dump the entire graph into context+3. Node names and summaries are the most useful fields for understanding+4. Edges tell you how components connect — follow imports and calls for dependency chains+## Instructions-1. Read the knowledge graph file at `.understand-anything/knowledge-graph.json` in the current project root-2. If the file doesn't exist, tell the user to run `/understand` first-3. Get the current diff:+1. Check that `.understand-anything/knowledge-graph.json` exists. If not, tell the user to run `/understand` first.++2. **Get the changed files list** (do NOT read the graph yet):- If on a branch with uncommitted changes: `git diff --name-only`- If on a feature branch: `git diff main...HEAD --name-only` (or the base branch)- If the user specifies a PR number: get the diff from that PR-4. For each changed file, identify:- - Which nodes in the knowledge graph correspond to that file- - Which other nodes are connected (imports, calls, depends_on, etc.)- - Which architectural layers are affected-5. Provide a structured analysis:- - **Changed Components**: What was directly modified- - **Affected Components**: What might be impacted by the changes- - **Affected Layers**: Which architectural layers are touched- - **Risk Assessment**: Complexity, cross-layer impact, blast radius-6. Suggest what to review carefully and any potential issues++3. **Read project metadata only** — use Grep or Read with a line limit to extract just the `"project"` section for context.++4. **Find nodes for changed files** — for each changed file path, use Grep to search the knowledge graph for:+ - Nodes with matching `"filePath"` values (e.g., `grep "changed/file/path"`)+ - This finds file nodes AND function/class nodes defined in those files+ - Note the `id` values of all matched nodes++5. **Find connected edges (1-hop)** — for each matched node ID, Grep for that ID in the edges to find:+ - What imports or depends on the changed nodes (upstream callers)+ - What the changed nodes import or call (downstream dependencies)+ - These are the "affected components" — things that might break or need updating++6. **Identify affected layers** — Grep for the matched node IDs in the `"layers"` section to determine which architectural layers are touched.++7. **Provide structured analysis**:+ - **Changed Components**: What was directly modified (with summaries from matched nodes)+ - **Affected Components**: What might be impacted (from 1-hop edges)+ - **Affected Layers**: Which architectural layers are touched and cross-layer concerns+ - **Risk Assessment**: Based on node `complexity` values, number of cross-layer edges, and blast radius (number of affected components)+ - Suggest what to review carefully and any potential issuesdiff --git a/understand-anything-plugin/skills/understand-explain/SKILL.md b/understand-anything-plugin/skills/understand-explain/SKILL.mdindex 2044f299..78d68019 100644--- a/understand-anything-plugin/skills/understand-explain/SKILL.md+++ b/understand-anything-plugin/skills/understand-explain/SKILL.md@@ -8,17 +8,49 @@ argument-hint: [file-path]Provide a thorough, in-depth explanation of a specific code component.+## Graph Structure Reference++The knowledge graph JSON has this structure:+- `project` — {name, description, languages, frameworks, analyzedAt, gitCommitHash}+- `nodes[]` — each has {id, type, name, filePath, summary, tags[], complexity, languageNotes?}+ - Node types: file, function, class, module, concept+ - IDs: `file:path`, `func:path:name`, `class:path:name`+- `edges[]` — each has {source, target, type, direction, weight}+ - Key types: imports, contains, calls, depends_on+- `layers[]` — each has {id, name, description, nodeIds[]}+- `tour[]` — each has {order, title, description, nodeIds[]}++## How to Read Efficiently++1. Use Grep to search within the JSON for relevant entries BEFORE reading the full file+2. Only read sections you need — don't dump the entire graph into context+3. Node names and summaries are the most useful fields for understanding+4. Edges tell you how components connect — follow imports and calls for dependency chains+## Instructions-1. Read the knowledge graph file at `.understand-anything/knowledge-graph.json`-2. If it doesn't exist, tell the user to run `/understand` first-3. Find the component matching the path: "$ARGUMENTS"- - Supports file paths: `src/auth/login.ts`- - Supports function notation: `src/auth/login.ts:verifyToken`-4. Analyze the component in context:+1. Check that `.understand-anything/knowledge-graph.json` exists. If not, tell the user to run `/understand` first.++2. **Find the target node** — use Grep to search the knowledge graph for the component: "$ARGUMENTS"+ - For file paths (e.g., `src/auth/login.ts`): search for `"filePath"` matches+ - For function notation (e.g., `src/auth/login.ts:verifyToken`): search for the function name in `"name"` fields filtered by the file path+ - Note the exact node `id`, `type`, `summary`, `tags`, and `complexity`++3. **Find all connected edges** — Grep for the target node's ID in the edges section:+ - `"source"` matches → things this node calls/imports/depends on (outgoing)+ - `"target"` matches → things that call/import/depend on this node (incoming)+ - Note the connected node IDs and edge types++4. **Read connected nodes** — for each connected node ID from step 3, Grep for those IDs in the nodes section to get their `name`, `summary`, and `type`. This builds the component's neighborhood.++5. **Identify the layer** — Grep for the target node's ID in the `"layers"` section to find which architectural layer it belongs to and that layer's description.++6. **Read the actual source file** — Read the source file at the node's `filePath` for the deep-dive analysis.++7. **Explain the component in context**:- Its role in the architecture (which layer, why it exists)- - Internal structure (functions, classes it contains)- - External connections (what it imports, what calls it, what it depends on)- - Data flow (inputs -> processing -> outputs)-5. Explain clearly, assuming the reader may not know the programming language-6. Highlight any patterns, idioms, or complexity worth understanding+ - Internal structure (functions, classes it contains — from `contains` edges)+ - External connections (what it imports, what calls it, what it depends on — from edges)+ - Data flow (inputs → processing → outputs — from source code)+ - Explain clearly, assuming the reader may not know the programming language+ - Highlight any patterns, idioms, or complexity worth understandingdiff --git a/understand-anything-plugin/skills/understand-onboard/SKILL.md b/understand-anything-plugin/skills/understand-onboard/SKILL.mdindex 708970c8..ec4b67d8 100644--- a/understand-anything-plugin/skills/understand-onboard/SKILL.md+++ b/understand-anything-plugin/skills/understand-onboard/SKILL.md@@ -7,17 +7,47 @@ description: Use when you need to generate an onboarding guide for new team membGenerate a comprehensive onboarding guide from the project's knowledge graph.+## Graph Structure Reference++The knowledge graph JSON has this structure:+- `project` — {name, description, languages, frameworks, analyzedAt, gitCommitHash}+- `nodes[]` — each has {id, type, name, filePath, summary, tags[], complexity, languageNotes?}+ - Node types: file, function, class, module, concept+ - IDs: `file:path`, `func:path:name`, `class:path:name`+- `edges[]` — each has {source, target, type, direction, weight}+ - Key types: imports, contains, calls, depends_on+- `layers[]` — each has {id, name, description, nodeIds[]}+- `tour[]` — each has {order, title, description, nodeIds[]}++## How to Read Efficiently++1. Use Grep to search within the JSON for relevant entries BEFORE reading the full file+2. Only read sections you need — don't dump the entire graph into context+3. Node names and summaries are the most useful fields for understanding+4. Edges tell you how components connect — follow imports and calls for dependency chains+## Instructions-1. Read the knowledge graph at `.understand-anything/knowledge-graph.json`-2. If it doesn't exist, tell the user to run `/understand` first-3. Generate a structured onboarding guide that includes:- - Project overview (name, languages, frameworks, description)- - Architecture layers and their responsibilities- - Key concepts to understand- - Guided tour (step-by-step walkthrough)- - File map (what each key file does)- - Complexity hotspots (what to be careful with)-4. Format as clean markdown-5. Offer to save the guide to `docs/ONBOARDING.md` in the project-6. Suggest the user commit it to the repo for the team+1. Check that `.understand-anything/knowledge-graph.json` exists. If not, tell the user to run `/understand` first.++2. **Read project metadata** — use Grep or Read with a line limit to extract the `"project"` section (name, description, languages, frameworks).++3. **Read layers** — Grep for `"layers"` to get the full layers array. These define the architecture and will structure the guide.++4. **Read the tour** — Grep for `"tour"` to get the guided walkthrough steps. These provide the recommended learning path.++5. **Read file-level nodes only** — use Grep to find nodes with `"type": "file"` in the knowledge graph. Skip function-level and class-level nodes to keep the guide high-level. Extract each file node's `name`, `filePath`, `summary`, and `complexity`.++6. **Identify complexity hotspots** — from the file-level nodes, find those with the highest `complexity` values. These are areas new developers should approach carefully.++7. **Generate the onboarding guide** with these sections:+ - **Project Overview**: name, languages, frameworks, description (from project metadata)+ - **Architecture Layers**: each layer's name, description, and key files (from layers + file nodes)+ - **Key Concepts**: important patterns and design decisions (from node summaries and tags)+ - **Guided Tour**: step-by-step walkthrough (from the tour section)+ - **File Map**: what each key file does (from file-level nodes, organized by layer)+ - **Complexity Hotspots**: areas to approach carefully (from complexity values)++8. Format as clean markdown+9. Offer to save the guide to `docs/ONBOARDING.md` in the project+10. Suggest the user commit it to the repo for the teamdiff --git a/understand-anything-plugin/skills/understand/SKILL.md b/understand-anything-plugin/skills/understand/SKILL.mdindex 17f836bc..7a97ce25 100644--- a/understand-anything-plugin/skills/understand/SKILL.md+++ b/understand-anything-plugin/skills/understand/SKILL.md@@ -185,9 +185,7 @@ If the reviewer reports `approved: false`:- Path to the output file4. Tell the user how to view the dashboard:```- To view your codebase dashboard, clone the Understand Anything repo and run:- pnpm install && pnpm dev:dashboard- The dashboard auto-detects .understand-anything/knowledge-graph.json from the project root.+ To view your dashboard, run: /understand-dashboard```## Error Handling