Regression Prevention
Mission
Produce the smallest coherent implementation that satisfies the task without breaking affected behavior.
Operating Modes
implement: inspect, change, validate, and review the final diff.
code_review: perform read-only defect analysis with severity-ranked findings.
release_readiness: provide change-safety evidence to governance; governance owns the final release decision.
Never turn code_review into weighted scoring unless the user explicitly requests a score.
Core Workflow
1. Preserve the baseline
- Inspect repository status and existing user changes.
- Do not overwrite, revert, reformat, or claim unrelated changes.
- Capture relevant existing behavior and validation state.
- Identify a rollback path proportional to the planned effect.
2. Discover the implementation context
- Read repository instructions and nearby implementation patterns.
- Trace direct callers, data paths, contracts, and user-visible consumers.
- Reuse established naming, types, error semantics, and abstractions.
- Identify the exact behavior that must change and remain stable.
Read implementation-quality.md for detailed construction and final-diff checks.
3. Classify effects
Classify actual planned effects—not topic keywords:
local_low: isolated, reversible local behavior
local_significant: multi-module or compatibility-sensitive behavior
external_reversible: authorized external state with tested rollback
external_irreversible: destructive, migratory, or uncertain recovery
Authentication or migration source code requires domain review. Backup and restore gates activate only when an operation exposes external state or data-loss risk.
4. Implement a coherent slice
- Prefer the simplest implementation that fits existing architecture.
- Keep behavior changes separate from unrelated cleanup.
- Preserve interfaces unless a migration is explicitly authorized.
- Handle failure paths and invalid states deliberately.
- Add comments only for non-obvious rationale.
5. Select validation by changed surface
Use the cheapest layer that can prove the affected behavior, then expand by risk:
- static/type/lint checks for relevant source
- unit tests for deterministic logic
- integration/contract tests for changed boundaries
- browser tests only for changed browser-visible flows
- runtime smoke checks only when an executable path changed
Use Effective Testing Methods when tests must be designed or changed. A missing or blocked layer raises residual risk; it does not justify an unrelated substitute.
6. Review the final diff
- Confirm every changed line serves an authorized requirement.
- Detect accidental formatting churn, dead code, duplicated logic, and stale references.
- Re-check contracts, types, error paths, security boundaries, and performance-sensitive paths where applicable.
- Reconcile every deliverable and prohibition.
7. Report evidence honestly
Report commands run, material results, skipped checks, residual risk, and rollback notes. Never claim no regressions, verified, or release-ready beyond the evidence.
Code Review Mode
For read-only review:
- inspect the diff and relevant surrounding code
- prioritize correctness, security, data loss, compatibility, and missing tests
- report findings by severity with file references and concrete impact
- distinguish proven defects from questions or suggestions
- state when no material findings were found and identify residual test gaps
Read code-review.md for the review checklist.
Compatibility and Migration
For API, schema, event, dependency, or persisted-data changes, read compatibility-and-migrations.md.
Safety Boundaries
- Activating this skill grants no mutation, command, commit, push, migration, deployment, or release authority.
- Respect explicit validation ownership and prohibitions.
- Unknown critical effects fail closed.
- External or irreversible actions require independent safety gates.
Output Contract
For implementation, provide:
- affected behavior and implementation summary
- validation evidence
- residual risk and rollback notes
For code review, provide severity-ranked findings first, then questions and residual coverage gaps.
Quality Gates
- Repository conventions and existing user changes were preserved.
- The implementation is minimal and system-complete.
- Changed contracts and failure paths were checked.
- Validation matches the actual changed surface.
- The final diff contains no unauthorized or unexplained work.
Related Skills
1---2name: regression-prevention3description: Implement or review non-trivial code changes while preserving contracts, repository conventions, user work, and affected behavior. Use for logic, refactors, dependencies, APIs, authentication, data, runtime, or tooling changes and for qualitative code review; exclude copy-only edits, explicit scoring requests, and test design that is fully owned by effective-testing-methods.4---56# Regression Prevention78## Mission910Produce the smallest coherent implementation that satisfies the task without breaking affected behavior.1112## Operating Modes13141. `implement`: inspect, change, validate, and review the final diff.152. `code_review`: perform read-only defect analysis with severity-ranked findings.163. `release_readiness`: provide change-safety evidence to governance; governance owns the final release decision.1718Never turn `code_review` into weighted scoring unless the user explicitly requests a score.1920## Core Workflow2122### 1. Preserve the baseline23241. Inspect repository status and existing user changes.252. Do not overwrite, revert, reformat, or claim unrelated changes.263. Capture relevant existing behavior and validation state.274. Identify a rollback path proportional to the planned effect.2829### 2. Discover the implementation context30311. Read repository instructions and nearby implementation patterns.322. Trace direct callers, data paths, contracts, and user-visible consumers.333. Reuse established naming, types, error semantics, and abstractions.344. Identify the exact behavior that must change and remain stable.3536Read [implementation-quality.md](references/implementation-quality.md) for detailed construction and final-diff checks.3738### 3. Classify effects3940Classify actual planned effects—not topic keywords:41421. `local_low`: isolated, reversible local behavior432. `local_significant`: multi-module or compatibility-sensitive behavior443. `external_reversible`: authorized external state with tested rollback454. `external_irreversible`: destructive, migratory, or uncertain recovery4647Authentication or migration source code requires domain review. Backup and restore gates activate only when an operation exposes external state or data-loss risk.4849### 4. Implement a coherent slice50511. Prefer the simplest implementation that fits existing architecture.522. Keep behavior changes separate from unrelated cleanup.533. Preserve interfaces unless a migration is explicitly authorized.544. Handle failure paths and invalid states deliberately.555. Add comments only for non-obvious rationale.5657### 5. Select validation by changed surface5859Use the cheapest layer that can prove the affected behavior, then expand by risk:60611. static/type/lint checks for relevant source622. unit tests for deterministic logic633. integration/contract tests for changed boundaries644. browser tests only for changed browser-visible flows655. runtime smoke checks only when an executable path changed6667Use [Effective Testing Methods](../effective-testing-methods/SKILL.md) when tests must be designed or changed. A missing or blocked layer raises residual risk; it does not justify an unrelated substitute.6869### 6. Review the final diff70711. Confirm every changed line serves an authorized requirement.722. Detect accidental formatting churn, dead code, duplicated logic, and stale references.733. Re-check contracts, types, error paths, security boundaries, and performance-sensitive paths where applicable.744. Reconcile every deliverable and prohibition.7576### 7. Report evidence honestly7778Report commands run, material results, skipped checks, residual risk, and rollback notes. Never claim `no regressions`, `verified`, or `release-ready` beyond the evidence.7980## Code Review Mode8182For read-only review:83841. inspect the diff and relevant surrounding code852. prioritize correctness, security, data loss, compatibility, and missing tests863. report findings by severity with file references and concrete impact874. distinguish proven defects from questions or suggestions885. state when no material findings were found and identify residual test gaps8990Read [code-review.md](references/code-review.md) for the review checklist.9192## Compatibility and Migration9394For API, schema, event, dependency, or persisted-data changes, read [compatibility-and-migrations.md](references/compatibility-and-migrations.md).9596## Safety Boundaries97981. Activating this skill grants no mutation, command, commit, push, migration, deployment, or release authority.992. Respect explicit validation ownership and prohibitions.1003. Unknown critical effects fail closed.1014. External or irreversible actions require independent safety gates.102103## Output Contract104105For implementation, provide:1061071. affected behavior and implementation summary1082. validation evidence1093. residual risk and rollback notes110111For code review, provide severity-ranked findings first, then questions and residual coverage gaps.112113## Quality Gates1141151. Repository conventions and existing user changes were preserved.1162. The implementation is minimal and system-complete.1173. Changed contracts and failure paths were checked.1184. Validation matches the actual changed surface.1195. The final diff contains no unauthorized or unexplained work.120121## Related Skills122123- [Diagnose Before Fix](../diagnose-before-fix/SKILL.md): verify an uncertain root cause before implementation.124- [Effective Testing Methods](../effective-testing-methods/SKILL.md): design or amend tests.125- [Interdependent Change Planning](../interdependent-change-planning/SKILL.md): coordinate coupled surfaces.126- [Skill Governance](../skill-governance/SKILL.md): own governed mode, gates, and release recommendation.