Agent Skill
2/7/2026testing
This skill should be used when the user asks to "write tests", "add tests", "create test cases", or when implementing tests as part of a feature or bug fix task.
D
dimigor
0GitHub Stars
1Views
npx skills add dimigor/dotfiles
SKILL.md
| Name | testing |
| Description | This skill should be used when the user asks to "write tests", "add tests", "create test cases", or when implementing tests as part of a feature or bug fix task. |
name: testing description: This skill should be used when the user asks to "write tests", "add tests", "create test cases", or when implementing tests as part of a feature or bug fix task.
Writing Tests
Rules
- Reuse test files - Add tests to existing files when appropriate
- Use parametrized tests - Group cases with same expected behavior via
@pytest.mark.parametrize - No obvious comments - Code should be self-explanatory
- Follow existing style - Match patterns in the existing test suite
- Imports at module level - Only import inside functions when absolutely necessary
- Reuse fixtures - Use existing fixtures; create new ones only when needed
- Avoid mocks when possible - Prefer real implementations for internal code; mock only external services
- Use appropriate mocking tools - Use
respxfor HTTP APIs, library
Test Naming
Name tests using the pattern: test_<what>_<condition>_<outcome>
Examples:
test_login_valid_credentials_succeedstest_process_payment_insufficient_funds_raises_errortest_parse_json_invalid_input_returns_none
Test Structure
- Test all paths - Happy path, edge cases, and error conditions
- One assertion focus - Each test should verify one specific behavior
- Arrange-Act-Assert - Set up, execute, verify (AAA pattern)
Common Pytest Features
- Fixtures:
@pytest.fixturefor shared setup/teardown - Mocking:
monkeypatchfixture for patching - Temp files:
tmp_pathfixture for file system tests - Assertions: Use
pytest.raises(ExceptionType)for exception testing
Skills Info
Original Name:testingAuthor:dimigor
Download