arabelatso/regression-consistency-checker
Checks whether a new version of a repository preserves the behavior observed by tests on the old version. Use this skill when comparing two versions of code to detect regressions, verify refactoring safety, validate bug fixes don't break existing functionality, or ensure backward compatibility. Detects differences in function outputs, exceptions, observable states, and performance between versions. Generates reports highlighting potential regressions (critical, high, medium, low severity), improvements, and areas requiring verification. Triggers when users ask to check for regressions between versions, compare test behavior across versions, verify behavior preservation, or validate that changes don't break existing tests.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill regression-consistency-checker
Check whether a new version of a repository preserves the behavior observed by tests on the old version.
Set up old version:
# Tag or note the old version
git tag old-version
# Or checkout specific commit
git checkout <old-commit-hash>
Set up new version:
# Tag the new version
git tag new-version
# Or checkout new commit
git checkout <new-commit-hash>
Ensure clean environment:
Capture baseline results:
# Python (pytest with JSON report)
git checkout old-version
pytest --json-report --json-report-file=old_results.json
# JavaScript (Jest with JSON report)
git checkout old-version
npm test -- --json --outputFile=old_results.json
# Run multiple times to check stability
pytest --json-report --json-report-file=old_results_1.json
pytest --json-report --json-report-file=old_results_2.json
# Compare to ensure deterministic
Verify baseline stability:
Capture new results:
# Python
git checkout new-version
pytest --json-report --json-report-file=new_results.json
# JavaScript
git checkout new-version
npm test -- --json --outputFile=new_results.json
Note any immediate failures:
Use comparison script:
python scripts/compare_results.py old_results.json new_results.json
# With custom tolerance for floats
python scripts/compare_results.py old_results.json new_results.json --tolerance 0.001
# Save detailed report
python scripts/compare_results.py old_results.json new_results.json --output regression_report.json
Script detects:
For each regression, determine:
Is it a true regression?
Or is it expected?
Review strategies in detection_strategies.md.
For critical regressions:
# Find commits that caused regression
git bisect start
git bisect bad new-version
git bisect good old-version
# Test each commit
git bisect run pytest path/to/failing_test.py
For output differences:
For exception changes:
Create regression report:
REGRESSION ANALYSIS REPORT
==========================
Version Comparison: v1.0.0 → v1.1.0
Date: 2024-01-15
Tests Run: 156
SUMMARY
-------
Critical Regressions: 2
High Severity: 5
Medium Severity: 3
Low Severity: 8
Improvements: 4
Unchanged: 134
CRITICAL REGRESSIONS
--------------------
1. test_user_authentication
- Status: PASS → FAIL
- Error: KeyError: 'user_id'
- Root Cause: Removed field from response
- Action: Restore field or update API contract
2. test_payment_processing
- Status: PASS → FAIL
- Error: AssertionError: expected 100.00, got 100.01
- Root Cause: Rounding change in calculation
- Action: Fix rounding logic
HIGH SEVERITY REGRESSIONS
--------------------------
1. test_data_export
- Output changed: CSV format → JSON format
- Impact: Breaking change for consumers
- Action: Maintain backward compatibility
[... continue for all regressions ...]
EXPECTED CHANGES
----------------
1. test_error_messages
- Error messages now include more context
- Intentional improvement
- Action: Update baseline
RECOMMENDATIONS
---------------
1. Fix critical regressions before release
2. Review high severity changes with team
3. Document breaking changes in changelog
4. Update tests for intentional changes
Fix true regressions:
# Fix the code
git checkout new-version
# Make fixes
git commit -m "Fix: regression in user authentication"
# Re-run tests
pytest --json-report --json-report-file=fixed_results.json
# Verify fix
python scripts/compare_results.py old_results.json fixed_results.json
Accept intentional changes:
# Update baseline
cp new_results.json baseline_results.json
# Document in changelog
echo "- Changed: CSV export now returns JSON" >> CHANGELOG.md
Output Regressions:
Exception Regressions:
State Regressions:
Performance Regressions:
Critical (block release):
High (fix before release):
Medium (review and decide):
Low (document):
Exact comparison:
old_output == new_output
Approximate comparison (floats):
abs(old_output - new_output) < tolerance
Structural comparison (ignore fields):
# Ignore timestamps, IDs
compare_ignoring_fields(old, new, ['timestamp', 'id'])
Semantic comparison (order-independent):
# Compare as sets
set(old_list) == set(new_list)
The compare_results.py script automates comparison:
# Basic comparison
python scripts/compare_results.py old_results.json new_results.json
# Custom float tolerance
python scripts/compare_results.py old_results.json new_results.json --tolerance 0.001
# Save detailed report
python scripts/compare_results.py old_results.json new_results.json --output report.json
Supported formats:
Output includes:
Ensure deterministic tests:
Run multiple times:
Isolate changes:
Document expectations:
Automate checks:
Take arabelatso/regression-consistency-checker from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.