重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
data-structure-protocol by sickn33/antigravity-awesome-skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill data-structure-protocolLLM 编码代理在任务之间会丢失上下文。在大型代码库上,它们会将大部分令牌消耗在“定位”上——弄清楚东西在哪里、什么依赖什么以及什么可以安全更改。DSP 通过将项目的结构图外部化,存储到代码旁边 .dsp/ 目录中的一个持久化、可查询的图中来解决这个问题。
DSP 不是供人类阅读的文档,也不是 AST 转储。它捕获三样东西:含义(实体为何存在)、边界(它导入和暴露什么)以及原因(每个连接为何存在)。这足以让代理在不将整个源代码树加载到上下文窗口的情况下进行导航、重构和生成代码。
在以下情况下使用此技能:
.dsp/ 目录(DSP 已设置).dsp 或结构映射DSP 将代码库建模为一个有向图。节点是实体,边是导入和共享/导出。
存在两种实体类型:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
每个实体都有一个稳定的 UID:对象为 obj-<8hex>,函数为 func-<8hex>。文件路径是可以改变的属性;UID 在重命名、移动和重新格式化后保持不变。
对于文件内部的实体,UID 通过源代码中的注释标记锚定:
// @dsp func-7f3a9c12
export function calculateTotal(items) { ... }
# @dsp obj-e5f6g7h8
class UserService:
记录导入时,DSP 会存储一个简短的原因,解释该依赖关系为何存在。它位于被导入实体的 exports/ 反向索引中。没有原因的依赖图告诉你什么导入了什么;原因告诉你什么可以安全更改以及谁会受到影响。
每个实体在 .dsp/ 下都有一个小的目录:
.dsp/
├── TOC # 从根目录开始的所有实体 UID 有序列表
├── obj-a1b2c3d4/
│ ├── description # 源路径、种类、目的(1-3 句话)
│ ├── imports # 此实体依赖的 UID(每行一个)
│ ├── shared # 公共 API / 导出实体的 UID
│ └── exports/ # 反向索引:谁导入了此实体及原因
│ ├── <importer_uid> # 文件内容 = "原因" 文本
│ └── <shared_uid>/
│ ├── description # 导出的是什么
│ └── <importer_uid> # 为何导入此特定导出
└── func-7f3a9c12/
├── description
├── imports
└── exports/
所有内容都是纯文本。可比较差异。可审查。无需数据库。
任何地方导入的每个文件或工件都必须在 .dsp 中表示为一个对象——代码、图像、样式、配置、JSON、wasm,一切。外部依赖(npm 包、标准库等)被记录为 kind: external,但其内部结构从不分析。
此技能依赖于一个独立的 Python CLI 脚本 dsp-cli.py。如果项目中缺少该脚本,请下载:
curl -O https://raw.githubusercontent.com/k-kolomeitsev/data-structure-protocol/main/skills/data-structure-protocol/scripts/dsp-cli.py
需要 Python 3.10+。所有命令都使用 python dsp-cli.py --root <project-root> <command>。
如果 .dsp/ 为空,则通过导入的深度优先搜索从根入口点遍历项目:
package.json 的 main、框架入口、main.py 等)create-object,为每个导出 create-function,create-shared,为所有依赖项 add-importcreate-object --kind external,添加到 TOC,但绝不深入 node_modules/site-packages/等。search、find-by-source 或 read-toc 查找受影响的实体。阅读它们的 description 和 imports 以理解上下文。create-object。对于每个导出的函数——create-function(带 --owner)。通过 create-shared 注册导出。why 的 add-import。对于外部依赖——如果实体不存在,首先 create-object --kind external。remove-import、remove-shared、remove-entity。级联清理是自动的。move-entity。UID 不变。| 类别 | 命令 |
|---|---|
| 创建 | init, create-object, create-function, create-shared, add-import |
| 更新 | update-description, update-import-why, move-entity |
| 删除 | remove-import, remove-shared, remove-entity |
| 导航 | get-entity, get-children --depth N, get-parents --depth N, get-path, get-recipients, read-toc |
| 搜索 | search <query>, find-by-source <path> |
| 诊断 | detect-cycles, get-orphans, get-stats |
| 代码变更 | DSP 操作 |
|---|---|
| 新文件/模块 | create-object + create-function + create-shared + add-import |
| 新增导入 | add-import(+ 如果是新依赖则 create-object --kind external) |
| 移除导入 | remove-import |
| 新增导出 | create-shared(+ 如果是新函数则 create-function) |
| 移除导出 | remove-shared |
| 文件重命名/移动 | move-entity |
| 文件删除 | remove-entity |
| 目的更改 | update-description |
| 仅内部更改 | 无需更新 DSP |
python dsp-cli.py --root . init
python dsp-cli.py --root . create-object "src/app.ts" "Main application entrypoint"
# Output: obj-a1b2c3d4
python dsp-cli.py --root . create-function "src/app.ts#start" "Starts the HTTP server" --owner obj-a1b2c3d4
# Output: func-7f3a9c12
python dsp-cli.py --root . create-shared obj-a1b2c3d4 func-7f3a9c12
python dsp-cli.py --root . add-import obj-a1b2c3d4 obj-deadbeef "HTTP routing"
python dsp-cli.py --root . search "authentication"
python dsp-cli.py --root . get-entity obj-a1b2c3d4
python dsp-cli.py --root . get-children obj-a1b2c3d4 --depth 2
python dsp-cli.py --root . get-recipients obj-a1b2c3d4
python dsp-cli.py --root . get-path obj-a1b2c3d4 func-7f3a9c12
python dsp-cli.py --root . find-by-source "lodash"
# Output: obj-11223344
python dsp-cli.py --root . get-recipients obj-11223344
# 显示每个导入 lodash 的模块及其原因——让你系统地替换它
why 原因——这是 DSP 大部分价值所在kind: external,而不分析其内部结构.dsp/ 差异视为代码差异——审查它们,保持其准确性.dsp/move-entity)此技能自然连接到:
每周安装数
47
代码仓库
GitHub 星标数
29.5K
首次出现
2026年2月24日
安全审计
安装于
codex46
opencode46
gemini-cli45
github-copilot45
amp45
kimi-cli45
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.
Use this skill when:
.dsp/ directory (DSP is already set up).dsp, or structure mappingDSP models the codebase as a directed graph. Nodes are entities , edges are imports and shared/exports.
Two entity kinds exist:
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:
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.
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.
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.
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>.
If .dsp/ is empty, traverse the project from root entrypoint(s) via DFS on imports:
package.json main, framework entry, main.py, etc.)create-object, create-function for each export, create-shared, add-import for all dependenciescreate-object --kind external, add to TOC, but never descend into node_modules/site-packages/etc.search, find-by-source, or read-toc. Read their description and imports to understand context.create-object. For each exported function — create-function (with --owner). Register exports via create-shared.add-import with a brief . For external deps — first if the entity doesn't exist.| Category | Commands |
|---|---|
| Create | init, create-object, create-function, create-shared, add-import |
| Update | update-description, update-import-why, move-entity |
| Code Change | DSP Action |
|---|---|
| New file/module | create-object + create-function + create-shared + add-import |
| New import added | add-import (+ create-object --kind external if new dep) |
| Import removed | remove-import |
| Export added | create-shared (+ if new) |
python dsp-cli.py --root . init
python dsp-cli.py --root . create-object "src/app.ts" "Main application entrypoint"
# Output: obj-a1b2c3d4
python dsp-cli.py --root . create-function "src/app.ts#start" "Starts the HTTP server" --owner obj-a1b2c3d4
# Output: func-7f3a9c12
python dsp-cli.py --root . create-shared obj-a1b2c3d4 func-7f3a9c12
python dsp-cli.py --root . add-import obj-a1b2c3d4 obj-deadbeef "HTTP routing"
python dsp-cli.py --root . search "authentication"
python dsp-cli.py --root . get-entity obj-a1b2c3d4
python dsp-cli.py --root . get-children obj-a1b2c3d4 --depth 2
python dsp-cli.py --root . get-recipients obj-a1b2c3d4
python dsp-cli.py --root . get-path obj-a1b2c3d4 func-7f3a9c12
python dsp-cli.py --root . find-by-source "lodash"
# Output: obj-11223344
python dsp-cli.py --root . get-recipients obj-11223344
# Shows every module that imports lodash and WHY — lets you systematically replace it
why reason when recording an import — this is where most of DSP's value liveskind: external for third-party libraries without analyzing their internals.dsp/ diffs like code diffs — review them, keep them accurate.dsp/ for internal-only changes that don't affect purpose or dependenciesmove-entity instead)This skill connects naturally to:
Weekly Installs
47
Repository
GitHub Stars
29.5K
First Seen
Feb 24, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
codex46
opencode46
gemini-cli45
github-copilot45
amp45
kimi-cli45
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
127,000 周安装
whycreate-object --kind externalremove-import, remove-shared, remove-entity. Cascade cleanup is automatic.move-entity. UID does not change.remove-import, remove-shared, remove-entity |
| Navigate | get-entity, get-children --depth N, get-parents --depth N, get-path, get-recipients, read-toc |
| Search | search <query>, find-by-source <path> |
| Diagnostics | detect-cycles, get-orphans, get-stats |
create-function| Export removed | remove-shared |
| File renamed/moved | move-entity |
| File deleted | remove-entity |
| Purpose changed | update-description |
| Internal-only change | No DSP update needed |