A Claude Code skill that writes a runnable pytest file for any Python module, covering happy paths, edge cases and error cases. It then runs the file and fixes its own mistakes.
macOS / Linux
git clone --depth 1 https://github.com/daillyteen3056-rgb/python-test-generator-skill.git ~/.claude/skills/python-test-generatorWindows (PowerShell)
git clone --depth 1 https://github.com/daillyteen3056-rgb/python-test-generator-skill.git "$env:USERPROFILE\.claude\skills\python-test-generator"Claude Code picks it up automatically, so no restart is needed. If your skills folder did not exist when the session started, run /reload-skills.
To use it in a single project instead, clone into .claude/skills/python-test-generator inside that project.
Just ask:
- "write tests for utils.py"
- "add unit tests for
parse_date" - "generate pytest for this module"
Or call it directly with /python-test-generator.
- Reads the target file and lists every public function, class and method.
- Follows your project's existing test layout,
conftest.pyand fixtures. - Plans happy-path, edge and error cases for each unit and uses
pytest.raisesfor exact exception types. - Isolates side effects with
tmp_path,monkeypatchandunittest.mock, so it never touches the network. - Uses
@pytest.mark.parametrizewhen 3 or more cases share a shape. - Writes
tests/test_<module>.pyand runs it. A wrong test gets fixed. A real bug in your code gets anxfailmarker, and the skill tells you about it.
It will not write placeholder tests, assert True, or expected values copied from the implementation.
- Claude Code Skills Pack: this skill plus 5 more dev skills (commit messages, PR descriptions, docstrings,
.env.examplegeneration, Dockerfile optimizer). - SkillNest: a searchable directory of 560+ free Claude Code skills.
MIT. Independent project, not affiliated with or endorsed by Anthropic.