safe-incremental-coding
Safe Incremental Coding
Choose the branch before selecting a model. Coordinator work and deterministic commands proceed within invocation authority. Apply this method in the current role. It does not dispatch a worker. For a worker dispatch, use shared/references/model-preview.md and its one approved route snapshot. Nested skills and runners consume it without another selection or worker.
Protect the existing behavior needed for a requested change, using the legacy change method from Dave Farley's The Software Developers' Guidebook. The aim is ease of change: the affected code can be changed safely.
Build a characterization test net before refactoring. Keep the work within the area needed for the requested change.
Build the net
- Identify the affected behavior and an observable boundary that can exercise it.
- Capture current outputs or side effects with representative inputs, including relevant boundary and failure cases. Pin existing behavior even when it contains a known defect; an intentional behavior change is a separate step.
- Control or normalize timestamps, identifiers, seeds, and other variable values without hiding behavior that matters to the change.
- Prefer tests at an acceptance or integration boundary when unit tests would depend on the current internal structure.
- If no existing boundary exposes the behavior, limit the initial production edit to the minimum observation seam. Keep its business logic unchanged and capture the baseline before further production changes.
- Check that the test passes against the baseline and would detect a relevant change in behavior.
A passing baseline protects only the cases it exercises. Add coverage for a missing case when the requested change depends on it.