Skillpedia
التحليل وجداول البيانات81k · #1639

kg-extract

ما الذي تفعله

تقرأ هذه المهارة ملفات المصدر وتحوّل الأصناف والدوال والوحدات إلى خريطة توضح علاقاتها. وهي مناسبة للمطورين الذين يحتاجون إلى فهم بنية قاعدة الكود وكيف قد تنتشر التغييرات.

متى تستخدمها

  • ✓عندما تريد فهم كيف تعتمد أجزاء قاعدة الكود على بعضها.
  • ✓عندما تحتاج إلى تقدير مدى تأثير تغيير ما.
  • ✓عندما تريد تحديث خريطة الكود بعد تغييرات كبيرة.

رابط المهارة

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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-knowledge-graph/skills/kg-extract/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“ارسم الأجزاء الرئيسية في مشروعي وكيف يعتمد بعضها على بعض.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تقرأ المهارة ملفات المصدر وتحدد الأصناف والدوال والوحدات والأنواع، ثم تسجل كيف ترتبط، مثل الاستيرادات والوراثة. وتخزن النتيجة كرسم بياني في مخزن الذاكرة الذي تستخدمه، وهو AgentDB.

المحتوى التقني (ملف 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

  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
الأسئلة الشائعة

هل تُحسب استيرادات الأنواع فقط كروابط وقت تشغيل؟

لا. تُحفظ استيرادات الأنواع كعلاقة أضعف، ولا تُستخدم في كشف الحلقات الدائرية.

ما العلاقات المسجلة؟

علاقات الاستيراد والتوسيع والتنفيذ والاعتماد، ولكل منها وزن.

أين يُحفظ الرسم البياني؟

في AgentDB، وهو مخزن الذاكرة الذي تستخدمه المهارة.

التفاصيل

الوصف الأصلي من المؤلف

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

repo: ruvnet/ruflo

الشعبية

نجوم GitHub
81k
الترتيب
#1639
الترخيص
MIT
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة