You will generate LLM-optimized documentation with concrete file references and flexible formatting.
Create documentation that allows humans and LLMs to:
- Understand project purpose - what the project does and why
- Get architecture overview - how the system is organized
- Build on all platforms - build instructions with file references
- Add features/subsystems - following established patterns with examples
- Debug applications - troubleshoot issues with specific file locations
- Test and add tests - run existing tests and create new ones
- Deploy and distribute - package and deploy the software
Each document MUST include:
- Timestamp Header - Hidden comment with last update timestamp
- Brief Overview (2-3 paragraphs max)
- Key Files & Examples - Concrete file references for each major topic
- Common Workflows - Practical guidance with file locations
- Reference Information - Quick lookup tables with file paths
Each generated file MUST start with:
<!-- Generated: YYYY-MM-DD HH:MM:SS UTC -->
You will:
- Analyze the codebase systematically across 7 key areas (merging development+patterns)
- Create or update docs in
docs/*.md
with concrete file references - Synthesize final documentation into a minimal, LLM-friendly README.md
- Eliminate all duplication across files
For each area, agents should:
- Examine key files: Look for build configs, test files, deployment scripts, main source files
- Extract file references: Note specific files, line numbers, and examples
- Identify patterns: Find repeated structures, naming conventions, common workflows
- Make content LLM-friendly: Token-efficient, reference-heavy, practical examples
Issue the following Task calls in parallel:
Project Overview (docs/project-overview.md
):
STRUCTURE:
- Overview: What the project is, core purpose, key value proposition (2-3 paragraphs)
- Key Files: Main entry points and core configuration files
- Technology Stack: Core technologies with specific file examples
- Platform Support: Requirements with platform-specific file locations
Architecture (docs/architecture.md
):
STRUCTURE:
- Overview: High-level system organization (2-3 paragraphs)
- Component Map: Major components with their source file locations
- Key Files: Core headers and implementations with brief descriptions
- Data Flow: How information flows with specific function/file references
Build System (docs/build-system.md
):
STRUCTURE:
- Overview: Build system with file references to main build configuration
- Build Workflows: Common tasks with specific commands and config files
- Platform Setup: Platform-specific requirements with file paths
- Reference: Build targets, presets, and troubleshooting with file locations
Testing (docs/testing.md
):
STRUCTURE:
- Overview: Testing approach with test file locations
- Test Types: Different test categories with specific file examples
- Running Tests: Commands with file paths and expected outputs
- Reference: Test file organization and build system test targets
Development (docs/development.md
):
STRUCTURE:
- Overview: Development environment, code style, patterns (merge with old patterns.md if exists)
- Code Style: Conventions with specific file examples (show actual code from codebase)
- Common Patterns: Implementation patterns with file references and examples from the codebase
- Workflows: Development tasks with concrete file locations and examples
- Reference: File organization, naming conventions, common issues with specific files
Deployment (docs/deployment.md
):
STRUCTURE:
- Overview: Packaging and distribution with script references
- Package Types: Different packages with build targets and output locations
- Platform Deployment: Platform-specific packaging with file paths
- Reference: Deployment scripts, output locations, server configurations
Files Catalog (docs/files.md
):
STRUCTURE:
- Overview: Comprehensive file catalog with descriptions and relationships (2-3 paragraphs)
- Core Source Files: Main application logic with purpose descriptions
- Platform Implementation: Platform-specific code with interface mappings
- Build System: Build configuration and helper modules
- Configuration: Assets, scripts, configs - Supporting files and their roles
- Reference: File organization patterns, naming conventions, dependency relationships
- Token efficient: Avoid redundant explanations, focus on essential information
- Concrete file references: Always include specific file paths, line numbers when helpful
- Flexible formatting: Use subsections, code blocks, examples instead of rigid step-by-step
- Pattern examples: Show actual code from the codebase, not generic examples
- Each piece of information appears in EXACTLY ONE file
- Build information only in build-system.md
- Code style and patterns only in development.md
- Deployment information only in deployment.md
- Cross-references using: "See docs/filename.md"
Always include specific file references:
**Core System** - Core implementation in src/core.h (lines 15-45), platform backends in src/platform/
**Build Configuration** - Main build file (lines 67-89), configuration files
**Module Management** - Interface in src/module.h, implementation in src/module.c (key_function at line 134)
Use actual code from the codebase:
// From src/example.h:23-27
typedef struct {
bool active;
void *data;
int count;
} ExampleState;
After all tasks complete:
-
Read all
docs/*.md
files and create README.md with:- Project description (2-3 sentences max)
- Key entry points and core configuration files
- Quick build commands
- Documentation links with brief descriptions of what LLMs will find useful
- Keep it under 50 lines total
-
Duplication check: Scan all files and remove any duplicated information
-
File reference check: Ensure all file paths are accurate and helpful
Each agent must:
- Read existing file if it exists to understand current content
- Analyze relevant codebase files systematically
- Extract specific file references throughout analysis:
- Note important headers, source files, configuration files
- Include line numbers for key functions/sections when helpful
- Reference actual code examples from the codebase
- Create LLM-friendly content:
- Token-efficient writing (no redundant explanations)
- Concrete file paths and examples throughout
- Flexible formatting (subsections, code blocks, practical guidance)
- Focus on what LLMs need to understand and work with the code
- Include practical workflows with specific file references
- Create reference sections with file locations and line numbers
- Update timestamp at the top with current UTC time
- Read generated file and revise for accuracy and completeness
Success criteria: Each file should be a practical reference that helps LLMs quickly understand the codebase and find the right files for specific tasks.
Special note for development.md: Merge content from both old development.md and patterns.md (if they exist) into a single comprehensive development guide with implementation patterns.
The coordinating agent must:
- Wait for all agents to complete
- Read all generated files
- Remove any duplication found
- Create a minimal, LLM-optimized README.md with key file references
- Update README.md timestamp with current UTC time
- Delete docs/patterns.md if it exists since it's merged into development.md
The Files agent should create a minimal, token-efficient file catalog:
- Discover files: Use Glob and LS to find all source files, configs, and build files
- Group by function: Organize files into logical categories (core, platform, build, tests, config)
- Brief descriptions: One line per significant file describing its primary purpose
- Key entry points: Highlight main files, build configs, and important headers
- Dependencies: Note major relationships between file groups
Format: Concise lists with file paths and single-sentence descriptions. Focus on helping LLMs quickly locate functionality, not comprehensive documentation.
Success criteria: LLMs can quickly find "where is the main entry point", "which files handle X", "what are the key headers" without reading detailed descriptions.