Code Knowledge Graph logo

Code Knowledge Graph

Community
vibeeval
code-knowledge-graph

Codebase'i knowledge graph olarak analiz et. Dependency, call graph, hotspot analizi.

Overview

Publishervibeeval
Repositoryvibecosystem
Skill namecode-knowledge-graph
Stars
533
Forks
44
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by vibeeval on GitHub. Read the source before you install it.

Installation

Install the Code Knowledge Graph AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/vibeeval/vibecosystem/tree/main/skills/code-knowledge-graph
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vibeeval/vibecosystem.git /tmp/vibecosystem
mkdir -p .claude/skills
cp -r /tmp/vibecosystem/skills/code-knowledge-graph .claude/skills/code-knowledge-graph
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Code Knowledge Graph in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Code Knowledge Graph on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Code Knowledge Graph is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Code Knowledge Graph - Codebase Graph Analysis

Codebase'i knowledge graph olarak modeller. Dosya, modul, fonksiyon ve class'lar node; import, call, inheritance ve composition iliskileri edge olur. Sonuc: Mermaid diagram + JSON graph data.

Neden Knowledge Graph?

Kod text degil, graph'tir. Her dosya diger dosyalara baglidir. Bu baglantilari anlamadan:

  • Refactoring yaparken neyi kiracagini bilemezsin
  • Dead code'u guvenle silemezsin
  • Yeni feature'in nereye oturacagini gormezsin
  • Circular dependency'lerin kokunu bulamazsin

Knowledge graph tum bu iliskileri gorsellestirir ve olculebilir yapar.

Kullanim

/code-knowledge-graph [hedef-dizin] [--focus module] [--depth N] [--format mermaid|json|both]

Ornekler

bash
# Tum codebase analizi
/code-knowledge-graph src/

# Belirli module odaklan
/code-knowledge-graph src/ --focus auth

# Sadece circular dependency kontrolu
/code-knowledge-graph src/ --focus circular

# Hotspot analizi
/code-knowledge-graph src/ --focus hotspots

# Orphan/dead code tespiti
/code-knowledge-graph src/ --focus orphans

Graph Olusturma Adimlari

Adim 1: Node Discovery

bash
# Dosya agaci
tldr tree ${PATH:-src/} --ext .py

# Kod yapisi: fonksiyonlar, class'lar, export'lar
tldr structure ${PATH:-src/} --lang python

Her dosya, class, fonksiyon ve export bir node olur.

Adim 2: Edge Extraction

bash
# Dosyanin import'lari (outgoing edges)
tldr imports ${FILE}

# Modulu kim import ediyor? (incoming edges)
tldr importers ${MODULE} ${PATH:-src/}

# Cross-file call graph
tldr calls ${PATH:-src/}

Her import ve fonksiyon cagrisi bir directed edge olur.

Adim 3: Layer Detection

bash
# Architectural layer analizi
tldr arch ${PATH:-src/}

Node'lar 3 katmana ayrilir:

KatmanTanimOrnekler
EntryDisaridan cagirilan, ici cagirmayanroutes, cli, main, handlers
MiddleHem cagrilan hem cagirirservices, business logic
LeafCagirilan ama baskasini cagirmayanutils, helpers, constants

Adim 4: Impact Analysis

bash
# Bu fonksiyona kim bagimli?
tldr impact ${FUNCTION} ${PATH:-src/} --depth 3

# Dead code: hicbir yerden cagrilmayan fonksiyonlar
tldr dead ${PATH:-src/}

Adim 5: codebase-memory MCP Entegrasyonu

codebase-memory MCP kuruluysa, persistent graph sorgusu yap:

mcp: index_status       -> Repo index durumu
mcp: index_repository   -> Repo'yu indexle (yoksa)
mcp: query_graph        -> Graph sorgusu (iliskiler)
mcp: search_graph       -> Pattern arama
mcp: get_architecture   -> Mimari genel bakis
mcp: trace_call_path    -> Fonksiyonlar arasi cagri yolu

MCP, session'lar arasi kalici graph verisi saglar. tldr ise anlik taze analiz verir. Ikisini birlikte kullan.

Dependency Analysis Pattern'leri

Direct Dependencies

A dogrudan B'yi import ediyor:

A --import--> B

Transitive Dependencies

A, B'yi import ediyor, B de C'yi import ediyor. A, C'ye transitif bagimli:

A --import--> B --import--> C
A ....transitif....> C

Transitive dependency chain'i uzadikca risk artar. tldr impact ile transitif zincirleri gor.

Fan-In vs Fan-Out

MetrikYuksek Degerin AnlamiRisk
Fan-In (in-degree)Cok modul buna bagimliFragile - degisiklik cascade yapar
Fan-Out (out-degree)Bu modul cok seye bagimliUnstable - disaridan kirilabilir

Hedef: Leaf node'larda yuksek fan-in (iyi - utility), entry node'larda yuksek fan-out (kotu - god module).

Circular Dependency Cozme Stratejileri

Circular dependency = A imports B, B imports A (dogrudan veya transitif).

Strateji 1: Extract Interface

ONCE: A <--> B (circular)
SONRA: A --> IB <-- B (interface ile decouple)

Her iki modul de bir interface'e bagimli olur, birbirine degil.

Strateji 2: Dependency Inversion

ONCE: A --> B --> A (circular)
SONRA: A --> B, A <-- C (C yeni modul, B'nin A'ya ihtiyac duydugu kismi tasir)

Strateji 3: Extract Shared Module

ONCE: A <--> B (ortak kod paylasiyor)
SONRA: A --> Shared <-- B (ortak kod ayri module)

Strateji 4: Event-Based Decoupling

