| name | init-docs |
| description | Create modular documentation with parallel agents |
Create comprehensive modular documentation for this codebase following this workflow.
Update the AGENTS.md in the current working directory when adding doc cross-references.
Step 1: Analyze Codebase Structure
- List all source files (excluding node_modules, .next, dist, build)
- Identify every area that needs documentation:
- Architecture/system overview
- Authentication/authorization (if exists)
- API routes/endpoints (if exists)
- Data layer/services
- Types/interfaces
- Components (if frontend)
- State management (if exists)
- Middleware/interceptors (if exists)
- Database schema/migrations (if exists)
- Error handling patterns
- Configuration/environment
- Testing strategy
- Deployment (if config exists)
If a concern exists in the codebase, it gets a doc.
Step 2: Create docs/INDEX.md
Create a docs/ folder with an INDEX.md file organized by category.
Valid statuses: Pending | Done | Failed
Mark all docs as "Pending" initially.
Step 3: Launch Parallel Agents
Launch parallel agents (one per doc file) to create each doc simultaneously.
Each agent prompt should include:
- Which files to read for context
- What to document — purpose, patterns, decisions, relationships
- Instruction to use
file:line references instead of code snippets
Step 4: Update Index and Project Instructions
After all agents complete:
- Update
docs/INDEX.md — mark completed docs as Done, mark failures as Failed
- Update the project instructions file (in codebase root) — add/update the Documentation section:
## Documentation
| Area | Doc |
|------|-----|
| [Topic] | `docs/doc-name.md` |
Read relevant docs BEFORE changes. Update docs AFTER changes.
Documentation Guidelines
- Be thorough — cover each topic completely, don't artificially truncate
- Use tables for structured data: props, endpoints, types, env vars, config options
- Focus on WHY — not just what the code does, but why decisions were made
- Reference source files with
file:line so docs can be verified against code
Rules
- Launch agents in parallel — all independent docs can be created simultaneously
- One concern per file — modular and maintainable
- Update both INDEX.md and project instructions — ensure cross-references are complete
- Verify completion — check all agents finished before updating statuses, mark failures as
Failed