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
fix(understand): address PR #47 review — edge types, validator guards, prompt accuracy
Lum110436e7ad8c6e3a
diff --git a/understand-anything-plugin/skills/understand/SKILL.md b/understand-anything-plugin/skills/understand/SKILL.mdindex 0514988d..cee167a6 100644--- a/understand-anything-plugin/skills/understand/SKILL.md+++ b/understand-anything-plugin/skills/understand/SKILL.md@@ -190,7 +190,7 @@ Pass these parameters in the dispatch prompt:>> File nodes:> ```json-> [list of {id, filePath, summary, tags} for all file-type nodes — omit name, complexity, languageNotes]+> [list of {id, name, filePath, summary, tags} for all file-type nodes — omit complexity, languageNotes]> ```>> Import edges:@@ -366,7 +366,9 @@ try {});const fileNodes = graph.nodes.filter(n => n.type === 'file').map(n => n.id);const assigned = new Map();- (graph.layers || []).forEach(layer => {+ if (!Array.isArray(graph.layers)) { if (graph.layers) warnings.push('graph.layers is not an array'); graph.layers = []; }+ if (!Array.isArray(graph.tour)) { if (graph.tour) warnings.push('graph.tour is not an array'); graph.tour = []; }+ graph.layers.forEach(layer => {(layer.nodeIds || []).forEach(id => {if (!nodeIds.has(id)) issues.push(`Layer '${layer.id}' refs missing node '${id}'`);if (assigned.has(id)) issues.push(`Node '${id}' appears in multiple layers`);@@ -376,7 +378,7 @@ try {fileNodes.forEach(id => {if (!assigned.has(id)) issues.push(`File node '${id}' not in any layer`);});- (graph.tour || []).forEach((step, i) => {+ graph.tour.forEach((step, i) => {(step.nodeIds || []).forEach(id => {if (!nodeIds.has(id)) issues.push(`Tour step[${i}] refs missing node '${id}'`);});@@ -391,8 +393,8 @@ try {const stats = {totalNodes: graph.nodes.length,totalEdges: graph.edges.length,- totalLayers: (graph.layers || []).length,- tourSteps: (graph.tour || []).length,+ totalLayers: graph.layers.length,+ tourSteps: graph.tour.length,nodeTypes: graph.nodes.reduce((a, n) => { a[n.type] = (a[n.type]||0)+1; return a; }, {}),edgeTypes: graph.edges.reduce((a, e) => { a[e.type] = (a[e.type]||0)+1; return a; }, {})};diff --git a/understand-anything-plugin/skills/understand/file-analyzer-prompt.md b/understand-anything-plugin/skills/understand/file-analyzer-prompt.mdindex 7873d0a9..26df55f6 100644--- a/understand-anything-plugin/skills/understand/file-analyzer-prompt.md+++ b/understand-anything-plugin/skills/understand/file-analyzer-prompt.md@@ -317,14 +317,14 @@ Use these hints to improve tag and edge accuracy for common patterns. Your train|---|---|| React component renders another component in its JSX | `contains` from parent to child || Component/hook calls a custom hook (`useX`) | `depends_on` from consumer to hook file |-| Context provider wraps components | `publishes` from provider to context definition |-| Component calls `useContext` or custom context hook | `subscribes` from consumer to context definition |+| Context provider wraps components | `exports` from provider to context definition |+| Component calls `useContext` or custom context hook | `depends_on` from consumer to context definition || Python file uses `from x import y` where x is a project file | `imports` edge (same rule as JS/TS) || Go file `import`s an internal package path | `imports` edge to the resolved file |## Critical Constraints-- NEVER invent file paths. Every `filePath` and every file reference in node IDs must correspond to a real file from the script's output or the project file list provided to you.+- NEVER invent file paths. Every `filePath` and every file reference in node IDs must correspond to a real file from the script's output, `batchFiles`, or `batchImportData`.- NEVER create edges to nodes that do not exist. Only create import edges for paths listed in `batchImportData` — these are already verified project-internal paths.- ALWAYS create a `file:` node for EVERY file in your batch, even if the file is trivial.- Only create `function:` and `class:` nodes for significant code elements (see significance filter above).diff --git a/understand-anything-plugin/skills/understand/project-scanner-prompt.md b/understand-anything-plugin/skills/understand/project-scanner-prompt.mdindex 8084433f..8febcc87 100644--- a/understand-anything-plugin/skills/understand/project-scanner-prompt.md+++ b/understand-anything-plugin/skills/understand/project-scanner-prompt.md@@ -115,7 +115,7 @@ For each file, read its content and extract import paths using language-appropri| Language | Import patterns to match ||---|---|| TypeScript/JavaScript | `import ... from './...'` or `'../'`, `require('./...')` or `require('../...')` |-| Python | `from .x import y`, `from ..x import y`, `import .x` (relative only) |+| Python | `from .x import y`, `from ..x import y`, `from . import x` (relative only) || Go | Paths in `import (...)` blocks that start with the module path from `go.mod` || Rust | `use crate::`, `use super::`, `mod x` (within the same crate) || Java/Kotlin | Not resolvable by path — skip import resolution for these languages |