ONCE: A --> B --> A (geri cagri)
SONRA: A --> EventBus <-- B (event ile haberlesme)

Hangi Stratejiyi Sec?

DurumStrateji
Type/interface paylasimiExtract Interface
Fonksiyon geri cagrisiDependency Inversion
Ortak utility koduExtract Shared Module
Async bildirim ihtiyaciEvent-Based Decoupling

Hotspot Analizi ve Refactoring Onceliklendirme

Hotspot = Graph'ta en cok baglantisi olan node.

Hotspot Skorlama

hotspot_score = (in_degree * 2) + out_degree + (change_frequency * 3)
  • in_degree * 2: Bagimli modul sayisi (en onemli - cascade risk)
  • out_degree: Bagimlilik sayisi (kirilganlik)
  • change_frequency * 3: Git log'dan degisiklik sikligi (degisen hotspot = en tehlikeli)

Refactoring Oncelik Matrisi

Hotspot TipiOncelikAksiyon
Yuksek in-degree + sik degisenP0 CRITICALHemen split et, test ekle
Yuksek in-degree + stabilP2 MEDIUMTest ekle, dikkatli degistir
Yuksek out-degreeP1 HIGHDependency'leri azalt, facade pattern
Yuksek her ikisiP0 CRITICALGod module - parcala

Change Frequency Analizi

bash
# Git log'dan en cok degisen dosyalar
git log --format=format: --name-only --since="6 months ago" | sort | uniq -c | sort -rn | head -20

Cok degisen + cok baglantili = en yuksek risk.

Mermaid Diagram Ornekleri

Dependency Graph (Layered)

Call Graph

Circular Dependency (Highlighted)

Hotspot Visualization

Graph-Based Code Review

Knowledge graph review'da su sorulari cevaplar:

  1. Impact sorusu: "Bu degisiklik kac modulu etkiler?"

    bash
    tldr impact changed_function src/ --depth 3
  2. Coupling sorusu: "Bu yeni import cycle yaratir mi?"

    • Mevcut graph'a yeni edge ekle, cycle kontrol et
  3. Cohesion sorusu: "Bu modul cok mu fazla is yapiyor?"

    • Out-degree > 8 ise muhtemelen evet
  4. Dead code sorusu: "Bu fonksiyon gercekten kullaniliyor mu?"

    bash
    tldr impact function_name src/

Onboarding Icin Graph Kullanimi

Yeni developer'a codebase'i tanitmak icin:

  1. Buyuk resim: Layer diagram'i goster (entry/middle/leaf)
  2. Kritik yollar: En onemli call chain'leri goster
  3. Hotspot'lar: "Bu dosyalara dokunurken dikkatli ol" listesi
  4. Moduller: Her modulu 1 cumle ile acikla + bagimliliklari goster

Architectural Decision Support

Graph verisi mimari kararlari destekler:

KararGraph Verisi
"Bu modulu bolmeli miyiz?"In-degree + out-degree + LOC
"Microservice siniri nerede?"Cluster analizi (yuksek ic baglantilar, dusuk dis baglantilar)
"Hangi modulu once refactor edelim?"Hotspot score siralamasina bak
"Yeni feature nereye oturur?"Mevcut layer'a ve dependency pattern'ine bak
"Bu dependency guvenli mi?"Transitif dependency chain'ine bak

tldr CLI Komut Referansi

KomutKullanimCikti
tldr tree [path]Dosya agaciJSON
tldr structure [path] --lang XKod yapisi (codemaps)JSON
tldr calls [path]Cross-file call graphJSON
tldr impact <func> [path]Reverse call graphJSON
tldr dead [path]Dead/orphan codeJSON
tldr arch [path]Layer detectionJSON
tldr imports <file>Dosyanin import'lariJSON
tldr importers <module> [path]Modulu kim import ediyorJSON

JSON Graph Data Formati

json
{
  "metadata": {
    "project": "project-name",
    "analyzed_at": "2026-03-26T10:00:00Z",
    "total_nodes": 45,
    "total_edges": 128,
    "languages": ["python"]
  },
  "nodes": [
    {
      "id": "src/auth/service.py::AuthService",
      "type": "class",
      "file": "src/auth/service.py",
      "layer": "middle",
      "in_degree": 5,
      "out_degree": 3,
      "is_hotspot": true,
      "is_orphan": false
    }
  ],
  "edges": [
    {
      "source": "src/routes.py::handle_login",
      "target": "src/auth/service.py::AuthService.authenticate",
      "type": "call"
    }
  ],
  "layers": {
    "entry": [],
    "middle": [],
    "leaf": []
  },
  "circular_dependencies": [],
  "hotspots": [],
  "orphans": []
}

Iliskili Araclar

AracNe Zaman
graph-analyst agentTam graph analizi, otomatik rapor
tldr archHizli layer detection
tldr callsHizli call graph
codebase-memory MCPPersistent graph, session arasi sorgulama
/explore architectureGenel mimari kesfetme
architect agentGraph verisiyle mimari karar
janitor agentOrphan/dead code temizligi

Frequently asked questions

What does the Code Knowledge Graph AI skill do?

Codebase'i knowledge graph olarak analiz et. Dependency, call graph, hotspot analizi.

Why use Code Knowledge Graph on TypingMind?

Because you install it once and use it with any model. Code Knowledge Graph is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Code Knowledge Graph in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/vibeeval/vibecosystem/tree/main/skills/code-knowledge-graph. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Code Knowledge Graph?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Code Knowledge Graph?

As many as you like. As long as a model supports skills, you can use Code Knowledge Graph with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Code Knowledge Graph AI skill free?

Yes. It is published on GitHub by vibeeval under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