Agent skill

Test Case Reducer

by ArabelaTso in ArabelaTso/Skills-4-SE

Automatically reduces bug-triggering test cases to minimal form while preserving the failure.

Apache-2.0Auto-check passedTesting & QA

Install Test Case Reducer

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill test-case-reducer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE test-case-reducer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/test-case-reducer .claude/skills/test-case-reducer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
test-case-reducer
GitHub stars
253
Token cost
~2.5k tokens
SKILL.md length
847 words
Files
4 (incl. scripts, references)
Skills in repo
151
Repo updated
First seen
Licence
Apache-2.0

At a glance

Automatically reduces bug-triggering test cases to minimal form while preserving the failure.

  • Works in 10 steps: Prepare the Test Case → Define the Oracle → Choose Reduction Strategy → …
  • Debugging with large
  • SKILL.md covers Core Concept, Workflow, Quick Start Examples and Using the Reduction Script, plus 4 more sections
  • Runs Python scripts from its folder; calls python, java and npm

What it does

Test Case Reducer is an agent skill from ArabelaTso/Skills-4-SE. Automatically reduces bug-triggering test cases to minimal form while preserving the failure. Use when debugging with large, complex test cases that need simplification, reproducing bugs with minimal examples, or creating regression tests from verbose failure scenarios. Takes a failing test and systematically removes unnecessary inputs, steps, assertions, and code using delta debugging and other reduction algorithms. Supports unit tests, integration tests, input files, and multiple programming languages (Python…

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including scripts and reference files (for example `references/algorithms.md`, `references/language-specific.md` and `scripts/reduce_test.py`).

It sits in Testing & QA, covering Test generation, State management and Integration testing. It works with JavaScript, Python, C++ and Java. The repository describes itself as: A curated list of 180+ useful Claude Skills for Software Engineering and resources for customizing AI for SE workflows. The licence is Apache-2.0.

When your agent uses it

  • Debugging with large
  • Complex test cases that need simplification
  • Reproducing bugs with minimal examples
  • Creating regression tests from verbose failure scenarios

Example prompts

  • “/test-case-reducer”

Requirements

  • Python 3

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Prepare the Test Case
  2. Define the Oracle
  3. Choose Reduction Strategy
  4. Run the Reduction
  5. Review the Result
  6. Verify Original Failure
  7. Try Removing Large Chunks
  8. Apply Delta Debugging
  9. Clean Up Line by Line
  10. Verify Final Result

What it can do on your machine

Read from SKILL.md and the folder at commit 4f38503. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python
    • java
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Test Case Reducer loads about 2.5k tokens when it runs, and up to ~6.4k if it reads all its reference files. Until then it costs about 140 tokens; SKILL.md has 847 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~140
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from ArabelaTso/Skills-4-SE at commit 4f38503, republished under its Apache-2.0 licence (© ArabelaTso). 847 words, ~2,469 tokens.

Download SKILL.mdSave it as .claude/skills/test-case-reducer/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
test-case-reducer
description
Automatically reduces bug-triggering test cases to minimal form while preserving the failure. Use when debugging with large, complex test cases that need simplification, reproducing bugs with minimal examples, or creating regression tests from verbose failure scenarios. Takes a failing test and systematically removes unnecessary inputs, steps, assertions, and code using delta debugging and other reduction algorithms. Supports unit tests, integration tests, input files, and multiple programming languages (Python, JavaScript, Java, C/C++).

Test Case Reducer

Automatically reduce bug-triggering test cases to minimal form while guaranteeing the reduced test still reproduces the same failure.

Core Concept

Test case reduction works by:

  1. Identify: Parse the test case and identify reducible elements
  2. Remove: Systematically try removing elements (lines, statements, inputs)
  3. Validate: Run the test after each removal to verify failure is preserved
  4. Iterate: Continue until no further reduction is possible

Workflow

1. Prepare the Test Case

Ensure you have:

  • A test case that consistently reproduces the failure
  • A way to run the test (command, script, test framework)
  • A clear failure condition (oracle)
2. Define the Oracle

The oracle determines if the test still exhibits the expected failure:

Exit code:

  • Test fails with specific exit code (e.g., non-zero)
  • Example: --oracle exit_code --expected 1

Exception type:

  • Test raises specific exception
  • Example: --oracle exception --expected ValueError

Output pattern:

  • Test output contains specific text
  • Example: --oracle output_pattern --expected "division by zero"

Assertion:

  • Test fails on specific assertion
  • Example: --oracle assertion --expected AssertionError
3. Choose Reduction Strategy

Aggressive (fastest, smallest result):

  • Binary search reduction first
  • Delta debugging second
  • Greedy line-by-line cleanup
  • Use when: Test execution is fast, minimal size is critical

Balanced (recommended):

  • Delta debugging only
  • Good balance of speed and quality
  • Use when: Standard reduction needs

Conservative (safest, most readable):

  • Greedy line-by-line only
  • Preserves more context
  • Use when: Readability matters, test is already small
4. Run the Reduction

Using the provided script:

bash
python scripts/reduce_test.py test_file.py \
  --command "python test_file.py" \
  --oracle exit_code \
  --expected 1 \
  --strategy balanced

Or manually apply reduction algorithms (see references/algorithms.md).

5. Review the Result

Examine the reduced test case:

  • Verify it still reproduces the failure
  • Check that it's understandable
  • Ensure no critical context was lost

Quick Start Examples

Example 1: Python Unit Test

Original test (15 lines):

python
import unittest
from mymodule import Calculator

class TestCalculator(unittest.TestCase):
    def setUp(self):
        self.calc = Calculator()
        self.test_data = [1, 2, 3, 4, 5]

    def test_divide(self):
        result = self.calc.divide(10, 2)
        self.assertEqual(result, 5)

        result = self.calc.divide(10, 0)  # This fails
        self.assertEqual(result, 0)

if __name__ == '__main__':
    unittest.main()

Reduction command:

bash
python scripts/reduce_test.py test_calc.py \
  --command "python test_calc.py" \
  --oracle exception \
  --expected "ZeroDivisionError"

Reduced test (3 lines):

python
from mymodule import Calculator
Calculator().divide(10, 0)
Example 2: JavaScript Integration Test

Original test (20 lines):

javascript
const request = require('supertest');
const app = require('../app');

describe('API Tests', () => {
    beforeEach(() => {
        // Setup database
        db.reset();
        db.seed();
    });

    it('should handle invalid user ID', async () => {
        const response = await request(app)
            .get('/api/users/invalid')
            .set('Authorization', 'Bearer token')
            .expect(400);

        expect(response.body.error).toBe('Invalid user ID');
    });
});

Reduced test (4 lines):

javascript
const request = require('supertest');
const app = require('../app');

request(app).get('/api/users/invalid').expect(400);
Example 3: Input File Reduction

Original input (100 lines of JSON):

json
{
  "users": [...100 user objects...],
  "settings": {...many settings...},
  "data": [...large data array...]
}

Reduced input (5 lines):

json
{
  "users": [{"id": 42, "name": "Bob"}]
}

Using the Reduction Script

Basic Usage
bash
python scripts/reduce_test.py <test_file> \
  --command "<command to run test>" \
  --oracle <oracle_type> \
  --expected <expected_value>
Parameters

Required:

  • test_file: Path to the test file to reduce
  • --command: Command to execute the test (e.g., python test.py, npm test)
  • --oracle: Type of failure oracle (exit_code, exception, output_pattern, assertion)
  • --expected: Expected value for the oracle

Optional:

  • --strategy: Reduction strategy (aggressive, balanced, conservative)
  • --timeout: Timeout in seconds for test execution
Examples

Python test with exception:

bash
python scripts/reduce_test.py test.py \
  --command "python test.py" \
  --oracle exception \
  --expected "ValueError"

JavaScript test with exit code:

bash
python scripts/reduce_test.py test.js \
  --command "node test.js" \
  --oracle exit_code \
  --expected 1 \
  --strategy aggressive

Java test with timeout:

bash
python scripts/reduce_test.py Test.java \
  --command "javac Test.java && java Test" \
  --oracle output_pattern \
  --expected "NullPointerException" \
  --timeout 10

Manual Reduction Workflow

When not using the script, follow this process:

1. Verify Original Failure
bash
# Run original test
python test.py
# Verify it fails as expected
2. Try Removing Large Chunks

Remove half the test:

python
# Original
line1
line2
line3
line4

# Try first half
line1
line2

# Or second half
line3
line4
3. Apply Delta Debugging

See references/algorithms.md for detailed algorithm.

4. Clean Up Line by Line

Remove one line at a time, testing after each removal.

5. Verify Final Result

Ensure reduced test still fails with same error.

Language-Specific Guidance

For detailed language-specific reduction techniques, see references/language-specific.md.

Python:

  • Remove unused imports
  • Simplify test setup
  • Reduce assertions to minimum

JavaScript:

  • Remove describe blocks if possible
  • Simplify mock setup
  • Reduce to single assertion

Java:

  • Remove @Before/@After if not needed
  • Simplify test class structure
  • Reduce verbose assertions

C/C++:

  • Remove unnecessary includes
  • Simplify test fixtures
  • Reduce to single EXPECT/ASSERT

Common Scenarios

Show full SKILL.md (342 more words)Show less
Scenario 1: Large Integration Test

Problem: Integration test with 200 lines fails intermittently

Solution:

  1. Run test multiple times to ensure consistent failure
  2. Use aggressive strategy for fast reduction
  3. Reduce to minimal API calls that trigger failure
Scenario 2: Complex Input File

Problem: 10MB JSON file causes parser to crash

Solution:

  1. Use binary search to find problematic section
  2. Apply delta debugging to reduce section
  3. Result: Small JSON snippet that triggers crash
Scenario 3: Verbose Unit Test

Problem: Unit test with extensive setup fails on one assertion

Solution:

  1. Use conservative strategy to preserve readability
  2. Remove setup code not needed for failure
  3. Keep minimal context for understanding

Best Practices

Before Reduction
  • Verify determinism: Ensure test fails consistently
  • Backup original: Keep copy of original test
  • Document failure: Note exact error message and conditions
During Reduction
  • Start aggressive: Use aggressive strategy first, then refine
  • Validate frequently: Check each reduction preserves failure
  • Watch for side effects: Be careful with tests that modify state
  • Set timeouts: Prevent hanging on infinite loops
After Reduction
  • Verify manually: Run reduced test several times
  • Check readability: Ensure reduced test is understandable
  • Add comments: Document what the test is checking
  • Create regression test: Use reduced test as regression test

Troubleshooting

Reduction removes too much:

  • Use conservative strategy
  • Preserve specific elements manually
  • Check oracle is correct

Test becomes non-deterministic:

  • Original test may have race condition
  • Run multiple times to verify
  • Consider recording non-deterministic inputs

Reduction is too slow:

  • Use aggressive strategy
  • Increase timeout
  • Simplify test command

Syntax errors after reduction:

  • Use language-aware reduction
  • Preserve structural elements
  • Validate syntax after each step

References

  • algorithms.md: Detailed explanation of delta debugging, binary search, and other reduction algorithms
  • language-specific.md: Language-specific reduction techniques for Python, JavaScript, Java, C/C++

Tips

  • Start with script: Use provided script for automatic reduction
  • Iterate strategies: Try different strategies if first doesn't work well
  • Preserve context: Don't over-reduce; keep enough context to understand
  • Test determinism: Ensure failure is reproducible before reducing
  • Use version control: Commit before reduction to easily revert
  • Document oracle: Clearly specify what constitutes failure

© ArabelaTso, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts, references) in skills/test-case-reducer of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/algorithms.md
  • references/language-specific.md
  • scripts/reduce_test.py

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Test Case Reducer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Test Case Reducer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Test Case Reducer this skillArabelaTso/Skills-4-SE253—~2.5kAutomated safety check: PassApache-2.0
Polyglot Test Agentboshi-xixixi/TraeSkill274—~1.7kAutomated safety check: PassMIT
Fory Version Bumpapache/fory4.6k—~1.1kAutomated safety check: PassApache-2.0
OpenROAD Module Test AdderThe-OpenROAD-Project/OpenROAD3.2k—~1.8kAutomated safety check: PassBSD-3-Clause
Crap Analyzerswingerman/engineer154—~1.2kAutomated safety check: PassMIT
Approval Testing Toolkitlexler/skill-factory239—~1.2kAutomated safety check: PassApache-2.0

