$npx -y skills add aaddrick/claude-pipeline --skill write-docblocksUse when documentation coverage is low, after composer docs:coverage shows gaps, or when asked to batch-write PHPDoc blocks across multiple files
| 1 | # Write Docblocks |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Batch-process PHPDoc documentation gaps by running `composer docs:coverage:missing` and dispatching parallel phpdoc-writer subagents. |
| 6 | |
| 7 | **Core principle:** Process files in batches of 5 subagents for efficient parallel documentation without overwhelming the system. |
| 8 | |
| 9 | ## When to Use |
| 10 | |
| 11 | - Documentation coverage below target (80% classes, 75% methods) |
| 12 | - After creating multiple new services, controllers, or models |
| 13 | - When `composer docs:coverage:missing` shows many files needing docs |
| 14 | - User requests batch PHPDoc writing |
| 15 | |
| 16 | ## Workflow |
| 17 | |
| 18 | ```dot |
| 19 | digraph write_docblocks { |
| 20 | rankdir=TB; |
| 21 | |
| 22 | start [label="Run composer docs:coverage:missing" shape=box]; |
| 23 | parse [label="Parse output for file paths" shape=box]; |
| 24 | check [label="Files remaining?" shape=diamond]; |
| 25 | batch [label="Take next 5 files" shape=box]; |
| 26 | dispatch [label="Dispatch 5 phpdoc-writer\nsubagents in parallel" shape=box]; |
| 27 | wait [label="Wait for batch to complete" shape=box]; |
| 28 | done [label="Run composer docs:coverage\nto verify improvement" shape=box]; |
| 29 | |
| 30 | start -> parse -> check; |
| 31 | check -> batch [label="yes"]; |
| 32 | check -> done [label="no"]; |
| 33 | batch -> dispatch -> wait -> check; |
| 34 | } |
| 35 | ``` |
| 36 | |
| 37 | ## Execution Steps |
| 38 | |
| 39 | ### 1. Get Missing Files |
| 40 | |
| 41 | ```bash |
| 42 | composer docs:coverage:missing 2>&1 | sed 's/\x1b\[[0-9;]*m//g' | grep '\.php$' |
| 43 | ``` |
| 44 | |
| 45 | This strips ANSI codes and extracts just file paths like: |
| 46 | ``` |
| 47 | Console/Commands/ProcessDataCommand.php |
| 48 | Http/Controllers/AuthController.php |
| 49 | Services/AuthService.php |
| 50 | ``` |
| 51 | |
| 52 | ### 2. Process in Batches of 5 |
| 53 | |
| 54 | For each batch of 5 files, dispatch phpdoc-writer subagents **in parallel using a single message with multiple Task tool calls**: |
| 55 | |
| 56 | ``` |
| 57 | Task(subagent_type="phpdoc-writer", prompt="Write PHPDoc blocks for app/Console/Commands/ProcessDataCommand.php - read the file, understand its purpose, and add comprehensive docblocks for the class and all undocumented methods.") |
| 58 | |
| 59 | Task(subagent_type="phpdoc-writer", prompt="Write PHPDoc blocks for app/Http/Controllers/OAuthController.php - read the file, understand its purpose, and add comprehensive docblocks for the class and all undocumented methods.") |
| 60 | |
| 61 | // ... 3 more in same message |
| 62 | ``` |
| 63 | |
| 64 | **CRITICAL:** All 5 Task calls MUST be in a single assistant message to run in parallel. |
| 65 | |
| 66 | ### 3. Wait for Batch Completion |
| 67 | |
| 68 | Wait for all 5 subagents to complete before starting the next batch. This prevents resource exhaustion while maintaining parallelism. |
| 69 | |
| 70 | ### 4. Repeat Until Done |
| 71 | |
| 72 | Continue processing batches until all files are documented. |
| 73 | |
| 74 | ### 5. Verify Coverage |
| 75 | |
| 76 | ```bash |
| 77 | composer docs:coverage |
| 78 | ``` |
| 79 | |
| 80 | Confirm improvement toward targets (80% classes, 75% methods). |
| 81 | |
| 82 | ## Subagent Prompt Template |
| 83 | |
| 84 | ``` |
| 85 | Write PHPDoc blocks for app/{PATH} |
| 86 | |
| 87 | 1. Read the file thoroughly to understand its purpose |
| 88 | 2. Check what's already documented vs missing |
| 89 | 3. Add comprehensive docblocks for: |
| 90 | - Class-level documentation explaining purpose and context |
| 91 | - All undocumented public methods with @param, @return, @throws |
| 92 | - Protected/private methods with brief explanations |
| 93 | 4. Follow project-specific conventions and domain terminology |
| 94 | 5. Run pint after editing: ./vendor/bin/pint {file} |
| 95 | |
| 96 | Target audience: New developer on their first day. |
| 97 | ``` |
| 98 | |
| 99 | ## Common Mistakes |
| 100 | |
| 101 | **Dispatching sequentially:** Each file one at a time wastes time. Use batches of 5 in parallel. |
| 102 | |
| 103 | **Not using single message:** Multiple Task calls in separate messages run sequentially. Put all 5 in ONE message. |
| 104 | |
| 105 | **Skipping verification:** Always run `composer docs:coverage` at the end to confirm improvement. |
| 106 | |
| 107 | **Forgetting pint:** Subagents should run `./vendor/bin/pint` after editing to maintain code style. |