| name | issue-to-regression-test |
| description | Use this skill when the user asks to fix a bug, references a GitHub issue number, or describes an issue and wants a fix. This skill will guide you through fetching the issue details, scaffolding a standard regression test, writing a failing test, fixing the issue, and verifying that all tests pass. Make sure to use this skill whenever a bug fix is requested. |
Issue to Regression Test
This skill automates the workflow of fixing a bug reported via a GitHub issue by creating a regression test first.
Workflow
-
Scaffold the Regression Test:
- If an issue number is provided, use the bundled Node.js script to scaffold the test file.
- Command:
node .agents/skills/issue-to-regression-test/scripts/scaffold-test.js <issue_number>
- This script will automatically fetch issue details using
gh and create a file in src/tests/ with the correct JSDoc header.
-
Refine and Reproduce the Bug:
- Open the newly created test file in
src/tests/.
- Implement a test case that fails when run against the current codebase.
- The test should accurately reflect the bug described in the issue.
- Use
vitest for testing. Import describe, expect, it from vitest.
- Import necessary modules from
src/ to test the failing behavior.
-
Fix the Bug:
- Modify the source code in the
src/ directory to fix the reported bug.
- Aim for a surgical fix that solves the problem without unnecessary refactoring.
-
Verify Fix and Prevent Regressions:
- Ensure the new test passes.
- Run ALL tests in the project to ensure no regressions were introduced.
- Command:
npx vitest run
Example JSDoc