kg-extract
できること
このスキルは、ソースファイルを読み、クラス、関数、モジュールを、それらの関係を示す地図に変換します。コードベースの構造と、変更がどこまで広がりうるかを理解したい開発者向けです。
使う場面
- ✓コードベースの各部分が互いにどう依存しているかを理解したいとき。
- ✓変更がどこまで影響するかを判断する必要があるとき。
- ✓大きな変更の後に、コードの地図を更新したいとき。
スキルのリンク
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-knowledge-graph/skills/kg-extract/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“プロジェクトの主要な部分と、それらの相互の依存関係を地図にしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルはソースファイルを読み、クラス、関数、モジュール、型を特定してから、インポートや継承などを通じてそれらの関係を記録します。結果は、プロジェクトのメモリーストアにグラフとして保存されます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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
よくある質問
型だけのインポートは、実行時のつながりとして数えられますか?
いいえ。型だけのインポートは弱い関係として残され、循環の検出には使われません。
どの関係が記録されますか?
インポート、extends、implements、依存の関係で、それぞれに重みが付きます。
グラフはどこに保存されますか?
スキルが使うメモリーストアである AgentDB に保存されます。
詳細
作者による元の説明
Extract entities and relations from source files to build a knowledge graph
repo: ruvnet/ruflo
人気
- GitHubのスター
- 81k
- ランキング
- #1639
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
agent-adaptive-coordinator
81k作業量の変化に合わせて、エージェントのグループを分割し、再配分する手助けをします。作業に合った配置を選びます。
agent-agent
81k大きな目標を順番に並んだ行動計画にし、状況が変わったときに計画を立て直す方法をエージェントに教えます。
agent-agentic-payments
81kAIの買い物のために、支出の上限、期間、販売店のルール、署名付きの承認を含む支出の委任を管理する手助けをします。
agent-analyze-code-quality
81kコードの品質を確認し、コードの臭い、技術的負債、リファクタリングの案を見つける手助けをします。ファイルは変更しません。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。