Files
davila7__claude-code-templates/cli-tool/components/loops/engineering/test-coverage-loop.md
Daniel Avila 7f890b1b3b feat: add Loops component type with referenced components (#643)
* feat: add Loops component type with referenced components

Introduce "loops" as a new first-class component type — autonomous
agentic workflows (goal + interval + stop condition) inspired by Loop
Engineering and the Forward Future Loop Library. A loop references other
components (agents, skills, hooks, commands) and the dashboard renders
those references as clickable cards on the loop detail page.

- Add 10 starter loops under cli-tool/components/loops/
  (engineering, evaluation, operations)
- Catalog generator: scan loops + write per-component content files
- Dashboard: new type in icons/types/data, /loops page, and a
  "Referenced Components" section on the loop detail page
- CLI: --loop flag installs the loop to .claude/loops/ and
  auto-installs its referenced components
- Docs: CLAUDE.md and cli-tool rule updated

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T9ynMiCHt8JwdMd8KjCkES

* feat: add 8 more loops (goal/loop/schedule patterns)

Expand the loops catalog to 18, drawing ideas from community "Loop
Engineering" patterns. Adds loops across the three trigger verbs
(/goal, /loop, /schedule) and emphasizes the verifier-in-the-loop and
budget / anti-spin guardrails:

- engineering/five-minute-maintainer-loop
- engineering/build-test-fix-loop
- engineering/anti-spin-build-loop
- engineering/completion-contract-loop (goal)
- engineering/goal-refiner-loop (goal)
- engineering/adversarial-review-loop (cross-model)
- operations/overnight-pr-routine-loop (schedule)
- evaluation/human-approval-loop (human-in-the-loop)

All referenced components verified to exist; catalog regenerated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T9ynMiCHt8JwdMd8KjCkES

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-21 20:19:16 -04:00

43 lines
2.0 KiB
Markdown

---
name: test-coverage-loop
description: Adds meaningful tests pass after pass until the suite reaches a target coverage threshold and stays green.
category: engineering
interval: 20m
stop-condition: Coverage meets or exceeds the target (e.g. 90%) with all tests passing and no flaky additions.
components: [agent:performance-testing/test-automator, command:testing/test-coverage, command:testing/generate-tests]
tags: [testing, coverage, quality, loop]
---
# Test Coverage Loop
> **Loop Engineering** — a recurring goal that drives the agent to grow real test coverage incrementally instead of in one risky batch.
## 🎯 Goal
Raise test coverage toward a defined target by adding **meaningful** tests for the least-covered, highest-risk code first — never gaming the metric with empty assertions.
## ⏱️ Schedule
Suggested interval: `20m`.
## ▶️ Run it
```
/loop 20m "Measure current test coverage. Pick the lowest-covered, highest-risk module and add real, behavior-focused tests for it. Re-run the suite. Continue until coverage is at least 90% with everything passing."
```
## 🔁 Iteration steps
1. **Perceive** — run the coverage report and rank uncovered code by risk.
2. **Reason** — identify branches, error paths and edge cases that lack tests.
3. **Plan** — choose one module/area to cover this pass.
4. **Act** — generate tests with `test-automator` + `/generate-tests`.
5. **Observe** — re-run `/test-coverage`; if the suite is green and coverage rose, continue; if flaky, fix before moving on.
## 🛑 Stopping condition
Coverage ≥ target, full suite passes, and no newly-added test is flaky.
## 🧩 Referenced components
- `agent:performance-testing/test-automator` — authors the tests.
- `command:testing/test-coverage` — measures progress each pass.
- `command:testing/generate-tests` — scaffolds new test cases.
## 💡 Example
Starting at 61%, the loop targets the untested error branches of the payment module first, climbing a few points per pass until it crosses 90% with a green suite.