test-first-change
Reduce regressions by discovering tests, running them, then editing code
Security Assessment
About test-first-change
The 'test-first-change' skill is designed to prevent regressions in software development by enforcing a disciplined approach where tests are discovered and executed before any code modifications are made. By establishing a clear baseline through existing test suites, this skill ensures that developers are aware of the current functionality and coverage, reducing the likelihood of introducing errors or breaking existing features. It addresses a common problem in iterative development where changes can unintentionally compromise stability, making it particularly valuable in projects that prioritize code quality and maintainability.
Key features of the skill include automated test discovery, execution of the full test suite to establish a baseline, and monitoring of code modifications with post-change test verification. It also provides scripts such as 'run_tests.sh' to run tests with coverage reporting and 'diff_summary.py' to summarize changes for memory logging. The skill enforces safety measures by requiring a minimum of 80% coverage on modified code, quarantining flaky tests to avoid false positives, and ensuring that no edits occur before the initial tests are run. These features collectively create a structured workflow that aligns with test-driven development (TDD) principles and emphasizes regression prevention.
The 'test-first-change' skill is ideal for software developers, QA engineers, and teams practicing TDD or continuous integration workflows. It is particularly useful in environments where code quality, regression management, and reliable testing are critical, such as large-scale projects or systems with complex dependencies. By integrating this skill into the development process, users can confidently make changes, knowing that automated checks and coverage requirements will help maintain the stability and integrity of their codebase.
FAQ
How do I use the 'test-first-change' skill?
You start by discovering existing tests for the target code, run the tests to establish a baseline, make the necessary code changes, and then re-run the tests to verify that the changes do not introduce regressions.
Which programming languages or frameworks are compatible?
The skill operates with codebases that have an existing test suite and can run scripts like 'run_tests.sh'. It does not specify language constraints, but it is most applicable to environments where shell scripts and Python scripts for change summaries can be executed.
Are there any coverage requirements?
Yes, the skill requires that any code changes maintain at least 80% test coverage to ensure modifications are adequately verified.
How does the skill handle flaky tests?
Flaky tests are quarantined to prevent false positives, ensuring that only reliable test results are used to verify code changes.
Can the skill edit code before tests are run?
No, the skill enforces a rule that code must never be edited before running the initial tests to establish a safe baseline.
Install test-first-change
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
benreceveur/claude-workflow-engine