Regression Prevention
Overview
This skill defines how to prevent regressions - bugs introduced by changes that break previously working functionality. Systematic regression prevention saves time, maintains quality, and builds confidence in changes.
When to Use
- Before modifying any existing code, configuration, or process
- Before upgrading dependencies, libraries, or frameworks
- Before deploying changes that affect shared components or APIs
- After fixing a bug (prevent it from coming back)
- Don't use when: Working on entirely new code with no existing dependencies
Core Procedures
Step 1: Identify At-Risk Areas
For every proposed change, determine what could break:
- Direct Dependencies: Files, modules, or services that use the thing being changed
- Indirect Dependencies: Things that depend on things that depend on what's being changed
- Shared Components: Libraries, utilities, or infrastructure used by multiple systems
- Data Contracts: APIs, database schemas, or interfaces that other systems depend on
- Configuration: Environment variables, feature flags, or deployment settings
Step 2: Verify Existing Tests Cover At-Risk Areas
For each at-risk area:
Step 3: Make Changes Safely
- Check out a clean branch for the change
- Run ALL tests for at-risk areas BEFORE changing anything
- Make the smallest possible change that achieves the goal
- Run tests after each small change
- If any test fails that wasn't expected, STOP and diagnose before continuing
Step 4: Post-Change Validation
After change is complete:
Step 5: Document Regression Tests
REGRESSION TEST
===============
Bugs prevented: [what issue/s does this test protect against]
Change that introduced it: [what change could cause this regression]
Test location: [file, function, test name]
Coverage: [what specific behavior is validated]
Date created: [when this was added]
Quality Checklist
Error Handling
- Error: Change breaks an existing test
Response: Determine if test is correct (your change is wrong) or if change is right (test needs updating)
- Error: Existing tests don't cover enough to make change safely
Response: Write coverage tests first, then make the change, treat as test discovery exercise
- Error: Full test suite takes too long to run
Response: Run at-risk tests for quick feedback, queue full suite for later validation
Cross-Team Integration
Related Skills: testing-strategy, test-driven-development, output-validation-checklist, edge-case-analysis
Used By: ALL agents modifying existing systems, especially Fixers, Refactors, Maintainers, Integration specialists
1---2name: regression-prevention3description: >4 Use when making changes to existing systems to ensure those changes don't break5 existing functionality. This skill provides procedures for identifying at-risk areas,6 adding regression tests, and validating changes don't cause unintended side effects.7metadata:8 source: https://skillmd.com/skills/construct-ai-primary/regression-prevention9---1011# Regression Prevention1213## Overview14This skill defines how to prevent regressions - bugs introduced by changes that break previously working functionality. Systematic regression prevention saves time, maintains quality, and builds confidence in changes.1516## When to Use17- Before modifying any existing code, configuration, or process18- Before upgrading dependencies, libraries, or frameworks19- Before deploying changes that affect shared components or APIs20- After fixing a bug (prevent it from coming back)21- **Don't use when:** Working on entirely new code with no existing dependencies2223## Core Procedures2425### Step 1: Identify At-Risk Areas26For every proposed change, determine what could break:27- **Direct Dependencies:** Files, modules, or services that use the thing being changed28- **Indirect Dependencies:** Things that depend on things that depend on what's being changed29- **Shared Components:** Libraries, utilities, or infrastructure used by multiple systems30- **Data Contracts:** APIs, database schemas, or interfaces that other systems depend on31- **Configuration:** Environment variables, feature flags, or deployment settings3233### Step 2: Verify Existing Tests Cover At-Risk Areas34For each at-risk area:35- [ ] Does an existing test cover this? If yes, run it.36- [ ] If no test exists, create a regression test BEFORE making the change37- [ ] Ensure regression test fails on the current broken state (test the test)3839### Step 3: Make Changes Safely401. Check out a clean branch for the change412. Run ALL tests for at-risk areas BEFORE changing anything423. Make the smallest possible change that achieves the goal434. Run tests after each small change445. If any test fails that wasn't expected, STOP and diagnose before continuing4546### Step 4: Post-Change Validation47After change is complete:48- [ ] Run FULL test suite, not just at-risk tests49- [ ] Manual smoke test of affected functionality50- [ ] Verify the original bug is fixed (if that was the goal)51- [ ] Commit regression test with clear description of what it protects5253### Step 5: Document Regression Tests54```55REGRESSION TEST56===============57Bugs prevented: [what issue/s does this test protect against]58Change that introduced it: [what change could cause this regression]59Test location: [file, function, test name]60Coverage: [what specific behavior is validated]61Date created: [when this was added]62```6364## Quality Checklist65- [ ] All at-risk areas identified before changes66- [ ] Existing tests cover at-risk areas OR new regression tests added67- [ ] Tests pass before changes begin68- [ ] Tests pass after changes complete69- [ ] Smoke test performed on affected functionality70- [ ] Regression test documented and committed with change7172## Error Handling73- **Error:** Change breaks an existing test74 **Response:** Determine if test is correct (your change is wrong) or if change is right (test needs updating)75- **Error:** Existing tests don't cover enough to make change safely76 **Response:** Write coverage tests first, then make the change, treat as test discovery exercise77- **Error:** Full test suite takes too long to run78 **Response:** Run at-risk tests for quick feedback, queue full suite for later validation7980## Cross-Team Integration81**Related Skills:** testing-strategy, test-driven-development, output-validation-checklist, edge-case-analysis82**Used By:** ALL agents modifying existing systems, especially Fixers, Refactors, Maintainers, Integration specialists