kg-extract
Skill này làm gì
Skill này đọc các file mã nguồn và biến lớp, hàm, module thành một bản đồ về cách chúng liên quan. Nó dành cho lập trình viên cần hiểu cấu trúc của codebase và thay đổi có thể lan đến đâu.
Khi nào nên dùng
- ✓Khi bạn muốn hiểu các phần của codebase phụ thuộc lẫn nhau thế nào.
- ✓Khi bạn cần đánh giá một thay đổi có thể ảnh hưởng xa đến đâu.
- ✓Khi bạn muốn làm mới bản đồ mã sau những thay đổi lớn.
Liên kết skill
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-knowledge-graph/skills/kg-extract/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy lập bản đồ các phần chính của dự án và cách chúng phụ thuộc vào nhau.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill đọc các file mã nguồn, nhận diện lớp, hàm, module và kiểu, rồi ghi lại cách chúng liên quan, như qua import và kế thừa. Kết quả được lưu thành đồ thị trong kho bộ nhớ của dự án.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Import chỉ dùng kiểu có được tính là liên kết lúc chạy không?
Không. Import chỉ dùng cho kiểu được giữ như một quan hệ yếu hơn và không dùng để phát hiện vòng lặp.
Những quan hệ nào được ghi lại?
Import, extends, implements và depends-on, mỗi quan hệ có một trọng số.
Đồ thị được lưu ở đâu?
Nó được lưu trong AgentDB, kho bộ nhớ mà skill sử dụng.
Chi tiết
Mô tả gốc của tác giả
Extract entities and relations from source files to build a knowledge graph
repo: ruvnet/ruflo
Độ phổ biến
- Sao GitHub
- 81k
- Vị trí xếp hạng
- #1639
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agent-adaptive-coordinator
81kGiúp agent của bạn chia và cân bằng lại một nhóm agent AI khi khối lượng công việc thay đổi, chọn bố cục phù hợp với tác vụ.
agent-agent
81kDạy agent của bạn biến một mục tiêu lớn thành kế hoạch hành động có thứ tự, và lập lại kế hoạch khi điều kiện thay đổi.
agent-agentic-payments
81kGiúp agent của bạn quản lý ủy quyền chi tiêu cho mua sắm bằng AI, với hạn mức chi, khung thời gian, quy tắc người bán và phê duyệt có chữ ký.
agent-analyze-code-quality
81kGiúp agent của bạn rà soát chất lượng mã, tìm code smell, nợ kỹ thuật và gợi ý tái cấu trúc mà không thay đổi các file.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.