deepinit
Deep codebase initialization with hierarchical AGENTS.md documentation
By yeachan-heo · 856 installs
npx skills add yeachan-heo/oh-my-claudecode --skill deepinit
Source repository · Upstream listing
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 tag:
This creates a navigable hierarchy:
AGENTS.md Template
Execution Workflow
Step 1: Map Directory Structure
Step 2: Create Work Plan
Generate todo items for each directory, organized by depth level:
Step 3: Generate Level by Level
IMPORTANT : Generate parent levels before child levels to ensure parent references are valid.
For each directory:
1. Read all files in the directory
2. Analyze purpose and relationships
3. Generate AGENTS.md content
4. Write file with proper parent reference
Step 4: Compare and Update (if exists)
When AGENTS.md already exists:
1. Read existing content
2. Identify sections :
Auto generated sections (can be updated)
Manual sections ( <! MANUAL preserved)
3. Compare :
New files added?
Files removed?
Structure changed?
4. 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 <! 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:
Smart Delegation
Task Agent
Directory mapping explore
File analysis architect
Content generation writer
AGENTS.md writes writer
Empty Directory Handling
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:
Parallelization Rules
1. Same level directories : Process in parallel
2. Different levels : Sequential (parent first)
3. Large directories : Spawn dedicated agent per directory
4. Small directories : Batch multiple into one agent
Quality Standards
Must Include
[ ] Accurate file descriptions
[ ] Correct parent references
[ ] Subdirectory links
[ ] AI agent instructions
Must Avoid
[ ] Generic boilerplate
[ ] Incorrect file names
[ ] Broken parent references
[ ] Missing important files
Example Output
Root AGENTS.md
Nested AGENTS.md
Triggering Update Mode
When running on an existing codebase with AGENTS.md files:
1. Detect existing files first
2. Read and parse existing content
3. Analyze current directory state
4. Generate diff between existing and current
5. Apply updates while preserving manual sections
Performance Considerations
Cache directory listings Don't re scan same directories
Batch small directories Process multiple at once
Skip unchanged If directory hasn't changed, skip regeneration
Parallel writes Multiple agents writing different files simultaneously