Agent skill

Test Guided Debloating

by ArabelaTso in ArabelaTso/Skills-4-SE

Removes unnecessary code from a repository while preserving exactly the behavior exercised by a given test suite.

Apache-2.0Auto-check passedTesting & QA

Install Test Guided Debloating

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

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

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE test-guided-debloating --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-guided-debloating .claude/skills/test-guided-debloating && 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-guided-debloating
GitHub stars
253
Token cost
~1.5k tokens
SKILL.md length
429 words
Files
4 (incl. scripts, references)
Skills in repo
170
Repo updated
First seen
Licence
Apache-2.0

At a glance

Removes unnecessary code from a repository while preserving exactly the behavior exercised by a given test suite.

  • Works in 6 steps: Understand Requirements → Run Coverage Analysis → Analyze Coverage Data → …
  • You need to debloat
  • SKILL.md covers Workflow, Key Principles, Common Pitfalls and Helper Script
  • Runs Python scripts from its folder; calls python, pytest and npm

What it does

Test Guided Debloating is an agent skill from ArabelaTso/Skills-4-SE. Removes unnecessary code from a repository while preserving exactly the behavior exercised by a given test suite. Use this skill when you need to debloat, slim down, or remove unused code from a codebase based on test coverage. The skill analyzes which code elements (files, classes, functions, methods, branches, imports) are exercised by tests, identifies unreachable or unused code, and safely removes it while ensuring all tests continue to pass. Triggers when users ask to remove unused code, debloat based on…

