--- name: docs description: Documentation planning and orchestration - creates structured documentation tasks for execution usage: /workflow:docs [options] argument-hint: "architecture"|"api"|"all" [--tool ] [--scope ] examples: - /workflow:docs all # Complete documentation (gemini default) - /workflow:docs all --tool qwen # Use Qwen for architecture focus - /workflow:docs architecture --scope src/modules - /workflow:docs api --tool gemini --scope api/ --- # Workflow Documentation Command ## Purpose **`/workflow:docs` is a lightweight planner/orchestrator** - it analyzes project structure using metadata tools, decomposes documentation work into tasks, and generates execution plans. It does **NOT** generate any documentation content itself. **Key Principle**: Lightweight Planning + Targeted Execution - **docs.md** → Collect metadata (paths, structure), generate task JSONs with path references - **doc-generator.md** → Execute targeted analysis on focus_paths, generate content **Optimization Philosophy**: - **Planning phase**: Minimal context - only metadata (module paths, file lists via `get_modules_by_depth.sh` and Code Index MCP) - **Task JSON**: Store path references, not content - **Execution phase**: Targeted deep analysis within focus_paths scope ## Usage ```bash /workflow:docs [--tool ] [--scope ] ``` ### Parameters - **type**: `architecture` | `api` | `all` (required) - `architecture`: System design, module interactions, patterns - `api`: Endpoint documentation, API specifications - `all`: Complete documentation suite - **--tool**: `gemini` | `qwen` | `codex` (optional, default: gemini) - `gemini`: Comprehensive documentation, pattern recognition - `qwen`: Architecture analysis, system design focus - `codex`: Implementation validation, code quality - **--scope**: Directory path filter (optional) ## Planning Workflow ### Complete Execution Flow ``` /workflow:docs [type] [--tool] [--scope] ↓ Phase 1: Init Session → Create session dir & active marker ↓ Phase 2: Module Analysis → Run get_modules_by_depth.sh ↓ Phase 3: Quick Assess → Check existing docs ↓ Phase 4: Decompose → Create task list & TodoWrite ↓ Phase 5: Generate Tasks → Build IMPL-*.json & plans ↓ ✅ Planning Complete → Show TodoWrite status ``` ### Phase Details #### Phase 1: Session Initialization ```bash # Parse arguments and create session structure doc_type="all" # architecture|api|all tool="gemini" # gemini|qwen|codex (default: gemini) scope="" # optional path filter timestamp=$(date +%Y%m%d-%H%M%S) session_dir=".workflow/WFS-docs-${timestamp}" mkdir -p "${session_dir}"/{.task,.process,.summaries} touch ".workflow/.active-WFS-docs-${timestamp}" ``` #### Phase 2: Lightweight Metadata Collection (MANDATORY) ```bash # Step 1: Run get_modules_by_depth.sh for module hierarchy (metadata only) module_data=$(~/.claude/scripts/get_modules_by_depth.sh) # Format: depth:N|path:|files:N|size:N|has_claude:yes/no # Step 2: Use Code Index MCP for file discovery (optional, for better precision) # Example: mcp__code-index__find_files(pattern="src/**/") # This finds directories without loading content # IMPORTANT: Do NOT read file contents in planning phase # Only collect: paths, file counts, module structure ``` #### Phase 3: Quick Documentation Assessment ```bash # Lightweight check - no heavy analysis existing_docs=$(find . -maxdepth 2 -name "*.md" -not -path "./.workflow/*" | wc -l) if [[ $existing_docs -gt 5 ]]; then find . -maxdepth 3 -name "*.md" > "${session_dir}/.process/existing-docs.txt" fi # Record strategy cat > "${session_dir}/.process/strategy.md" <