python-testing · mindrally — Claude Code skill: what it does, how to install
Guides the coding assistant to write Python tests using pytest, TDD principles, hypothesis, and mocks. Useful for unit and integration testing.
npx skills add Mindrally/skills --skill python-testing -a claude-codeWhat python-testing does
This skill guides AI agents through Python testing best practices. It instructs the assistant to inspect function signatures and docstrings, structuring tests around the Arrange-Act-Assert layout. Setup and teardown rely on pytest fixtures, while diverse inputs run through parametrize.
The instructions cover unit tests, integration suites for databases or APIs, and property testing with hypothesis. External calls must be isolated using unittest.mock or pytest-mock, verifying mock calls directly. Code coverage reports rely on coverage.py.
Your local environment must have these packages installed. If hypothesis or pytest-mock are missing from your virtualenv, generated test suites will fail on import.
What it helps with
- generate parametrized pytest suites from docstrings and signatures
- mock external services and APIs with unittest.mock or pytest-mock
- set up property-based tests using hypothesis
- write integration tests for database interactions and endpoints
Example prompts for the agent
- Write pytest unit tests for
parse_payloadusing Arrange-Act-Assert - Mock external HTTP calls using pytest-mock for this authentication module
- Create property-based tests with hypothesis to verify invariants in
normalize_text
How to install python-testing
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill python-testing -a claude-code2Manually: put the files in place
~/.claude/skills/python-testing/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/python-testing/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill python-testing -a codex2Manually: put the files in place
.agents/skills/python-testing/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill python-testing -a cursor2Manually: put the files in place
.cursor/skills/python-testing/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills python-testing2Manually: put the files in place
.github/skills/python-testing/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill python-testing -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path python-testingManually: put the files in place
.devin/skills/python-testing/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill python-testing -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about python-testing
How to install python-testing in Claude Code?
Run npx skills add Mindrally/skills --skill python-testing -a claude-code. The file will be placed in ~/.claude/skills/python-testing/SKILL.md.
What does python-testing do?
It directs the AI to follow test-driven development, use the Arrange-Act-Assert pattern, and write isolated unit or integration tests. It also specifies tools like pytest, coverage.py, and hypothesis.
Which Python packages are required?
You need pytest and coverage.py installed in your project. Property-based tests also require hypothesis, and mocking may require pytest-mock.
Source text
SKILL.md · Apache-2.0
--- name: python-testing description: Expert in Python testing with pytest and test-driven development metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # Python Testing You are an expert in Python testing with deep knowledge of pytest, unit testing, and test-driven development. ## Core Principles - Generate unique, diverse, and intuitive unit tests - Base tests on function signatures and docstrings - Follow test-driven development practices - Write comprehensive test coverage ## Test Structure - Use descriptive test names - Follow Arrange-Act-Assert pattern - Keep tests independent - Use fixtures for setup/teardown ## pytest Best Practices - Use parametrize for multiple test cases - Leverage fixtures for reusable setup - Use markers for test categorization - Implement proper assertions ## Test Types ### Unit Tests - Test individual functions in isolation - Mock external dependencies - Test edge cases and boundaries ### Integration Tests - Test component interactions - Use test databases - Test API endpoints ### Property-Based Testing - Use hypothesis for property testing - Generate random test data - Test invariants ## Mocking - Use unittest.mock or pytest-mock - Mock external services - Use patch decorators appropriately - Verify mock calls ## Coverage - Aim for high code coverage - Focus on critical paths - Don't sacrifice quality for coverage - Use coverage.py for reporting
© Mindrally · Apache-2.0 · Mindrally/skills
Similar skills
Everything for Testing and QA →python-testing by other authors comes first.