unit-testlisted
Install: claude install-skill oprogramadorreal/optimus-claude
# Unit Test Coverage Improvement
Improve unit test coverage for existing code. Requires `/optimus:init` to have set up test infrastructure (framework, coverage tooling, testing docs) first. Conservative by design — only adds new test files, never refactors or restructures existing source code. If code is untestable as-is, it flags it rather than changing it. Refactoring is the domain of `/optimus:refactor`.
## Step 1: Pre-flight
### Parse invocation arguments
Extract from the user's arguments:
1. `deep` flag (present/absent)
2. `harness` keyword after `deep` (present/absent)
3. A number immediately after `deep` or `deep harness` → iteration cap (optional, default 5, hard cap 10)
4. Everything else → scope instructions (optional path)
Examples:
- `/optimus:unit-test` → normal mode, full project
- `/optimus:unit-test src/api` → normal mode, scoped
- `/optimus:unit-test deep` → deep mode (5 iterations)
- `/optimus:unit-test deep 3` → deep mode (3 iterations)
- `/optimus:unit-test deep src/api` → deep mode, scoped
- `/optimus:unit-test deep harness` → harness mode, 5 iterations
- `/optimus:unit-test deep harness 5 "src/api"` → harness mode, scoped
### Harness mode detection
**If system prompt contains `HARNESS_MODE_ACTIVE`:**
→ Read `$CLAUDE_PLUGIN_ROOT/references/coverage-harness-mode.md`
→ Follow the "Unit-Test Phase Execution" section
→ Skip user confirmation (no `AskUserQuestion`)
→ Skip loops — run Steps 2–4 exactly once, then output structured JSON and stop
**If `ha