code-import
它能做什么
这个工具会读取现有代码项目的结构,并把它保存为一份有条理的“快照”。这样一来,AI 每次需要分析时就不必把所有文件逐一“翻看”一遍。
适用场景
- ✓当你希望 AI 了解项目结构时。
- ✓为了避免 AI 反复分析你的代码。
- ✓在让 AI 修改或建议修改你的代码之前。
技能链接
https://github.com/nexu-io/open-design/blob/main/plugins/_official/atoms/code-import/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“导入我位于 '/path/to/my/project' 的项目,技术栈为 [React, npm, CSS, Material UI]。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会访问你的项目路径,分析文件,并保存一份整理好的摘要。之后的分析都会用到这份摘要,从而节省时间。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Code import
Spec §10 / §21.3.2: a code-migration / tune-collab run starts from a
real repo (cloned via od project import or a path the user
provided). This atom turns the raw checkout into a normalised
on-disk record that subsequent atoms (design-extract,
rewrite-plan, patch-edit) operate against. The point is to
stop re-walking the tree on every turn — the agent reads
code/index.json once and trusts the snapshot until the next
explicit re-import.
Inputs
| Source | Required | Notes |
|---|---|---|
repoPath |
yes | Absolute path to the repo's root, supplied via od project import or an upstream od.context.assets[] reference |
targetStack |
yes | { framework, packageManager, styleSystem, componentLibrary } via the matching form GenUI surface |
Output
project-cwd/
└── code/
├── index.json # { files: { path, size, language, imports[] }[], packageJson?, lockfileKind, framework, styleSystem }
├── components.json # detected components with file path + props snapshot
├── routes.json # detected routing model (next/app, react-router, vite-router, …)
└── meta.json # { repoPath, gitSha, walkedAt, atomDigest, walkBudgetMs }
code/index.json is the input every other Phase 7 atom reads. The
walk respects the runner's budgetMs option (default 60s) so
large monorepos don't burn an entire run on import.
Convergence
The atom completes when code/index.json exists and contains at
least one entry. Empty repos abort with a clear error event so the
user re-imports.
Anti-patterns the prompt fragment forbids
- Walking node_modules / .git / .next / dist / build (record in
code/index.json.skipped[]with reason). - Inferring a framework from a single file; require at least
package.json's declared dep + a build-config presence (next.config.*,vite.config.*, etc.). - Treating commented-out imports as live edges.
Status
Implemented by the daemon runner in
apps/daemon/src/plugins/atoms/code-import.ts. The walker enforces its
exclusions and time budget, detects framework evidence, and writes
code/index.json.
常见问题
如果项目很大怎么办?
工具对分析项目设有时间上限,即使是大型项目,也能确保不会耗时过长。
AI 会分析 'node_modules' 这类文件夹吗?
不会。AI 会忽略 'node_modules'、'.git' 或 'dist' 等依赖或构建文件夹,只关注相关的代码。
AI 怎么知道我的项目用了什么技术?
AI 会检查 'package.json' 文件和构建配置文件,从中识别框架、包管理器以及其他所用的技术。
详情
作者的原始描述
Read an existing repository's structure into the project cwd as a normalised snapshot the agent can analyse without re-walking the tree on every turn.
repo: nexu-io/open-design
热度
- GitHub 星标
- 101k
- 排名
- #979
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/15
评论
- …