agentsclimarketplace

Cleantest relevance filter

Skill jimmy0717/cleantest-agent/skills/cleantest-relevance-filter

Determines whether a unit test is relevant to its focal method using AST-based method name matching with LLM fallback for semantic judgment. Triggers: "check test relevance", "filter irrelevant tests", "test-focal method relevance", "检查测试相关性"From its SKILL.md

Install
npx -y skills add jimmy0717/cleantest-agent --skill cleantest-relevance-filter

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.8 KB, 649 tokens by cl100k_base, as published. Nobody here has run it

Relevance Filter

Prerequisites

This skill depends on the open-source cleantest-agent Python package:

pip install cleantest-agent
# or, from a checkout of the project repository:
pip install -e .

For Stage B (LLM semantic judgement) you also need an OpenAI-compatible endpoint. Set:

export OPENAI_API_KEY="sk-..."
export OPENAI_BASE_URL="https://api.deepseek.com/v1"   # any compatible endpoint works

This skill assesses whether a unit test actually tests its paired focal method.

Two-Stage Detection

Stage A: AST Signature Matching (Fast Path)

  1. Parse focal method → extract method name + parameter count + parameter types
  2. Parse test case → extract all method invocations + argument counts + argument types
  3. Check if at least one function call in the test matches the focal method in name, number of parameters, and parameter types
  4. If match found → RELEVANT (pass immediately)
  5. If no match → proceed to Stage B

Stage B: LLM Semantic Judgment (Borderline Cases Only)

Only invoked for samples where Stage A found zero name matches (~12.7% of data).

Given the following focal method and test case:

Focal method:
```java
{src_fm}

Test case:

{target}

The test does NOT directly invoke any method matching the focal method name. However, it might test the focal method indirectly via:

  • Wrapper methods
  • Inheritance / method overriding
  • Aliases or helper methods
  • Testing side effects of the focal method

Is this test case semantically relevant to the focal method? Answer ONLY with:

  • "RELEVANT: <one-line explanation>"
  • "IRRELEVANT: <one-line explanation>"

## Usage

```bash
# Batch mode
python skills/cleantest-relevance-filter/scripts/relevance_filter.py \
  --input_csv <path> \
  --output_csv <path> \
  [--llm_enhance]

# Single sample (LLM judgment)
python skills/cleantest-relevance-filter/scripts/llm_relevance.py \
  --src_fm "public void save(String d) { db.insert(d); }" \
  --target "@Test public void testLen() { assertEquals(5, \"hello\".length()); }"

Example

Input: focal = save(String), test = testLen() (calls length(), not save) Stage A: methods={("save",1)}, invocations={("assertEquals",2),("length",0)} → overlap=0 Stage B (LLM): "IRRELEVANT: test checks String.length(), unrelated to save()" Output: NOISE (no_relevance)

Scripts

  • scripts/relevance_filter.py -- Main filter logic
  • scripts/llm_relevance.py -- LLM fallback client

What ships with it: 3 files

5.1 KB alongside SKILL.md, 2 of them executable

references/

scripts/

Keep looking

Skills are one crate of 326,851. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.