Communitygithub.com

deepinit

深度程式碼庫初始化,建立層級式 AGENTS.md 說明文件

deepinit 是什麼?

此技能旨在透過為整個程式碼庫的每個目錄建立「AGENTS.md」檔案,來打造一個完整的 AI 可讀說明文件體系。它會先掃描目錄結構,然後根據一個包含目的、關鍵檔案、子目錄、對 AI 代理的指示以及相依性等區塊的模板,逐層產生文件。每個 AGENTS.md 檔案都包含一個指向其父目錄 AGENTS.md 的註解式連結,形成一個可導航的層級結構。此技能支援智慧委派、平行處理,並能處理既有文件的更新,同時保留手動新增的註解。它對於 Cursor 等依賴文件來理解程式碼脈絡的 AI 代理平台特別有用,可大幅提升開發與協作效率。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Yeachan-Heo/oh-my-claudecode/tree/main/skills/deepinit

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

深度初始化技能

為整個程式碼庫建立完整、層級式的 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 -->

AGENTS.md 模板

<!-- Parent: {relative_path_to_parent}/AGENTS.md -->
<!-- Generated: {timestamp} | Updated: {timestamp} -->

# {Directory Name}

## 用途
{一段說明此目錄內容及其角色的描述}

## 關鍵檔案
{列出每個重要檔案及其簡短說明}

| 檔案 | 說明 |
|------|------|
| `file.ts` | 簡短用途說明 |

## 子目錄
{列出每個子目錄及其簡短用途}

| 目錄 | 用途 |
|------|------|
| `subdir/` | 內容說明(參閱 `subdir/AGENTS.md`) |

## 給 AI 代理

### 在此目錄中工作
{給在此目錄中修改檔案的 AI 代理的特別指示}

### 測試需求
{如何測試此目錄的變更}

### 常見模式
{此處使用的程式碼模式或慣例}

## 相依性

### 內部
{此目錄依賴的程式碼庫其他部分}

### 外部
{使用的主要外部套件/函式庫}

<!-- MANUAL: 任何在手動新增的注意事項,重新產生時將保留在此行下方 -->

執行流程

步驟 1:對應目錄結構

Task(subagent_type="explore", model="haiku",
  prompt="遞迴列出所有目錄。排除:node_modules、.git、dist、build、__pycache__、.venv、coverage、.next、.nuxt")

步驟 2:建立工作計畫

為每個目錄產生待辦事項,按深度層級組織:

Level 0: / (根目錄)
Level 1: /src, /docs, /tests
Level 2: /src/components, /src/utils, /docs/api
...

步驟 3:逐層產生

重要事項:先產生父層級,再產生子層級,以確保父層參考有效。

對每個目錄:

  1. 讀取目錄中的所有檔案
  2. 分析用途與關係
  3. 產生 AGENTS.md 內容
  4. 寫入檔案,並包含正確的父層參考

步驟 4:比較與更新(若已存在)

當 AGENTS.md 已存在時:

  1. 讀取現有內容
  2. 識別區塊:
    • 自動產生的區塊(可更新)
    • 手動區塊(<!-- MANUAL --> 保留)
  3. 比較:
    • 新增了檔案嗎?
    • 移除了檔案嗎?
    • 結構變更了嗎?
  4. 合併:
    • 更新自動產生的內容
    • 保留手動註解
    • 更新時間戳記

步驟 5:驗證層級結構

產生後,執行驗證檢查:

檢查項目驗證方式修正行動
父層參考可解析讀取每個 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 -->
# {Directory Name}

## 用途
用於組織相關模組的容器目錄。

## 子目錄
| 目錄 | 用途 |
|------|------|
| `subdir/` | 說明(參閱 `subdir/AGENTS.md`) |

平行化規則

  1. 同一層級的目錄:平行處理
  2. 不同層級:循序處理(上層先處理)
  3. 大型目錄:為每個目錄產生專屬代理
  4. 小型目錄:多個目錄批次交由同一個代理處理

品質標準

必須包含

  • 準確的檔案說明
  • 正確的父層參考
  • 子目錄連結
  • AI 代理指示

必須避免

  • 通用的樣板文字
  • 錯誤的檔案名稱
  • 損壞的父層參考
  • 遺漏重要檔案

輸出範例

根目錄 AGENTS.md

<!-- Generated: 2024-01-15 | Updated: 2024-01-15 -->

