Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill python-testing -a claude-code
Open on GitHub

What 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_payload using 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-code

2Manually: put the files in place

~/.claude/skills/python-testing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/python-testing/

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.

From the same set168

quarkus A skill that gives your agent Quarkus coding rules: Jakarta EE, MicroProfile, GraalVM native builds and reactive patterns. CX Codex +1 1,000installs prisma Prisma ORM guidelines for schema modeling, type-safe queries, and test isolation. Useful when building a repository layer in Node.js. CX Codex +1 1,000installs matplotlib-best-practices A skill that feeds your agent Matplotlib conventions: plot types, axis labels, colorblind-safe palettes, PDF and PNG export. CX Codex +1 1,000installs mqtt-development A skill that hands your agent a rulebook for MQTT work: topic design, QoS levels, sessions, LWT and transport security. Useful when you build IoT or real-time messaging code. CX Codex +1 1,000installs vuejs-typescript-best-practices Hands your agent a rulebook for Vue.js and TypeScript: Composition API, Pinia, VueUse, Tailwind, plus Vite build tuning. Useful once a Vue codebase outgrows one person's style. CX Codex +1 1,000installs drizzle-orm A skill that gives your agent Drizzle ORM conventions: schema as code, inferred types, queries and migrations. CX Codex +1 1,000installs elasticsearch-best-practices Provides rules and code patterns for Elasticsearch index mappings, shard planning, and search query optimization directly to your agent. CX Codex +1 999installs numpy-best-practices A skill that gives your agent NumPy ground rules: vectorize instead of looping, pick dtypes, watch memory, use np.linalg. Useful whenever Python code crunches numbers. CX Codex +1 997installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor