kg-extract
What it does
This skill reads source files and turns the classes, functions and modules into a map of how they relate. It is for developers who need to understand a codebase's structure and how changes might spread.
When to use it
- ✓When you want to understand how the parts of a codebase depend on each other.
- ✓When you need to judge how far a change could reach.
- ✓When you want to refresh a code map after large changes.
Skill link
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-knowledge-graph/skills/kg-extract/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Map the main parts of my project and how they depend on each other.”
5 new skills a week. 1 minute to read.
How it works
The skill reads the source files, identifies classes, functions, modules and types, then records how they relate, such as through imports and inheritance. It stores the result as a graph in the project's memory store.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
KG Extract
Extract entities (classes, functions, modules, types, concepts) and their relations (imports, extends, implements, depends-on, calls) from source files, then store them as a knowledge graph in AgentDB.
When to use
When you need to build or update a knowledge graph from source code or documentation. Useful for understanding codebase structure, dependency analysis, and impact assessment.
Steps
Scan files -- use
GlobandReadto enumerate and read source files at the given pathIdentify entities -- extract classes, functions, modules, types, and config references from each file
Map relations -- for each entity, determine its relations to other entities. Critical: TypeScript
import typeand inlinetypespecifiers (import { type Foo, bar }) are erased at compile time and MUST NOT be counted as value imports -- they're a separate, weaker relation. Misclassifying them produces phantom runtime cycles (see ruvnet/ruflo#2049).imports: value imports (import { x } from '...',require(...)) -- weight0.9type-depends-on: TypeScript type-only imports (import type { Foo } from '...'andimport { type Foo, value } from '...') -- weight0.1, never used for cycle detection or runtime impact analysisextends: class inheritance -- weight0.9implements: interface implementations -- weight0.7depends-on: constructor dependencies, injected services -- weight0.8calls: function/method invocations -- weight0.7references: documentation mentions, comments -- weight0.3
Regex hint for classifying TS imports (so a naive
from '...'grep doesn't conflate the two):^\s*import\s+type\s+ → type-depends-on (entire import is type-only) ^\s*import\s*\{[^}]*\btype\s+\w+ → split: type specifiers → type-depends-on, value specifiers → imports ^\s*import\s+[^{]*\bfrom\s+ → imports (value)Store in AgentDB -- call
mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-storefor each entity with metadata (name, type, file, line, description)Create edges -- call
mcp__plugin_ruflo-core_ruflo__agentdb_causal-edgefor each relation with source, target, relation type, and weightReport -- summarize: total entities by type, total relations by type, files scanned
CLI alternative
npx @claude-flow/cli@latest memory store --namespace knowledge-graph --key "entity-NAME" --value "METADATA_JSON"
npx @claude-flow/cli@latest memory search --query "entities in auth module" --namespace knowledge-graph
FAQ
Are type-only imports counted as runtime links?
No. Type-only imports are kept as a weaker relation and are not used for cycle detection.
What relations are recorded?
Imports, extends, implements and depends-on relations, each with a weight.
Where is the graph stored?
It is stored in AgentDB, the memory store the skill uses.
Details
Original description by the author
Extract entities and relations from source files to build a knowledge graph
repo: ruvnet/ruflo
Popularity
- GitHub stars
- 81k
- Ranking position
- #1639
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
agent-adaptive-coordinator
81kHelps your agent split and rebalance a group of AI agents as the workload changes, choosing a layout that fits the task.
agent-agent
81kTeaches your agent to turn a big goal into an ordered plan of actions, and to replan when conditions change.
agent-agentic-payments
81kHelps your agent manage spending mandates for AI shopping, with spend caps, time windows, merchant rules and signed approvals.
agent-analyze-code-quality
81kHelps your agent review code for quality, finding code smells, technical debt and refactoring ideas without changing the files.
Similar skills
gitcrawl
394kLets your agent search a saved archive of GitHub issues and pull requests, group duplicates, and check their current status on GitHub.
slacrawl
394kLets your agent search and count messages in a local Slack archive, check how fresh that archive is, and refresh it when needed.
goplaces
394kHelps your agent search for places, get their details and reviews, and resolve place names using Google Places, with JSON output for scripts.