arabelatso/code-repair-generation-combo
Automatically repair buggy code and generate comprehensive tests for Python, Java, and C++ programs. Use when users need to fix logic errors or runtime errors in functions, modules, or repositories. Accepts specifications via natural language descriptions, existing test cases, or input/output examples. Generates corrected code, creates or updates tests to verify correctness and prevent regressions, and produces a detailed report explaining the bug, fix, and testing strategy. Triggers on requests like "fix this bug", "repair this code", "debug this function", or "this code is broken".
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill code-repair-generation-combo
Automatically diagnose and repair buggy code while generating comprehensive tests to verify correctness and prevent regressions.
Follow this systematic approach for bug fixing and test generation:
Read the buggy code - Use Read tool to examine the problematic code thoroughly.
Analyze the specification - Understand expected behavior from:
Identify the scope - Determine if the bug affects:
Trace the logic - Walk through the code execution mentally or with examples.
Identify the bug type:
Pinpoint the exact location - Identify the specific lines causing the issue.
Understand side effects - Check if the bug affects other parts of the codebase.
Apply minimal changes - Fix only what's broken, preserve existing functionality.
Use Edit tool - Make precise changes to the buggy code.
Verify the fix logic - Ensure the fix addresses the root cause, not just symptoms.
Preserve code style - Match existing formatting, naming conventions, and patterns.
Load testing patterns - Read the appropriate reference file:
references/python-testing.mdreferences/java-testing.mdreferences/cpp-testing.mdCreate test cases covering:
Update existing tests if they exist, or create new test files following language conventions.
Use parametrized tests when testing multiple similar cases.
Execute the tests - Use Bash tool to run the test suite:
pytest test_file.py -vmvn test or gradle test./test_executable or ctestEnsure all tests pass - If tests fail, revisit the fix.
Check coverage - Verify that the fix and related code paths are tested.
Use the report template - Read assets/bug-fix-report-template.md and populate it with:
Be specific and clear - Include code snippets, test results, and reasoning.
Example 1: Python logic error
User: "This factorial function returns 24 instead of 120 for input 5. Fix it."
1. Read the buggy code
2. Identify: off-by-one error in loop range
3. Fix: Change `range(1, n)` to `range(1, n+1)`
4. Generate tests covering 0, 1, 5, negative numbers
5. Run pytest and verify all pass
6. Generate report
Example 2: Java runtime error
User: "My sorting method throws NullPointerException with null elements."
1. Read the code and identify null comparison issue
2. Fix: Add null checks before comparisons
3. Generate JUnit tests for arrays with nulls, empty arrays, normal cases
4. Run tests and verify
5. Generate report
Example 3: C++ logic error with examples
User: "Binary search returns -1 for existing elements. For [1,3,5,7,9] and target 5, should return 2."
1. Read code and trace with provided example
2. Identify: incorrect mid calculation or boundary condition
3. Fix the bug
4. Generate Google Test cases with provided example and additional edge cases
5. Compile and run tests
6. Generate report
Python:
Java:
C++:
references/ - Testing patterns and best practices for each language
assets/ - Bug fix report template for consistent documentation
Take arabelatso/code-repair-generation-combo 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.