Similar skills

  • Polyglot Test Agent

    boshi-xixixi/TraeSkill

    Generates comprehensive, workable unit tests for any programming language using a multi-agent pipeline.

    274 GitHub stars~1.7k tokensUpdated 4 mo ago
    Testing & QAAuto-check passed
  • Bump Apache Fory release or post-release development versions across Java, Kotlin, Scala, Python, Rust, Go, C++, C, Dart, JavaScript, Swift, integration tests, examples, and source docs.

    4.6k GitHub stars~1.1k tokensUpdated today
    MobileAuto-check passed
  • OpenROAD Module Test Adder

    The-OpenROAD-Project/OpenROAD

    Adds integration or unit tests to an OpenROAD module: writes the Tcl test, generates golden files and registers it in both CMake and Bazel.

    3.2k GitHub stars~1.8k tokensUpdated today
    Testing & QAAuto-check passed
  • Crap Analyzer

    swingerman/engineer

    A skill your agent uses to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods.

    154 GitHub stars~1.2k tokensUpdated 14 days ago
    Testing & QAAuto-check passed
  • Approval Testing Toolkit

    lexler/skill-factory

    Writes snapshot-style approval tests in Python, JavaScript, TypeScript or Java, comparing output against an approved file instead of writing individual assertions.

    239 GitHub stars~1.2k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Validation

    josstei/maestro-orchestrate

    Cross-cutting validation methodology for verifying phase outputs and project integrity

    465 GitHub stars~2.3k tokensUpdated today
    Testing & QAAuto-check passed

More from ArabelaTso/Skills-4-SE

All 151 skills in this repo
  • Framework Migration Assistant

    ArabelaTso/Skills-4-SE

    Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).

    253 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Metamorphic Test Generator

    ArabelaTso/Skills-4-SE

    Generate test cases using metamorphic testing by applying transformations based on metamorphic properties.

    253 GitHub stars~798 tokensUpdated 1 mo ago
    Auto-check passed
  • Reproduction Trace Instrumenter

    ArabelaTso/Skills-4-SE

    Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures.

    253 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Spring Mvc To Boot Migrator

    ArabelaTso/Skills-4-SE

    Automatically migrate Spring MVC applications to Spring Boot.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • State Snapshot Instrumenter

    ArabelaTso/Skills-4-SE

    Instrument programs (Python, C/C++, Java) to capture snapshots of key program states at runtime, including variables, memory, and call stacks.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Test Case Reducer

What does Test Case Reducer do?

Automatically reduces bug-triggering test cases to minimal form while preserving the failure. Test Case Reducer is an agent skill from ArabelaTso/Skills-4-SE. Automatically reduces bug-triggering test cases to minimal form while preserving the failure.

When should I use Test Case Reducer?

Test Case Reducer fits situations like: debugging with large; complex test cases that need simplification; reproducing bugs with minimal examples; creating regression tests from verbose failure scenarios.

