deepinit
它能做什么
这项技能让智能体在代码项目中编写一组文档文件。适合希望 AI 助手从一开始就了解项目结构和规则的团队。
适用场景
- ✓当你希望 AI 助手快速了解一个新的或陌生的代码库的时候。
- ✓当一个大型项目没有任何说明每个文件夹用途的笔记的时候。
- ✓当你希望在项目的每个重要部分都放置文档文件的时候。
技能链接
https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/deepinit/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我们的代码库中设置 AGENTS.md 说明,让以后的 AI 助手了解每个文件夹。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会阅读项目结构,并在每个重要文件夹中写一份简短的说明,并链接到其上级文件夹。每份说明会列出该文件夹包含的内容、各部分之间的联系以及任何特殊规则。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Deep Init Skill
Creates comprehensive, hierarchical AGENTS.md documentation across the entire codebase.
Core Concept
AGENTS.md files serve as AI-readable documentation that helps agents understand:
- What each directory contains
- How components relate to each other
- Special instructions for working in that area
- Dependencies and relationships
Hierarchical Tagging System
Every AGENTS.md (except root) includes a parent reference line:
**Parent context:** `../AGENTS.md`
This MUST be visible prose, never an HTML comment. Claude Code strips HTML
comments before a memory file reaches the model, so <!-- Parent: ... -->,
<!-- Generated: ... --> and a commented MANUAL boundary are invisible to the
agent that is supposed to act on them.
This creates a navigable hierarchy:
/AGENTS.md ← Root (no parent line)
├── src/AGENTS.md ← **Parent context:** `../AGENTS.md`
│ ├── src/components/AGENTS.md ← **Parent context:** `../AGENTS.md`
│ └── src/utils/AGENTS.md ← **Parent context:** `../AGENTS.md`
└── docs/AGENTS.md ← **Parent context:** `../AGENTS.md`
Loading Model
Stock Claude Code discovers nested CLAUDE.md by basename and never loads a
nested AGENTS.md; a root @AGENTS.md import does not reach subdirectories
either. The nested files generated here are delivered by OMC's PostToolUse
directory-context injector, which walks up from each accessed file and injects
the nearest AGENTS.md/README.md once per session.
That means the hierarchy requires OMC's hooks to be active. When OMC hooks are
disabled (DISABLE_OMC=1, OMC_SKIP_HOOKS=post-tool-use) or the plugin is not
registered, add a root-level CLAUDE.md symlink or @AGENTS.md import for the
root file and expect nested files to stay unread.
AGENTS.md Template
# {Directory Name}
**Parent context:** `{relative_path_to_parent}/AGENTS.md`
**Generated:** {timestamp} · **Updated:** {timestamp}
## Purpose
{One-paragraph description of what this directory contains and its role}
## Key Files
{List each significant file with a one-line description}
| File | Description |
|------|-------------|
| `file.ts` | Brief description of purpose |
## Subdirectories
{List each subdirectory with brief purpose}
| Directory | Purpose |
|-----------|---------|
| `subdir/` | What it contains (see `subdir/AGENTS.md`) |
## For AI Agents
### Working In This Directory
{Special instructions for AI agents modifying files here}
### Testing Requirements
{How to test changes in this directory}
### Common Patterns
{Code patterns or conventions used here}
## Dependencies
### Internal
{References to other parts of the codebase this depends on}
### External
{Key external packages/libraries used}
## Manual Notes
Notes under this heading are written by humans and preserved on regeneration.
Execution Workflow
Step 1: Map Directory Structure
Task(subagent_type="explore", model="haiku",
prompt="List all directories recursively. Exclude: node_modules, .git, dist, build, __pycache__, .venv, coverage, .next, .nuxt")
Step 2: Create Work Plan
Generate todo items for each directory, organized by depth level:
Level 0: / (root)
Level 1: /src, /docs, /tests
Level 2: /src/components, /src/utils, /docs/api
...
Step 3: Generate Level by Level
IMPORTANT: Generate parent levels before child levels to ensure parent references are valid.
For each directory:
- Read all files in the directory
- Analyze purpose and relationships
- Generate AGENTS.md content
- Write file with proper parent reference
Step 4: Compare and Update (if exists)
When AGENTS.md already exists:
- Read existing content
- Identify sections:
- Auto-generated sections (can be updated)
- Manual sections (the
## Manual Notesheading and everything under it are preserved)
- Compare:
- New files added?
- Files removed?
- Structure changed?
- Merge:
- Update auto-generated content
- Preserve manual annotations
- Update timestamp
Step 5: Validate Hierarchy
After generation, run validation checks:
| Check | How to Verify | Corrective Action |
|---|---|---|
| Parent references resolve | Read each AGENTS.md, check the **Parent context:** path exists |
Fix path or remove orphan |
| No orphaned AGENTS.md | Compare AGENTS.md locations to directory structure | Delete orpha |
常见问题
这些说明是以隐藏的形式编写的吗?
不是。上级链接是普通的可见文本,因为隐藏的注释无法被 AI 读取到。
它会修改我的代码吗?
它的目的是编写文档文件,所以这些说明会添加在代码旁边。
Claude Code 会自动加载这些文件吗?
标准的 Claude Code 不会自动加载嵌套的 AGENTS.md 文件,因此这项技能是围绕它们如何传递给 AI 来设计的。
详情
作者的原始描述
Deep codebase initialization with hierarchical AGENTS.md documentation
热度
- GitHub 星标
- 41k
- 排名
- #7000
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-doc-discipline
41k教你的智能体编写其他 AI 智能体能够独立遵循的说明,规则可以检验,并且每条规则都附有明确的理由。
ai-slop-cleaner
41k帮你的智能体整理 AI 写出的代码,这些代码能运行但臃肿或重复,在不改变其功能的前提下删除多余部分。
architecture-survey
41k帮你的智能体审查代码库的结构,列出越来越难修改的部分并附上证据,且自身不做任何更改。
ask-navigator
41k帮你的智能体把模糊的项目整理成一张清晰的决策问题图,然后逐个处理,直到路径变得清楚。