Its SKILL.md is about 1.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/coverage_tools.md`, `references/debloating_strategy.md` and `scripts/analyze_coverage.py`).

It sits in Testing & QA, covering Test coverage and Test generation. 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

  • You need to debloat
  • Remove unused code from a codebase based on test coverage
  • Users ask to remove unused code
  • Debloat based on tests

Example prompts

  • “Use the test-guided-debloating skill to remove unnecessary code from a repository while preserving exactly the behavior exercised by a given test…”
  • “/test-guided-debloating”

Requirements

  • Python 3

Workflow steps

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

  1. Understand Requirements
  2. Run Coverage Analysis
  3. Analyze Coverage Data
  4. Incremental Removal
  5. Validate Preservation of Behavior
  6. Document Changes

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
    • pytest
    • npm
    • mvn

    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 Guided Debloating loads about 1.5k tokens when it runs, and up to ~4.7k if it reads all its reference files. Until then it costs about 163 tokens; SKILL.md has 429 words of instructions outside code blocks.

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

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). 429 words, ~1,473 tokens.

Download SKILL.mdSave it as .claude/skills/test-guided-debloating/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
test-guided-debloating
description
Removes unnecessary code from a repository while preserving exactly the behavior exercised by a given test suite. Use this skill when you need to debloat, slim down, or remove unused code from a codebase based on test coverage. The skill analyzes which code elements (files, classes, functions, methods, branches, imports) are exercised by tests, identifies unreachable or unused code, and safely removes it while ensuring all tests continue to pass. Triggers when users ask to remove unused code, debloat based on tests, eliminate dead code guided by test coverage, or slim down a repository to only test-required functionality.

Test-Guided Debloating

Remove unnecessary code from a repository while preserving exactly the behavior exercised by a given test suite.

Workflow

1. Understand Requirements

Inputs needed:

  • Target repository path
  • Test command to run the test suite
  • Programming language/framework

Clarify scope:

  • Which tests define required behavior (all tests, specific test files, integration tests only)?
  • Should test files themselves be preserved (yes, never modify tests)?
  • Are there any files that must be kept regardless of coverage (configuration, documentation)?
2. Run Coverage Analysis

Generate test coverage data to identify exercised code. See coverage_tools.md for language-specific commands.

Python example:

bash
pytest --cov=. --cov-report=json --cov-report=html

JavaScript example:

bash
npm test -- --coverage --coverageReporters=json --coverageReporters=html

Java example:

bash
mvn clean test jacoco:report

Verify:

  • Coverage report generated successfully
  • All tests pass
  • Coverage data includes all source files
3. Analyze Coverage Data

Use scripts/analyze_coverage.py to identify removal candidates:

bash
python scripts/analyze_coverage.py coverage.json --output analysis.json

The script identifies:

  • Uncovered files (0% coverage) - safest to remove
  • Partially covered files - require manual review
  • Uncovered lines - potential dead code within files

Manual review checklist:

  • Are uncovered files truly unused (check imports)?
  • Do uncovered functions have side effects?
  • Are there dynamic imports or reflection?
  • Is this a library with public API requirements?
4. Incremental Removal

Remove code incrementally, validating after each step. See debloating_strategy.md for detailed strategy.

Removal order (safest to riskiest):

  1. Unused imports

    python
    # Remove unused import statements
    # Run tests after removal
  2. Uncovered files (0% coverage, not imported)

    bash
    # Remove file
    rm path/to/unused_file.py
    # Run tests
    pytest
  3. Uncovered functions/methods

    python
    # Remove function definition
    # Run tests
  4. Dead branches

    python
    # Before: if condition that's always true
    if always_true_condition:
        do_something()
    else:
        never_executed()  # Remove this branch
    
    # After:
    do_something()
  5. Unused classes

    python
    # Remove class definition if never instantiated
    # Run tests

After each removal:

bash
# Run full test suite
<test_command>

# Verify all tests pass
# Check for import errors
# Verify build succeeds
Show full SKILL.md (212 more words)Show less
5. Validate Preservation of Behavior

Final validation:

  • All tests pass
  • Build succeeds without errors
  • No import/module errors
  • No runtime errors during test execution
  • Test coverage of remaining code unchanged
  • No modifications to test files

Run tests multiple times to catch flaky tests or timing issues.

6. Document Changes

Generate removal report:

DEBLOATING SUMMARY
==================

Removed Elements:
- 15 unused files
- 42 unused functions
- 8 unused classes
- 156 unused imports
- 23 dead branches

Total lines removed: 3,847
Tests passing: 156/156

Preservation Justification:
All test-defined behavior is preserved because:
1. All test-covered code remains intact
2. All transitive dependencies of test-covered code remain
3. No side effects required by tests were removed
4. Build succeeds and all 156 tests pass

Key Principles

Test-Defined Behavior: The test suite is the single source of truth for required functionality.

Conservative Removal: When in doubt, keep the code. Only remove code you're confident is unused.

Incremental Validation: Remove code in small batches and run tests after each change.

Never Modify Tests: Test files define the required behavior and must not be changed.

Preserve Side Effects: Be cautious with code that has side effects (logging, initialization, registration).

Common Pitfalls

Avoid removing:

  • Code with side effects (module-level initialization, decorators, metaclasses)
  • Code used via reflection or dynamic imports
  • Public API methods (if building a library)
  • Configuration files
  • Error handling needed in production (even if untested)

Watch for:

  • Dynamic behavior (eval, exec, importlib, reflection)
  • Transitive dependencies (code called by covered code)
  • Module-level code execution
  • Static initializers
  • Decorator/annotation side effects

Helper Script

The analyze_coverage.py script automates coverage analysis:

bash
# Analyze Python coverage
python scripts/analyze_coverage.py coverage.json

# Analyze JavaScript coverage
python scripts/analyze_coverage.py coverage-final.json --format javascript

# Save detailed analysis
python scripts/analyze_coverage.py coverage.json --output analysis.json

Output includes:

  • List of uncovered files (safe to remove)
  • Partially covered files (review needed)
  • Uncovered line ranges
  • Safety ratings for removal candidates

© 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-guided-debloating of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/coverage_tools.md
  • references/debloating_strategy.md
  • scripts/analyze_coverage.py

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Test Guided Debloating 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 Guided Debloating compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Test Guided Debloating this skillArabelaTso/Skills-4-SE253—~1.5kAutomated safety check: PassApache-2.0
E2E Test ThinkerUniClipboard/UniClipboard1.9k—~1.7kAutomated safety check: PassAGPL-3.0
Ralph Coveragejvm-skills/jvm-skills140—~683Automated safety check: PassApache-2.0
Designing TestsCloudAI-X/opencode-workflow275—~2.9kAutomated safety check: PassMIT
Mutation Testingproffesor-for-testing/agentic-qe495—~1.7kAutomated safety check: PassMIT
Write Testsgnomeria/usbtree691—~622Automated safety check: PassMIT

Similar skills

  • E2E Test Thinker

    UniClipboard/UniClipboard

    Analyze the current branch's diff against main and determine which changes are testable via CLI-based end-to-end tests.

    1.9k GitHub stars~1.7k tokensUpdated today
    Testing & QAAuto-check passed
  • Ralph Coverage

    jvm-skills/jvm-skills

    Run Ralph in coverage mode — iteratively write tests for untested classes until coverage targets are met.

    140 GitHub stars~683 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Designing Tests

    CloudAI-X/opencode-workflow

    Guides test strategy, TDD/BDD approaches, test coverage planning, and testing best practices.

    275 GitHub stars~2.9k tokensUpdated 9 mo ago
    Testing & QAAuto-check passed
  • Mutation Testing

    proffesor-for-testing/agentic-qe

    Test quality validation through mutation testing, assessing test suite effectiveness by introducing code mutations and measuring kill rate.

    495 GitHub stars~1.7k tokensUpdated 5 days ago
    Testing & QAAuto-check passed
  • Write Tests

    gnomeria/usbtree

    Author tests that match the repo's stack and existing test style, at the cheapest level that catches the regression.

    691 GitHub stars~622 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Mutation Test

    jmagly/aiwg

    Run mutation testing to validate test quality beyond code coverage.

    220 GitHub stars~3.2k tokensUpdated yesterday
    Testing & QAAuto-check passed

More from ArabelaTso/Skills-4-SE

All 170 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 Guided Debloating

What does Test Guided Debloating do?

Removes unnecessary code from a repository while preserving exactly the behavior exercised by a given test suite. Test Guided Debloating is an agent skill from ArabelaTso/Skills-4-SE. Removes unnecessary code from a repository while preserving exactly the behavior exercised by a given test suite.

When should I use Test Guided Debloating?

Test Guided Debloating fits situations like: you need to debloat; remove unused code from a codebase based on test coverage; users ask to remove unused code; debloat based on tests.

How do I install Test Guided Debloating in Claude Code?

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

How do I install Test Guided Debloating in Codex?

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

Can I use Test Guided Debloating 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-guided-debloating -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-guided-debloating, .gemini/skills/test-guided-debloating, .github/skills/test-guided-debloating and .opencode/skills/test-guided-debloating in your project.

What does Test Guided Debloating need to run?

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

Does Test Guided Debloating 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 Guided Debloating 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 Guided Debloating use?

Test Guided Debloating 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 Guided Debloating use?

About 1.5k tokens (SKILL.md is roughly 5.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.2k tokens, read only when the agent opens those files.

What are the alternatives to Test Guided Debloating?

Skills that share tags, products or a category with Test Guided Debloating: E2E Test Thinker (UniClipboard/UniClipboard, 1.9k stars), Ralph Coverage (jvm-skills/jvm-skills, 140 stars), Designing Tests (CloudAI-X/opencode-workflow, 275 stars) and Mutation Testing (proffesor-for-testing/agentic-qe, 495 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Test Guided Debloating?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 170 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.