Files
atomic-design-poc/docs/project/refactor-backlog-setup/README.md
T
ehoandClaude Opus 5 664a43bf2d docs: refactoring-backlog workspace — baseline + 3 Phase 1 agents
Runs the multi-agent refactoring-backlog pipeline in docs/project/
refactor-backlog-setup/ up to and including three of the seven Phase 1
agents.

00-baseline.md establishes the metrics every later agent must cite, using
only tooling already in the repo (vitest lcov, coverlet cobertura, ESLint's
core `complexity` rule at threshold 0 for a full distribution, depcruise
--metrics). Duplication and C# complexity had no tooling, so
tools/baseline-scan.mjs adds a deterministic ~200-line text scan rather
than a new dependency; the approximations are labelled as such.

Headline: FE 75.1% line coverage but only over the 98 of 220 source files a
spec loads; BE 97.6% line / 79.6% branch; 0 layering violations; 7.1%
duplication; 25 of 2085 TS functions over CC 10.

Then 02-testability, 04-cqrs-light and 06-adr-conformance (27 findings).
01/03/05 were skipped deliberately — the baseline shows little for them to
find; 07 (BIO2) and 08 (consolidation) are still open.

Each agent corrected a baseline observation of mine, and in every case the
error was in something derived rather than measured:

- BL-007 counted ~13 adapter "mutations" from the `runSubmit` helper name;
  5 of those call sites are reads. It also missed 3 real mutations that
  reach the raw ApiClient and never return a Result.
- BL-002 diagnosed the 100%-duplicated auth folders as ADR-0002's
  divergence prediction failing. It never had a chance to fail: §3's
  `Principal` union was never built.
- BL-004 named libs/shared/domain and libs/beheer/contracts as coverage
  gaps; both are pure type declarations where 0% is unimprovable.

All three corrections are recorded inline in 00-baseline.md §10, so agent
08 does not inherit the bad numbers.

.prettierignore excludes the agent prompt directories — reflowing their
markdown would edit the prompt text itself.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 16:44:32 +02:00

64 lines
2.7 KiB
Markdown

# Refactoring backlog — automated setup
## What's in this package
```
refactor-backlog-setup/
setup.sh ← run this once, from the root of the target repo
agents/ ← source prompts (edit these if you need to tweak
scope/wording before running setup.sh)
_persistence-protocol.md
00-baseline.prompt.md
01-readability.prompt.md
02-testability.prompt.md
03-ddd-hexagonal.prompt.md
04-cqrs-light.prompt.md
05-bdd.prompt.md
06-adr-conformance.prompt.md
07-bio2-compliance.prompt.md
08-consolidation.prompt.md
09-implementation.prompt.md (template — one TICKET-ID per Phase 3 dispatch)
```
## Usage
1. Copy this `refactor-backlog-setup/` folder into the root of the target repo
(or reference it via a relative path).
2. Edit anything in `agents/` if scope/exclusions need repo-specific detail
(e.g. exact module paths, ADR folder location) — the prompts currently use
the defaults agreed in the design conversation.
3. Run:
```
bash refactor-backlog-setup/setup.sh
```
This creates `./refactor-backlog/` with:
- `_status.md` initialized, all agents `not_started`
- `00-baseline.md` through `07-bio2-compliance.md` initialized with headers
- `99-backlog.md` empty, ready for Consolidation
- `implementation/` folder for Phase 3 notes
- `final-prompts/` — every agent prompt with the persistence protocol
already merged in. **These are the exact prompts to dispatch — no manual
copy-paste needed.**
## Dispatch order
1. Dispatch `final-prompts/00-baseline.prompt.md` (Opus). Wait for
`_status.md` → baseline: complete.
2. Dispatch the 7 Phase 1 prompts in parallel (Opus): `01` through `07`.
Each checks its own dependency in `_status.md` before starting.
3. Once all 7 show `complete`, dispatch `final-prompts/08-consolidation.prompt.md`
(Opus). It writes `99-backlog.md` and halts for human approval — check the
file for any `ADR-fix` or BIO2-flagged tickets before proceeding.
4. For each approved ticket, copy `final-prompts/09-implementation.prompt.md`,
fill in `TICKET-ID:`, dispatch (Sonnet). Run tickets in parallel within a CD
batch, sequential across batches, per the `Depends on` column in
`99-backlog.md`.
## Re-running / resuming
Safe to re-run `setup.sh` only on a fresh workspace — it does not check for an
existing `./refactor-backlog/` and will overwrite `_status.md` and the phase
output files. If a run is already in progress, don't re-run `setup.sh`; just
re-dispatch the relevant `final-prompts/*.prompt.md` — each agent reads
`_status.md` and its own output file first and resumes from where it left off.