본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트81k · #1639

kg-extract

하는 일

이 스킬은 소스 파일을 읽고 클래스, 함수, 모듈을 서로 어떻게 관련되는지 보여 주는 지도로 바꿉니다. 코드베이스의 구조와 변경이 어디까지 퍼질지 이해해야 하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓코드베이스의 부분들이 서로 어떻게 의존하는지 알고 싶을 때.
  • ✓변경이 얼마나 멀리 영향을 줄지 판단해야 할 때.
  • ✓큰 변경 후 코드 지도를 새로 고치고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-knowledge-graph/skills/kg-extract/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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

  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
자주 묻는 질문

타입 전용 가져오기도 런타임 연결로 세나요?

아닙니다. 타입 전용 가져오기는 더 약한 관계로 남기며, 순환 탐지에는 쓰지 않습니다.

어떤 관계를 기록하나요?

가져오기, extends, implements, depends-on 관계이며, 각각 가중치가 있습니다.

그래프는 어디에 저장되나요?

스킬이 쓰는 메모리 저장소인 AgentDB에 저장됩니다.

상세 정보

작성자의 원본 설명

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

repo: ruvnet/ruflo

인기도

GitHub 스타
81k
순위
#1639
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