/aref:scaffolding-characterization-testsfrom aref
Adds golden/snapshot characterization tests to untested hotspot modules before refactoring, following Feathers' legacy code approach. Use when a refactor plan marks phases with must-scaffold.
Ships in aref. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Scaffolding characterization tests IS building the safety net BEFORE touching code.
Per Feathers' "Working Effectively with Legacy Code": never refactor untested code. Capture current behavior as golden output, verify tests go green against unmodified code, commit the scaffold, then enter applying-refactors.
Core principle: Snapshot current behavior, not aspirational behavior. The tests protect the refactor from accidental regression.
Pattern: Chain
Handoff: automatic (no user confirmation unless new tests added)
Next: applying-refactors
[scaffolding-characterization-tests] Task N: <action>Tasks:
references/characterization-test-recipes.mdRead .rcc/{ts}-refactor-plan.md. Collect all phases with characterization_test.status: must-scaffold.
Skip phases where module already has coverage (sample: run test runner with coverage, check if target_module has ≥3 passing tests). Keep those that need scaffold.
If none → skip to Task 7 immediately.
Language + module shape determines recipe:
high-risk and abort this module's scaffold; surface back to planSee references/characterization-test-recipes.md for per-language code.
Run the test runner on the new test file only. Expected: all new tests pass.
Fail → diagnose. Never alter the module to make tests pass. If the module has nondeterminism (time, random, uuid), freeze sources and retry.
git add <test paths> <golden fixture paths>
git commit -m "test(aref): scaffold characterization tests for <scope>"
Print summary: N modules scaffolded, M skipped (already covered), K marked high-risk. Hand off to applying-refactors unless all phases became high-risk (then return to planning for replan).
| Thought | Reality |
|---|---|
| "The module is simple, tests redundant" | Refactor accidents happen most in simple-looking modules. |
| "Test captures bug behavior" | Correct — the point is to preserve CURRENT behavior, bugs included. Fix bugs in a separate commit AFTER refactor. |
| "Golden files too big, just check count" | The size IS the signal. Commit it. |
| "Skip modules with IO — too hard" | Mark high-risk, escalate to user, don't silently skip. |
references/characterization-test-recipes.mdWhat SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/analyzing-codebasesDetects project languages and monorepo state, runs language-appropriate static analysis (dependency graph, complexity, duplication, semantic patterns), and produces a refactor map ranking hotspots. Use when user invokes /aref or explicitly asks to analyze a codebase for refactoring./applying-refactorsExecutes a refactor plan phase-by-phase on a dedicated branch with per-phase commits and mandatory reviewer checkpoints. Use when characterization-tests scaffold is complete and plan has phases ready to execute./finalizing-refactorsWrites AGENTS.md per subproject, archives run artifacts, and suggests rcc handoff conditionally. Use when verifying-refactors passes (PASS or PASS-WITH-WEAK-TESTS).npx claudepluginhub wayne930242/reflexive-claude-code --plugin arefOther plugins' skills for the same job