How do I install Test Case Reducer in Claude Code?

Run `npx skills add ArabelaTso/Skills-4-SE --skill test-case-reducer -a claude-code`. Or copy the skill folder (skills/test-case-reducer in ArabelaTso/Skills-4-SE) into .claude/skills/test-case-reducer in your project. Claude Code loads it when a task matches its description.

How do I install Test Case Reducer in Codex?

Run `npx skills add ArabelaTso/Skills-4-SE --skill test-case-reducer -a codex`. Or copy the skill folder (skills/test-case-reducer in ArabelaTso/Skills-4-SE) into .agents/skills/test-case-reducer in your project. Codex loads it when a task matches its description.

Can I use Test Case Reducer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArabelaTso/Skills-4-SE --skill test-case-reducer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/test-case-reducer, .gemini/skills/test-case-reducer, .github/skills/test-case-reducer and .opencode/skills/test-case-reducer in your project.

What does Test Case Reducer need to run?

Going by SKILL.md and its folder, Test Case Reducer needs Python for the scripts in its folder and the command-line tools its instructions call (python, java and npm). Our summary lists: Python 3.

Does Test Case Reducer access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Test Case Reducer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Test Case Reducer use?

Test Case Reducer is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Test Case Reducer use?

About 2.5k tokens (SKILL.md is roughly 9.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.9k tokens, read only when the agent opens those files.

What are the alternatives to Test Case Reducer?

Skills that share tags, products or a category with Test Case Reducer: Polyglot Test Agent (boshi-xixixi/TraeSkill, 274 stars), Fory Version Bump (apache/fory, 4.6k stars), OpenROAD Module Test Adder (The-OpenROAD-Project/OpenROAD, 3.2k stars) and Crap Analyzer (swingerman/engineer, 154 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Test Case Reducer?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 151 skills in this directory. The repository was last updated on August 21, 2026.

Source: ArabelaTso/Skills-4-SE on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.