data-structure-protocol
Fungsinya
Alat ini membantu AI memahami struktur proyek kode, bagaimana bagian-bagiannya saling terhubung, dan mengapa bagian tersebut ada. Dengan begitu, AI dapat menavigasi dan mengubah kode dengan lebih efisien tanpa harus membaca ulang semuanya.
Kapan dipakai
- βSaat AI perlu memahami cara sebuah proyek kode diatur.
- βSebelum melakukan perubahan kode besar, untuk mengetahui apa saja yang mungkin terdampak.
- βSaat Anda ingin AI membantu memetakan atau mengatur sebuah proyek.
Link skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/data-structure-protocol/SKILL.mdSalin 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
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBagaimana cara menggunakan DSP untuk memahami ketergantungan antar modul dalam proyek saya?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
DSP mengubah kode menjadi sebuah peta (graph), di mana setiap bagian menjadi 'node' dan hubungannya menjadi 'edge'. Alat ini menyimpan informasi tentang tujuan setiap bagian dan alasan di balik hubungannya, semuanya dalam file teks sederhana.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Data Structure Protocol (DSP)
LLM coding agents lose context between tasks. On large codebases they spend most of their tokens on "orientation" β figuring out where things live, what depends on what, and what is safe to change. DSP solves this by externalizing the project's structural map into a persistent, queryable graph stored in a .dsp/ directory next to the code.
DSP is NOT documentation for humans and NOT an AST dump. It captures three things: meaning (why an entity exists), boundaries (what it imports and exposes), and reasons (why each connection exists). This is enough for an agent to navigate, refactor, and generate code without loading the entire source tree into the context window.
When to Use
Use this skill when:
- The project has a
.dsp/directory (DSP is already set up) - The user asks to set up DSP, bootstrap, or map a project's structure
- Creating, modifying, or deleting code files in a DSP-tracked project (to keep the graph updated)
- Navigating project structure, understanding dependencies, or finding specific modules
- The user mentions DSP, dsp-cli,
.dsp, or structure mapping - Performing impact analysis before a refactor or dependency replacement
Core Concepts
Code = graph
DSP models the codebase as a directed graph. Nodes are entities, edges are imports and shared/exports.
Two entity kinds exist:
- Object: any "thing" that isn't a function (module/file/class/config/resource/external dependency)
- Function: an exported function/method/handler/pipeline
Identity by UID, not by file path
Every entity gets a stable UID: obj-<8hex> for objects, func-<8hex> for functions. File paths are attributes that can change; UIDs survive renames, moves, and reformatting.
For entities inside a file, the UID is anchored with a comment marker in source code:
// @dsp func-7f3a9c12
export function calculateTotal(items) { ... }
# @dsp obj-e5f6g7h8
class UserService:
Every connection has a "why"
When an import is recorded, DSP stores a short reason explaining why that dependency exists. This lives in the exports/ reverse index of the imported entity. A dependency graph without reasons tells you what imports what; reasons tell you what is safe to change and who will break.
Storage format
Each entity gets a small directory under .dsp/:
.dsp/
βββ TOC # ordered list of all entity UIDs from root
βββ obj-a1b2c3d4/
β βββ description # source path, kind, purpose (1-3 sentences)
β βββ imports # UIDs this entity depends on (one per line)
β βββ shared # UIDs of public API / exported entities
β βββ exports/ # reverse index: who imports this and why
β βββ <importer_uid> # file content = "why" text
β βββ <shared_uid>/
β βββ description # what is exported
β βββ <importer_uid> # why this specific export is imported
βββ func-7f3a9c12/
βββ description
βββ imports
βββ exports/
Everything is plain text. Diffable. Reviewable. No database needed.
Full import coverage
Every file or artifact that is imported anywhere must be represented in .dsp as an Object β code, images, styles, configs, JSON, wasm, everything. External dependencies (npm packages, stdlib, etc.) are recorded as kind: external but their internals are never analyzed.
How It Works
Initial Setup
The skill relies on a standalone Python CLI script dsp-cli.py. If it is missing from the project, download it:
curl -O https://raw.githubusercontent.com/k-kolomeitsev/data-structure-protocol/main/skills/data-structure-protocol/scripts/dsp-cli.py
Requires Python 3.10+. All commands use python dsp-cli.py --root <project-root> <command>.
Bootstrap (initial mapping)
If .dsp/ is empty, traverse the project from root entrypoint(s) via DFS on imports:
- Identify root entrypoints (
package.jsonmain, framework entry,main.py, etc.) - Document the root file:
create-object,create-functionfor each export,create-shared,add-importfor all dependencies - Take the first non-external import, document it fully, descend into its imports
- Backtrack when no unvisited local imports remain; continue until all reachable files are documented
- External dependencies:
create-object --kind external, add to TOC, but never descend intonode_modules/site-packages/etc.
β¦
Pertanyaan umum
Apa itu 'graph' dalam konteks ini?
Graph adalah seperti peta koneksi. Bayangkan kota (bagian kode) dan jalan (hubungan). DSP menggunakannya untuk menunjukkan bagaimana bagian-bagian kode Anda saling terhubung.
Mengapa menggunakan UID, bukan path file?
UID (Unique Universal Identifier) seperti nama permanen. Jika Anda mengganti nama atau memindahkan file, UID-nya tidak berubah, sehingga hubungan tetap benar. Path file bisa berubah.
Apa maksud 'setiap koneksi punya alasan'?
Selain mengetahui bahwa satu bagian kode menggunakan bagian lain, DSP juga mencatat alasan di balik hubungan tersebut. Ini membantu AI memahami apakah aman menghapus atau mengubah suatu hubungan tanpa merusak bagian proyek lainnya.
Detail
Deskripsi asli dari pembuat
Give agents persistent structural memory of a codebase β navigate dependencies, track public APIs, and understand why connections exist without re-reading the whole repo.
Popularitas
- Bintang GitHub
- 48k
- Peringkat
- #4326
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- β¦
Skill lain dari repositori ini
00-andruia-consultant
48kMembantu agent Anda memulai atau meningkatkan proyek AI. Agent menganalisis kode, menyarankan tools, dan membuat rencana aksi dalam bahasa Spanyol.
007
48kMemungkinkan agent Anda melakukan audit keamanan dan threat modeling. Berguna untuk melindungi proyek dari serangan dan celah keamanan.
10-andruia-skill-smith
48kMembantu agent Anda membuat atau meningkatkan tools AI. Agent mendefinisikan cara kerja tools, menulis dokumentasi, dan memvalidasi strukturnya.
20-andruia-niche-intelligence
48kMemungkinkan agent Anda membuat ringkasan industri tertentu. Berguna untuk memahami konteks, aturan, pola penggunaan, dan risiko proyek dengan sumber terpercaya.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.