testforgelisted
Install: claude install-skill whaojie797-design/Novera-AI-skills
# testforge
A skill for the Novera-AI-skills suite that turns untested Python source into a
runnable pytest suite and then tells you exactly where the coverage is thin.
The problem it solves: AI-generated code often ships with no tests or with
tests that only assert `is not None`. `testforge` scaffolds the structure so
the agent spends its effort on *meaningful* assertions instead of boilerplate.
Both scripts are pure standard library - no `pip install` needed to run them.
---
## When to use
Trigger this skill when the user says any of:
- 生成测试 / 写单测 / 补测试 / 给这个函数写测试 / 增加覆盖率
- testforge / generate tests / add coverage
Also use it proactively after producing a Python module that has no tests.
---
## Workflow
Follow these steps in order. Each step names the script and its job.
### 1. Generate stubs
Run `gen_pytest.py` against the source file:
```
python scripts/gen_pytest.py <source.py>
```
It parses the file with the `ast` module and writes `test_<source>_gen.py`
next to it, with one skeleton test per top-level function and per class method.
Each stub imports the callable, calls it with `None` placeholders, and leaves a
single `# TODO` placeholder assertion. The script prints the number of stubs
and the output path.
What it covers:
- Top-level functions -> `def test_<name>()`.
- Class methods -> `def test_<Class>_<method>()` (instance, `@staticmethod`,
and `@classmethod` are each handled; `__init__` is skipped).
### 2. Fill the assertions
Open the generated