Agent Skill
2/7/2026

testing

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

Nametesting
DescriptionThis 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

  1. Reuse test files - Add tests to existing files when appropriate
  2. Use parametrized tests - Group cases with same expected behavior via @pytest.mark.parametrize
  3. No obvious comments - Code should be self-explanatory
  4. Follow existing style - Match patterns in the existing test suite
  5. Imports at module level - Only import inside functions when absolutely necessary
  6. Reuse fixtures - Use existing fixtures; create new ones only when needed
  7. Avoid mocks when possible - Prefer real implementations for internal code; mock only external services
  8. Use appropriate mocking tools - Use respx for HTTP APIs, library

Test Naming

Name tests using the pattern: test_<what>_<condition>_<outcome>

Examples:

  • test_login_valid_credentials_succeeds
  • test_process_payment_insufficient_funds_raises_error
  • test_parse_json_invalid_input_returns_none

Test Structure

  1. Test all paths - Happy path, edge cases, and error conditions
  2. One assertion focus - Each test should verify one specific behavior
  3. Arrange-Act-Assert - Set up, execute, verify (AAA pattern)

Common Pytest Features

  • Fixtures: @pytest.fixture for shared setup/teardown
  • Mocking: monkeypatch fixture for patching
  • Temp files: tmp_path fixture for file system tests
  • Assertions: Use pytest.raises(ExceptionType) for exception testing
Skills Info
Original Name:testingAuthor:dimigor