Use for the full refactor cycle: identify code to change, write behavioral tests first, make the change, run tests, fix all failures before marking done. Triggers: refactor, extract helper, reduce duplication, consolidate, move to shared, clean up repeated code.
Use this skill to safely carry a refactoring from identification through verified completion. The loop enforces the test-first discipline required by AGENTS.md and does not exit until all tests pass.
uk.osric.slow unless the user explicitly includes it.uk.osric.common.uk.osric.common.web.internal → public) without a clear reason.uk.osric.common, check that the project reference chain remains valid (feature modules → common, not the reverse).The following direction is enforced by architecture tests:
uk.osric.web → feature modules → uk.osric.common.web → uk.osric.common
Do not introduce cycles. If a helper is needed by a project that currently does not reference uk.osric.common, add the reference explicitly and verify it does not introduce a cycle.
write-behavioural-tests skill to add tests in uk.osric.fast that lock the current behavior.dotnet test tests/uk.osric.fast — all tests must pass before proceeding.uk.osric.common or uk.osric.common.web).internal if only used within the project, public if shared across assemblies).using or <ProjectReference> entries as needed.dotnet build --configuration Release
dotnet test tests/uk.osric.fast
refactor: extract SqliteConnectionString helper to uk.osric.common.Co-authored-by trailer.~~...~~ ✅ Done.| Symptom | Fix |
|---|---|
| Build fails due to missing reference | Add <ProjectReference> in the consuming .csproj |
| Tests fail after moving code | Check that the moved code is semantically identical (no accidental behavior change) |
| Cycle detected by architecture tests | The shared helper belongs in a lower-level project |
| Tests were never written | Return to Step 2 before proceeding |