본문으로 건너뛰기
Skillpedia
일반 코딩29k · #9768

codegraph

하는 일

이 스킬은 코드베이스의 색인을 만들고, 어떤 함수를 누가 호출하는지나 가장 위험한 코드가 어디인지 같은 구조적 질문에 답하는 데 씁니다. 큰 프로젝트를 이해하고 싶은 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓함수를 누가 호출하고 무엇에 의존하는지 알아야 할 때.
  • ✓프로젝트에서 죽은 코드, 핫스팟, 모듈 결합도를 찾고 싶을 때.
  • ✓변경을 하기 전에 그 변경이 무엇에 영향을 주는지 알고 싶은 경우.

스킬 링크

https://github.com/QwenLM/qwen-code/blob/main/.qwen/skills/codegraph/SKILL.md

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

사용 방법

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

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

Use this skill to help me: https://github.com/QwenLM/qwen-code/blob/main/.qwen/skills/codegraph/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에서 그대로 가져왔습니다.

CodeScope Q&A

CodeScope indexes source code into a two-layer knowledge graph — structure (functions, calls, imports, classes, modules) and evolution (commits, file changes, function modifications) — plus semantic embeddings for every function. Supports Python, JavaScript/TypeScript, C, and Java (including Hadoop-scale repositories with 8K+ files). This combination enables analyses that grep, LSP, or pure vector search cannot do alone. It can also fetch GitHub issues and trace bugs to code, and review open PRs — scoring per-PR risk, detecting cross-PR conflicts, identifying auto-merge candidates, and applying GitHub labels.

When to Use This Skill

  • User asks about call chains, callers, callees, or dependencies
  • User wants to find dead code, hotspots, or architectural layers
  • User asks about code history, who changed what, or why something was modified
  • User wants to find semantically similar functions across a codebase
  • User wants a full architecture analysis or report
  • User asks about module coupling, circular dependencies, or bridge functions
  • User wants to index or analyze a Java project (Maven, Gradle, plain Java)
  • User wants to analyze GitHub issues or bug reports to find root causes
  • User asks "why does this project have so many bugs" or "what code is most buggy"
  • User wants to trace a bug report to the most relevant code locations
  • User asks about class relationships, ownership, composition, or wants a class diagram / UML
  • User wants to understand which classes own or depend on other classes
  • User wants to review PRs, assess PR risk, or prioritize PR reviews
  • User asks about cross-PR conflicts or which PRs can be merged independently
  • User wants to find auto-merge candidates or generate a PR review report
  • User asks about the blast radius or impact scope of a PR
  • User wants to apply labels to PRs from analysis results
  • User wants to explore PR-specific follow-up questions for a given PR
  • A .codegraph directory (or similar index) exists in the workspace

Getting Started

Installation

pip install codegraph-ai

Environment Variables (optional)

# Create Python virtural environment
python -m venv .venv

source .venv/bin/activate

# Point to a pre-built database (skip indexing)
export CODESCOPE_DB_DIR="/path/to/.linux_db"

# Offline mode for HuggingFace models
export HF_HUB_OFFLINE="1"

# Fallback when HuggingFace is unreachable (e.g., network issues in China)
# Use HF mirror or ModelScope for sentence-transformers models:
export HF_ENDPOINT="https://hf-mirror.com"
# https://www.modelscope.cn/models/sentence-transformers/all-MiniLM-L6-v2

Check Index Status

codegraph status --db $CODESCOPE_DB_DIR

If no index exists, create one:

codegraph init --repo . --lang auto --commits 500

Supported languages: python, c, javascript, typescript, java, or auto (auto-detects from file extensions).

The --commits flag ingests git history (for evolution queries). Without it, only structural analysis is available. Add --backfill-limit 200 to also compute function-level MODIFIES edges (slower but enables change_attribution and co_change).

To add git history to an existing index (without re-indexing structure):

codegraph ingest --repo . --db $CODESCOPE_DB_DIR --commits 500
codegraph ingest --repo . --db $CODESCOPE_DB_DIR --backfill-limit 200   # add MODIFIES edges only

Two Interfaces: CLI vs Python

Use the CLI for status and reports:

codegraph status --db $CODESCOPE_DB_DIR
codegraph analyze --db $CODESCOPE_DB_DIR --output report.md

Use the Python API for queries and custom analyses:

import os
os.environ['HF_HUB_OFFLINE'] = '1'  # required

from codegraph.core import CodeScope
cs = CodeScope(os.environ['CODESCOPE_DB_DIR'])

# Cypher query
rows = list(cs.conn.execute('''
    MATCH (caller:Function)-[:CALLS]->(f:Function {name: "free_irq"})
    RETURN caller.name, caller.file_path LIMIT 10
'''))
for r in rows:
    print(r)

cs.close()  # always close when done

The Python API is more powerful — it gives you raw Cypher access and lets you chain queries.

Core Python API

Raw Queries

These are the building blocks for any custom analysis:

Method What it does
자주 묻는 질문

어떤 언어를 지원하나요?

Python, JavaScript, TypeScript, C, Java를 지원합니다.

영향 분석이란 무엇인가요?

호출 그래프를 바탕으로 변경에 의해 영향을 받을 수 있는 다른 코드를 보여 줍니다.

의미로 코드를 검색할 수 있나요?

네, 벡터 색인을 사용해 의미상 비슷한 함수를 찾을 수 있습니다.

상세 정보

작성자의 원본 설명

Analyze indexed codebases via graph database (neug) and vector index (zvec). Covers call graphs, dependencies, dead code, hotspots, module coupling, architecture reports, semantic search, impact analysis, bug root cause from GitHub issues, class diagrams (UML), and PR review (risk scoring, conflict detection, auto-merge candidates, labeling). Also covers creating, inspecting, and repairing a CodeScope index. Use for: code structure, who calls what, why something changed, similar functions, module boundaries, bug tracing, class relationships, PR risk/conflicts, or any question benefiting from a

repo: QwenLM/qwen-code

인기도

GitHub 스타
29k
순위
#9768
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