Langsung ke konten
Skillpedia
Analisis & spreadsheet81k Β· #1639

kg-extract

Fungsinya

Skill ini membaca berkas sumber dan mengubah kelas, fungsi, serta modul menjadi peta tentang bagaimana semuanya berhubungan. Skill ini untuk pengembang yang perlu memahami struktur codebase dan seberapa jauh perubahan bisa menyebar.

Kapan dipakai

  • βœ“Saat Anda ingin memahami bagaimana bagian-bagian codebase saling bergantung.
  • βœ“Saat Anda perlu menilai seberapa jauh sebuah perubahan bisa menjangkau.
  • βœ“Saat Anda ingin menyegarkan peta kode setelah perubahan besar.

Link skill

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-knowledge-graph/skills/kg-extract/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-knowledge-graph/skills/kg-extract/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œPetakan bagian-bagian utama proyek saya dan bagaimana mereka saling bergantung.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill membaca berkas sumber, mengidentifikasi kelas, fungsi, modul, dan tipe, lalu mencatat bagaimana mereka berhubungan, misalnya lewat impor dan pewarisan. Hasilnya disimpan sebagai graf di memori proyek.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

  1. Scan files -- use Glob and Read to enumerate and read source files at the given path

  2. Identify entities -- extract classes, functions, modules, types, and config references from each file

  3. Map relations -- for each entity, determine its relations to other entities. Critical: TypeScript import type and inline type specifiers (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(...)) -- weight 0.9
    • type-depends-on: TypeScript type-only imports (import type { Foo } from '...' and import { type Foo, value } from '...') -- weight 0.1, never used for cycle detection or runtime impact analysis
    • extends: class inheritance -- weight 0.9
    • implements: interface implementations -- weight 0.7
    • depends-on: constructor dependencies, injected services -- weight 0.8
    • calls: function/method invocations -- weight 0.7
    • references: documentation mentions, comments -- weight 0.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)
    
  4. Store in AgentDB -- call mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store for each entity with metadata (name, type, file, line, description)

  5. Create edges -- call mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge for each relation with source, target, relation type, and weight

  6. Report -- 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
Pertanyaan umum

Apakah impor khusus tipe dihitung sebagai keterkaitan runtime?

Tidak. Impor khusus tipe disimpan sebagai relasi yang lebih lemah dan tidak dipakai untuk deteksi siklus.

Relasi apa saja yang dicatat?

Impor, extends, implements, dan depends-on, masing-masing dengan bobotnya.

Di mana graf disimpan?

Graf disimpan di AgentDB, memori yang dipakai skill ini.

Detail

Deskripsi asli dari pembuat

Extract entities and relations from source files to build a knowledge graph

repo: ruvnet/ruflo

Popularitas

Bintang GitHub
81k
Peringkat
#1639
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa