Skip to main content
The /understand-explain command focuses the knowledge graph on a single file or function and produces a detailed explanation: what it does, why it exists, how data flows through it, which other components it interacts with, and any language patterns or design decisions worth noting. Use it when you need to truly understand a specific module before modifying it, during code review, or when onboarding to an unfamiliar part of the system.

Usage

# Explain a file
/understand-explain <path>

# Explain a specific function within a file
/understand-explain <path>:<function-name>

Arguments

ArgumentDescription
<path>Relative path to a source file (e.g. src/auth/login.ts)
<path>:<function-name>Path combined with a function or class name to target a specific node (e.g. src/auth/login.ts:validateToken)

How it works

1

Locate the target node

The path is matched against the knowledge graph. If a path:name format is provided, it first looks for a node with that exact file path and name. If not found, it falls back to matching by file path alone.
2

Collect child nodes

All nodes contained inside the target (via contains edges) are gathered — for a file node this includes all its functions and classes; for a class node this includes its methods.
3

Find connected components

All 1-hop neighbors of the target and its children are collected: importers, callees, dependencies, and related nodes. The full set of relevant edges is recorded.
4

Resolve architectural layer

The layer that contains the target node is identified and included in the explanation.
5

Generate the deep-dive

The assembled context is passed to the LLM with instructions to explain: what the component does, how data flows through it, how it interacts with connected components, any notable patterns or design decisions, and potential gotchas.

Output

A structured explanation that covers:
  • Type and complexity — node type (file, function, class) and complexity rating
  • Location — file path and line range
  • Plain-English summary — what the component does and why it exists
  • Architectural layer — where it sits in the system
  • Internal components — child functions, methods, or classes
  • Connected components — callers, imports, dependencies with relationship types
  • Relationships — edge-level view of all connections (calls, imports, depends_on, etc.)
  • Language notes — programming patterns, idioms, or concepts present in the component
If the path is not found in the knowledge graph, the command will say so and suggest running /understand first or checking the exact file path.

Examples

# Explain an entire file
/understand-explain src/auth/login.ts

# Explain a specific function
/understand-explain src/auth/login.ts:validateToken

# Explain a class
/understand-explain src/services/payment.service.ts:PaymentService

# Explain a utility module
/understand-explain src/utils/crypto.ts

# Explain a React component
/understand-explain src/components/UserProfile.tsx
Use path:name format to target a specific function when a file contains many components. This gives a tighter, more focused explanation than explaining the whole file.

/understand-chat

Ask free-form questions about how components relate to each other.

/understand-diff

See the blast radius when you modify this component.

/understand-dashboard

Visualize the component and its connections in the interactive graph.

/understand

Build or update the graph so new files are available for explanation.

Build docs developers (and LLMs) love