Automates the generation of structured, CI-passing pytest suites for specific Python game modules.
Install
mkdir -p .claude/skills/test-case-generator && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15339" && unzip -o skill.zip -d .claude/skills/test-case-generator && rm skill.zipInstalls to .claude/skills/test-case-generator
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Generates pytest test cases for new or modified robot-pokemon code. Use when a new feature, function, or module needs test coverage — produces correctly structured test classes with fixtures, assertions, and lint-clean code.Key capabilities
- →Generate pytest test cases for new or modified robot-pokemon code
- →Map source files to corresponding test files following naming conventions
- →Create test classes with fixtures like GameState and MockRichLog
- →Write assertions based on expected game behavior
- →Ensure lint-clean code in generated tests
How it works
The skill takes input on files and functions to test, then generates pytest test cases. It follows specific naming conventions, includes fixtures, and writes assertions based on coverage-guided test writing principles, ensuring lint-clean code.
Inputs & outputs
When to use test-case-generator
- →Generating unit tests for new features
- →Increasing test coverage
- →Writing tests for game logic
About this skill
test-case-generator
Generates complete, CI-passing pytest test files for new robot-pokemon features.
Associated Agent
test-writer.agent.md
Instructions
1. Input
- File(s) to test — e.g.
pytemon/buildings.py - Functions/classes — which functions need coverage
- Current coverage — run
pytest --cov-report=term-missingand paste the MISS lines - Fixtures needed —
gs(GameState),output(MockRichLog), or custom
2. File Naming and Structure
pytemon/buildings.py → tests/test_buildings.py
pytemon/ui/battle_mixin.py → tests/test_battle_mixin.py
# tests/test_buildings.py
import pytest
from pytemon.buildings import enter_bike_shop, heal_all_pokemon
from tests.conftest import MockRichLog # or define inline if not in conftest
class TestBikeShop:
def test_gives_bicycle_on_first_visit(self, gs, output):
enter_bike_shop(gs, output)
assert gs.game_data["bag"].get("Bicycle") == 1
assert gs.game_data["story_flags"].get("received_bicycle") is True
def test_no_duplicate_bicycle_on_repeat(self, gs, output):
enter_bike_shop(gs, output)
enter_bike_shop(gs, output)
assert gs.game_data["bag"].get("Bicycle") == 1 # still 1, not 2
def test_repeat_visit_message(self, gs, output):
enter_bike_shop(gs, output)
output.lines.clear()
enter_bike_shop(gs, output)
assert any("already" in str(l).lower() or "enjoying" in str(l).lower()
for l in output.lines)
3. Coverage-Guided Test Writing
From --cov-report=term-missing output:
buildings.py 72% MISS 45-52, 88, 101-110
Map line numbers back to uncovered branches:
- Lines 45-52 → missing
elsebranch of a condition → add a test hitting that branch - Line 88 → error path → add a test with invalid input
- Lines 101-110 → repeat-visit block → add a "second call" test
4. Lint Rules to Follow in Test Code
# ❌ F841 — unused variable
result = some_function() # result never used after
# ✅
some_function()
# ❌ RUF059 — unused unpacked slot
caught, shakes, messages = attempt_catch(...) # messages unused
# ✅
caught, shakes, _ = attempt_catch(...)
# ❌ I001 — unsorted imports
import pytest
import os # os should come before pytest
# ✅
import os
import pytest
5. Output
- Complete test file or test class, ready to paste into
tests/ - Coverage statement ("these tests should bring coverage from X% to Y%")
Examples
Input: "Generate tests for exploration.py move_to_location — currently at 62% coverage."
Output skeleton:
class TestMoveToLocation:
def test_valid_move_succeeds(self, gs, output):
# arrange: player at Pallet Town which connects to Route 1
assert gs.current_location == "Pallet Town"
move_to_location(gs, "Route 1", output, lambda: None)
assert gs.current_location == "Route 1"
def test_invalid_destination_shows_error(self, gs, output):
move_to_location(gs, "Nowhere", output, lambda: None)
assert any("can't" in str(l).lower() or "not" in str(l).lower() for l in output.lines)
def test_blocked_exit_respects_badge_gate(self, gs, output):
gs.current_location = "Cerulean City"
move_to_location(gs, "Route 24", output, lambda: None)
assert gs.current_location == "Cerulean City" # didn't move
Dependencies
tests/conftest.py—gsandoutputfixtures,MockRichLogpytest— test runnerpytemon/— modules under test
Error Handling
- Test imports fail: check for a circular import or missing
__init__.pyintests/ - Fixture not found: confirm fixtures are defined in
conftest.pyor the test file itself - Coverage not improving: re-run with
--cov-report=term-missingand check if new tests hit the MISS lines
When not to use it
- →When testing code outside the robot-pokemon project
- →When the goal is not to increase test coverage or write unit tests
- →When test imports fail due to circular dependencies or missing __init__.py
Prerequisites
Limitations
- →Specific to robot-pokemon code
- →Requires `pytest` as the test runner
- →Relies on `tests/conftest.py` for fixtures
How it compares
This skill generates structured, CI-passing pytest test files specifically for the robot-pokemon project, adhering to its conventions and coverage goals, unlike general test generation tools.
Compared to similar skills
test-case-generator side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| test-case-generator (this skill) | 0 | 4mo | No flags | Intermediate |
| adk-engineer | 3 | 1mo | Review | Advanced |
| unit-testing-test-generate | 2 | 4mo | Review | Intermediate |
| playwright-roll | 2 | 2mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
adk-engineer
jeremylongshore
Execute software engineer specializing in creating production-ready ADK agents with best practices, code structure, testing, and deployment automation. Use when asked to "build ADK agent", "create agent code", or "engineer ADK application". Trigger with relevant phrases based on skill purpose.
unit-testing-test-generate
sickn33
Generate comprehensive, maintainable unit tests across languages with strong coverage and edge case focus.
playwright-roll
microsoft
Roll Playwright Python to a new version
api-test-generator
mikopbx
Генерация полных Python pytest тестов для REST API эндпоинтов с валидацией схемы. Использовать при создании тестов для новых эндпоинтов, добавлении покрытия для CRUD операций или валидации соответствия API с OpenAPI схемами.
designing-tests
CloudAI-X
Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.
test-coverage-improver
openai
Improve test coverage in the OpenAI Agents Python repository: run `make coverage`, inspect coverage artifacts, identify low-coverage files, propose high-impact tests, and confirm with the user before writing tests.