--- description: Generate comprehensive project documentation for engineers and non-engineers allowed-tools: Read, Write, Edit, Bash, Task, TodoWrite, Glob, Grep --- # Eureka Index - Project Documentation Generator **Input**: "$ARGUMENTS" --- ## PURPOSE Generate comprehensive, dual-audience documentation by analyzing the current project structure using **parallel agent execution**. The output is designed to be understandable for **both engineers and non-engineers**. ### Documentation Layers | Layer | Audience | Content | |-------|----------|---------| | Executive Summary | Everyone | Project purpose, value, capabilities | | Architecture Overview | Everyone | Visual diagrams, technology stack | | Getting Started | Semi-technical | Setup, basic usage, configuration | | Feature Guide | Non-engineers | Plain-language feature descriptions | | API Reference | Engineers | Endpoints, schemas, authentication | | Component Catalog | Engineers | Props, interfaces, usage examples | | Data Models | Both | ER diagrams + plain descriptions | | Glossary | Non-engineers | Technical terms explained | --- ## EXECUTION ARCHITECTURE ``` ┌─────────────────────────────────────────────────────────────────────┐ │ PARALLEL EXECUTION PIPELINE │ ├─────────────────────────────────────────────────────────────────────┤ │ │ │ PHASE 1: PARALLEL ANALYSIS (run_in_background: true) │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌────────────┐ │ │ │ Structure │ │ API │ │ Components │ │ Models │ │ │ │ Analyzer │ │ Analyzer │ │ Analyzer │ │ Analyzer │ │ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └─────┬──────┘ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ │ │ PHASE 2: SYNCHRONIZATION │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ Merge & Create Unified Analysis │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ │ ▼ │ │ PHASE 3: PARALLEL DOCUMENTATION (run_in_background: true) │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌────────────┐ │ │ │ Main Doc │ │ API Docs │ │ Components │ │ Quick │ │ │ │ Generator │ │ Generator │ │ Generator │ │ Reference │ │ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └─────┬──────┘ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ │ │ PHASE 4: FINALIZATION │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ HTML Generation + Validation + Summary │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────┘ ``` --- ## ⛔ CRITICAL RULES ### MUST DO 1. **MUST** launch analysis agents in parallel using `run_in_background: true` 2. **MUST** wait for all analysis agents before synchronization 3. **MUST** launch documentation agents in parallel after synchronization 4. **MUST** include both technical and non-technical descriptions 5. **MUST** validate generated documentation against actual code ### CANNOT DO 1. **CANNOT** make up features that don't exist 2. **CANNOT** skip the parallel analysis phase 3. **CANNOT** generate docs without synchronizing analysis results --- ## EXECUTION FLOW ### ═══════════════════════════════════════════════════════════════ ### PHASE 1: Parallel Analysis ### ═══════════════════════════════════════════════════════════════ #### 1.1: Display Start Banner & Setup ``` ╔══════════════════════════════════════════════════════════════╗ ║ 📚 EUREKA INDEX - Parallel Documentation Generator ║ ╠══════════════════════════════════════════════════════════════╣ ║ Launching parallel analysis agents... ║ ║ Output: Dual-audience documentation (Engineer + Non-Engineer)║ ╚══════════════════════════════════════════════════════════════╝ ``` ```bash OUTPUT_DIR="${ARGUMENTS:-docs}" mkdir -p "$OUTPUT_DIR" echo "📁 Output directory: $OUTPUT_DIR" ``` #### 1.2: Launch Parallel Analysis Agents **CRITICAL: Launch ALL four agents in a SINGLE message with multiple Task tool calls:** ``` Launch these 4 Task agents IN PARALLEL (single message, multiple tool calls): ┌─────────────────────────────────────────────────────────────────┐ │ AGENT 1: Structure Analyzer │ ├─────────────────────────────────────────────────────────────────┤ │ Task tool with: │ │ subagent_type: "Explore" │ │ run_in_background: true │ │ prompt: | │ │ # PROJECT STRUCTURE ANALYSIS │ │ │ │ Analyze the project structure and return findings. │ │ │ │ ## Tasks │ │ 1. Identify project type (package.json, requirements.txt, │ │ Cargo.toml, go.mod, pom.xml) │ │ 2. Extract metadata (name, version, description) │ │ 3. Map directory structure with purposes │ │ 4. Identify tech stack (language, framework, database) │ │ 5. List key dependencies with plain English purposes │ │ │ │ ## Output Format (YAML) │ │ ```yaml │ │ project: │ │ name: "..." │ │ version: "..." │ │ description: "..." │ │ type: "node|python|rust|go|java|other" │ │ tech_stack: │ │ language: "..." │ │ framework: "..." │ │ database: "..." │ │ structure: │ │ directories: │ │ - path: "..." │ │ purpose: "..." │ │ file_count: N │ │ dependencies: │ │ - name: "..." │ │ purpose: "plain English" │ │ ``` │ └─────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────┐ │ AGENT 2: API Analyzer │ ├─────────────────────────────────────────────────────────────────┤ │ Task tool with: │ │ subagent_type: "Explore" │ │ run_in_background: true │ │ prompt: | │ │ # API ENDPOINTS ANALYSIS │ │ │ │ Find and analyze all API endpoints in the project. │ │ │ │ ## Search Patterns │ │ - Next.js App Router: app/api/**/route.ts │ │ - Next.js Pages: pages/api/**/*.ts │ │ - Express: router.get/post/put/delete │ │ - FastAPI: @app.get/post/put/delete │ │ - GraphQL: Query/Mutation resolvers │ │ │ │ ## Output Format (YAML) │ │ ```yaml │ │ api_endpoints: │ │ - method: "GET|POST|PUT|DELETE" │ │ path: "/api/..." │ │ handler_file: "path/to/file.ts" │ │ description: "plain English" │ │ request_body: "schema if POST/PUT" │ │ response: "schema summary" │ │ auth_required: true|false │ │ ``` │ │ │ │ If no APIs found, return: api_endpoints: [] │ └─────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────┐ │ AGENT 3: Components Analyzer │ ├─────────────────────────────────────────────────────────────────┤ │ Task tool with: │ │ subagent_type: "Explore" │ │ run_in_background: true │ │ prompt: | │ │ # UI COMPONENTS ANALYSIS │ │ │ │ Find and analyze all UI components in the project. │ │ │ │ ## Search Patterns │ │ - React: components/**/*.tsx, function Component() │ │ - Vue: components/**/*.vue,