# my-project

## 用途
一個用於管理使用者任務並提供即時協作功能的網頁應用程式。

## 關鍵檔案
| 檔案 | 說明 |
|------|------|
| `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: 自訂專案注意事項可新增至此行下方 -->

巢狀 AGENTS.md

<!-- 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 Modules 進行樣式設定
- 透過 index.ts 匯出

### 測試需求
- 單元測試放在 `__tests__/` 子目錄中
- 使用 React Testing Library

### 常見模式
- Props 介面定義在元件上方
- 對需要直接操作 DOM 的元件使用 forwardRef

## 相依性

### 內部
- `src/hooks/` - 元件使用的自訂 Hook
- `src/utils/` - 工具函式

### 外部
- `clsx` - 條件式 class 名稱
- `lucide-react` - 圖示

<!-- MANUAL: -->

觸發更新模式

在已有 AGENTS.md 檔案的現有程式碼庫上執行時:

  1. 先偵測既有檔案
  2. 讀取並解析既有內容
  3. 分析目前的目錄狀態
  4. 產生既有狀態與目前狀態之間的差異
  5. 套用更新,同時保留手動區塊

效能考量

  • 快取目錄列表 - 不要重複掃描相同目錄
  • 批次處理小型目錄 - 一次處理多個
  • 跳過未變更的目錄 - 若目錄未變更,則跳過重新產生
  • 平行寫入 - 多個代理同時寫入不同檔案

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

agent-doc-discipline

Writing-time discipline for documents agents consume (the five surfaces, specs, tickets, .omc/skills/) — every rule checkable and carrying a why, steps before reference, one meaning in one home, no restating what the environment already says. Mandatory at drydock seed generation and the launch C5 sediment pass; opt-in for any other agent-facing doc edit. The companion of minimal-code-discipline: that one disciplines code, this one disciplines papers.

ai-slop-cleaner

Clean AI-generated code slop with a regression-safe, deletion-first workflow and optional reviewer-only mode

ask

Process-first advisor routing for Claude, Codex, Gemini, Antigravity, Grok, or Cursor via `omc ask`, with artifact capture and no raw CLI assembly

ask-navigator

Shipyard

autopilot

Full autonomous execution from idea to working code

autoresearch

Stateful single-mission improvement loop with strict evaluator contract, markdown decision logs, and max-runtime stop behavior

cancel

Cancel any active OMC mode (autopilot, ralph, ultragoal, swarm, ultrapilot, pipeline, team) and clean up retired legacy state

configure-notifications

Configure notification integrations (Telegram, Discord, Slack) via natural language

debug

Diagnose the current OMC session or repo state using logs, traces, state, and focused reproduction

deep-interview

Socratic deep interview with mathematical ambiguity gating before explicit execution approval

drydock

Lay the keel of the shipyard harness in any repo — the 4-pillar shared environment (Context, Rules, Tools, Standards) across 5 surfaces (CLAUDE.md, skills, design-system, mcp/cli, shared context) so that every human and agent inherits the same design language and anyone can ship. Run once per repo; re-run with --check to audit drift.

execute

Carry an approved task through to working, verified code

external-context

Invoke parallel document-specialist agents for external web searches and documentation lookup

graph

Deterministic orchestration graph runtime - declarative DAG pipelines with journal-based crash recovery

harbor

Harbor intake for external work — the captain only handles unresolved decisions. Sweeps incoming issues and PRs, verifies every claim before disposition, reuses every decision already made, and hands the maintainer a docket whose pending items each carry one question with options, recommendation, impact and evidence. Agent-autonomous for facts and for actions covered by standing authorization; signed for every new judgment. Never merges.

hud

Configure HUD display options (layout, presets, display elements)

launch

Shipyard

loft

Loft the shape before cutting steel — answer a design question that prose cannot settle by building a throwaway artifact: a pure logic module in a clickable shell, or structurally different UI variants behind one route. The captain reacts to the artifact; the answer folds into the decision; the artifact never docks. Use when a design question stalls in words, when a navigator map carries a loft ticket, or when a spec discussion reaches

minimal-code-discipline

YAGNI-ladder coding discipline for writing changes — existence-first, reuse before writing, dependency ladder, shortest correct diff, with non-negotiables that must never be minimized away

omc-doctor

Diagnose and fix oh-my-claudecode installation issues

相關技能