deepinit by yeachan-heo/oh-my-claudecode
npx skills add https://github.com/yeachan-heo/oh-my-claudecode --skill deepinit在整个代码库中创建全面、层次化的 AGENTS.md 文档。
AGENTS.md 文件作为 AI 可读的文档,帮助智能体理解:
每个 AGENTS.md 文件(根目录除外)都包含一个父级引用标签:
<!-- Parent: ../AGENTS.md -->
这创建了一个可导航的层次结构:
/AGENTS.md ← 根目录(无父标签)
├── src/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
│ ├── src/components/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
│ └── src/utils/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
└── docs/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
<!-- Parent: {relative_path_to_parent}/AGENTS.md -->
<!-- Generated: {timestamp} | Updated: {timestamp} -->
# {目录名称}
## 目的
{一段描述此目录包含内容及其作用的文字}
## 关键文件
{列出每个重要文件并附上一行描述}
| 文件 | 描述 |
|------|-------------|
| `file.ts` | 用途简述 |
## 子目录
{列出每个子目录及其简要目的}
| 目录 | 目的 |
|-----------|---------|
| `subdir/` | 包含内容(参见 `subdir/AGENTS.md`) |
## 对于 AI 智能体
### 在此目录工作
{AI 智能体修改此处文件的特殊说明}
### 测试要求
{如何测试此目录的更改}
### 常见模式
{此处使用的代码模式或约定}
## 依赖关系
### 内部
{此部分依赖的代码库其他部分的引用}
### 外部
{使用的主要外部包/库}
<!-- MANUAL: 此行以下手动添加的注释在重新生成时会保留 -->
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Task(subagent_type="explore", model="haiku",
prompt="递归列出所有目录。排除:node_modules, .git, dist, build, __pycache__, .venv, coverage, .next, .nuxt")
为每个目录生成待办事项,按深度级别组织:
Level 0: / (根目录)
Level 1: /src, /docs, /tests
Level 2: /src/components, /src/utils, /docs/api
...
重要提示:先生成父级,再生成子级,以确保父级引用有效。
对于每个目录:
当 AGENTS.md 已存在时:
<!-- MANUAL -->)生成后,运行验证检查:
| 检查项 | 如何验证 | 纠正措施 |
|---|---|---|
| 父级引用可解析 | 读取每个 AGENTS.md,检查 <!-- Parent: --> 路径是否存在 | 修复路径或删除孤立文件 |
| 无孤立的 AGENTS.md | 比较 AGENTS.md 位置与目录结构 | 删除孤立文件 |
| 完整性 | 列出所有目录,检查是否有 AGENTS.md | 生成缺失的文件 |
| 时间戳最新 | 检查 <!-- Generated: --> 日期 | 重新生成过时的文件 |
验证脚本模式:
# 查找所有 AGENTS.md 文件
find . -name "AGENTS.md" -type f
# 检查父级引用
grep -r "<!-- Parent:" --include="AGENTS.md" .
| 任务 | 智能体 |
|---|---|
| 目录映射 | explore |
| 文件分析 | architect |
| 内容生成 | writer |
| AGENTS.md 写入 | writer |
当遇到空目录或接近空的目录时:
| 条件 | 操作 |
|---|---|
| 无文件,无子目录 | 跳过 - 不创建 AGENTS.md |
| 无文件,有子目录 | 创建仅包含子目录列表的最小化 AGENTS.md |
| 仅包含生成文件 (*.min.js, *.map) | 跳过或创建最小化 AGENTS.md |
| 仅包含配置文件 | 创建描述配置目的的 AGENTS.md |
仅包含目录的容器的最小化 AGENTS.md 示例:
<!-- Parent: ../AGENTS.md -->
# {目录名称}
## 目的
用于组织相关模块的容器目录。
## 子目录
| 目录 | 目的 |
|-----------|---------|
| `subdir/` | 描述(参见 `subdir/AGENTS.md`) |
<!-- Generated: 2024-01-15 | Updated: 2024-01-15 -->
# my-project
## 目的
一个用于管理用户任务并具有实时协作功能的 Web 应用程序。
## 关键文件
| 文件 | 描述 |
|------|-------------|
| `package.json` | 项目依赖项和脚本 |
| `tsconfig.json` | TypeScript 配置 |
| `.env.example` | 环境变量模板 |
## 子目录
| 目录 | 目的 |
|-----------|---------|
| `src/` | 应用程序源代码(参见 `src/AGENTS.md`) |
| `docs/` | 文档(参见 `docs/AGENTS.md`) |
| `tests/` | 测试套件(参见 `tests/AGENTS.md`) |
## 对于 AI 智能体
### 在此目录工作
- 修改项目清单后始终安装依赖项
- 使用 TypeScript 严格模式
- 遵循 ESLint 规则
### 测试要求
- 提交前运行测试
- 确保覆盖率 >80%
### 常见模式
- 使用桶导出 (index.ts)
- 优先使用函数式组件
## 依赖关系
### 外部
- React 18.x - UI 框架
- TypeScript 5.x - 类型安全
- Vite - 构建工具
<!-- MANUAL: 自定义项目注释可以添加在下方 -->
<!-- Parent: ../AGENTS.md -->
<!-- Generated: 2024-01-15 | Updated: 2024-01-15 -->
# components
## 目的
按功能和复杂性组织的可复用 React 组件。
## 关键文件
| 文件 | 描述 |
|------|-------------|
| `index.ts` | 所有组件的桶导出 |
| `Button.tsx` | 主要按钮组件 |
| `Modal.tsx` | 模态对话框组件 |
## 子目录
| 目录 | 目的 |
|-----------|---------|
| `forms/` | 表单相关组件(参见 `forms/AGENTS.md`) |
| `layout/` | 布局组件(参见 `layout/AGENTS.md`) |
## 对于 AI 智能体
### 在此目录工作
- 每个组件都有自己的文件
- 使用 CSS 模块进行样式设置
- 通过 index.ts 导出
### 测试要求
- 单元测试在 `__tests__/` 子目录中
- 使用 React Testing Library
### 常见模式
- 在组件上方定义 Props 接口
- 对暴露 DOM 的组件使用 forwardRef
## 依赖关系
### 内部
- `src/hooks/` - 组件使用的自定义钩子
- `src/utils/` - 工具函数
### 外部
- `clsx` - 条件类名
- `lucide-react` - 图标
<!-- MANUAL: -->
在已存在 AGENTS.md 文件的现有代码库上运行时:
每周安装次数
169
仓库
GitHub 星标
11.2K
首次出现
2026年1月22日
安全审计
安装于
opencode154
claude-code151
codex147
gemini-cli146
cursor143
github-copilot134
Creates comprehensive, hierarchical AGENTS.md documentation across the entire codebase.
AGENTS.md files serve as AI-readable documentation that helps agents understand:
Every AGENTS.md (except root) includes a parent reference tag:
<!-- Parent: ../AGENTS.md -->
This creates a navigable hierarchy:
/AGENTS.md ← Root (no parent tag)
├── src/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
│ ├── src/components/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
│ └── src/utils/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
└── docs/AGENTS.md ← <!-- Parent: ../AGENTS.md -->
<!-- Parent: {relative_path_to_parent}/AGENTS.md -->
<!-- Generated: {timestamp} | Updated: {timestamp} -->
# {Directory Name}
## 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: Any manually added notes below this line are preserved on regeneration -->
Task(subagent_type="explore", model="haiku",
prompt="List all directories recursively. Exclude: node_modules, .git, dist, build, __pycache__, .venv, coverage, .next, .nuxt")
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
...
IMPORTANT : Generate parent levels before child levels to ensure parent references are valid.
For each directory:
When AGENTS.md already exists:
<!-- MANUAL --> preserved)After generation, run validation checks:
| Check | How to Verify | Corrective Action |
|---|---|---|
| Parent references resolve | Read each AGENTS.md, check <!-- Parent: --> path exists | Fix path or remove orphan |
| No orphaned AGENTS.md | Compare AGENTS.md locations to directory structure | Delete orphaned files |
| Completeness | List all directories, check for AGENTS.md | Generate missing files |
| Timestamps current | Check <!-- Generated: --> dates | Regenerate outdated files |
Validation script pattern:
# Find all AGENTS.md files
find . -name "AGENTS.md" -type f
# Check parent references
grep -r "<!-- Parent:" --include="AGENTS.md" .
| Task | Agent |
|---|---|
| Directory mapping | explore |
| File analysis | architect |
| Content generation | writer |
| AGENTS.md writes | writer |
When encountering empty or near-empty directories:
| Condition | Action |
|---|---|
| No files, no subdirectories | Skip - do not create AGENTS.md |
| No files, has subdirectories | Create minimal AGENTS.md with subdirectory listing only |
| Has only generated files (*.min.js, *.map) | Skip or minimal AGENTS.md |
| Has only config files | Create AGENTS.md describing configuration purpose |
Example minimal AGENTS.md for directory-only containers:
<!-- Parent: ../AGENTS.md -->
# {Directory Name}
## Purpose
Container directory for organizing related modules.
## Subdirectories
| Directory | Purpose |
|-----------|---------|
| `subdir/` | Description (see `subdir/AGENTS.md`) |
<!-- Generated: 2024-01-15 | Updated: 2024-01-15 -->
# my-project
## Purpose
A web application for managing user tasks with real-time collaboration features.
## Key Files
| File | Description |
|------|-------------|
| `package.json` | Project dependencies and scripts |
| `tsconfig.json` | TypeScript configuration |
| `.env.example` | Environment variable template |
## Subdirectories
| Directory | Purpose |
|-----------|---------|
| `src/` | Application source code (see `src/AGENTS.md`) |
| `docs/` | Documentation (see `docs/AGENTS.md`) |
| `tests/` | Test suites (see `tests/AGENTS.md`) |
## For AI Agents
### Working In This Directory
- Always install dependencies after modifying the project manifest
- Use TypeScript strict mode
- Follow ESLint rules
### Testing Requirements
- Run tests before committing
- Ensure >80% coverage
### Common Patterns
- Use barrel exports (index.ts)
- Prefer functional components
## Dependencies
### External
- React 18.x - UI framework
- TypeScript 5.x - Type safety
- Vite - Build tool
<!-- MANUAL: Custom project notes can be added below -->
<!-- Parent: ../AGENTS.md -->
<!-- Generated: 2024-01-15 | Updated: 2024-01-15 -->
# components
## Purpose
Reusable React components organized by feature and complexity.
## Key Files
| File | Description |
|------|-------------|
| `index.ts` | Barrel export for all components |
| `Button.tsx` | Primary button component |
| `Modal.tsx` | Modal dialog component |
## Subdirectories
| Directory | Purpose |
|-----------|---------|
| `forms/` | Form-related components (see `forms/AGENTS.md`) |
| `layout/` | Layout components (see `layout/AGENTS.md`) |
## For AI Agents
### Working In This Directory
- Each component has its own file
- Use CSS modules for styling
- Export via index.ts
### Testing Requirements
- Unit tests in `__tests__/` subdirectory
- Use React Testing Library
### Common Patterns
- Props interfaces defined above component
- Use forwardRef for DOM-exposing components
## Dependencies
### Internal
- `src/hooks/` - Custom hooks used by components
- `src/utils/` - Utility functions
### External
- `clsx` - Conditional class names
- `lucide-react` - Icons
<!-- MANUAL: -->
When running on an existing codebase with AGENTS.md files:
Weekly Installs
169
Repository
GitHub Stars
11.2K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode154
claude-code151
codex147
gemini-cli146
cursor143
github-copilot134
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
63,800 周安装
数据库优化器专家指南:现代性能调优、查询优化与可扩展架构设计
153 周安装
Angular RxJS 模式实战指南:掌握异步操作与响应式编程
153 周安装
XLSX 生成器 - 自动化 Excel 报表生成与模板处理工具 (Deno)
153 周安装
TanStack Query v5 性能优化指南:40条最佳实践提升应用性能
153 周安装
JSON 转视频工具 - 使用 Remotion 渲染器将 JSON 时间线规范转换为动态视频
153 周安装
Slack 代理开发指南:Chat SDK 与 Bolt for JavaScript 框架选择与部署教程
153 周安装