Skip to content

Guide · Agent skill

How to use the Python Testing Patterns agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The Python Testing Patterns skill (skill name: python-testing) gives an AI agent a structured playbook for testing Python code with pytest. It is aimed at Python developers, students learning test-driven development, and teams setting up pytest configuration, markers and coverage thresholds. After this guide you will know how to install the skill, how to ask for testing work in plain language, and what to check before running the agent's examples.

Python Testing Patternsaffaan-m/ECC · MIT

Quick start

  1. 1Download the ZIP. Get the python-testing skill ZIP from the skill page on this site.
  2. 2Unzip the skill. Extract the folder so that SKILL.md is inside it.
  3. 3Place it in your skills folder. Copy the folder to ~/.claude/skills/ for personal use, or to .claude/skills/ in a project.
  4. 4Or upload it in the apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the ZIP.
  5. 5Make a natural request. Ask for pytest tests, TDD work, fixtures or coverage review in plain language.
  6. 6Check coverage. Run pytest with --cov and review the missing lines report against the 80% target.

What the skill makes the agent do

When the skill is active, the agent follows a test-driven workflow: it writes a failing test first (red), then the minimum code to make it pass (green), then tidies up while keeping the tests green (refactor).

The skill's guidance covers assertions, fixtures (including setup and teardown, scopes, parameterised fixtures and autouse fixtures), conftest.py for shared fixtures, parametrized tests with readable IDs, custom markers such as slow, integration and unit, and coverage reporting with pytest --cov. It sets a target of 80% or more code coverage and 100% for critical paths. The file also includes mocking and patching examples.

Install the python-testing skill

Download the ZIP from the skill page on this site and unzip it. The skill is a folder containing SKILL.md.

For a personal install, place the folder in ~/.claude/skills/. For a single project, place it in that project's .claude/skills/ folder.

Alternatively, upload the ZIP in the Claude apps under Settings → Capabilities → Skills.

  • Personal: ~/.claude/skills/
  • Project only: .claude/skills/ inside your project
  • Claude apps: Settings → Capabilities → Skills, then upload the ZIP

Trigger the skill with natural requests

You do not need a special command. Ask for Python testing work in ordinary language and the agent will apply the skill when the request matches its purpose: writing new Python code test-first, designing a test suite, reviewing coverage, or configuring test infrastructure.

Name pytest, TDD, fixtures, parametrize or coverage in your request if you want to make the match more certain.

  • Write a pytest test first for a function that validates email addresses, then implement it.
  • Review the test coverage of my Python package and tell me which critical paths are untested.
  • Set up pytest.ini with slow, integration and unit markers for this project.
  • Parametrize these uppercase tests so each input gets its own readable ID.

Example: a red-green-refactor cycle

The skill's basic example shows the cycle on a small addition function. The test is written first and fails because add does not exist yet, then the minimal implementation is added to pass it.

You can ask the agent to work the same way on your own function, and to report coverage afterwards with the pytest --cov command the skill shows.

pytest --cov=mypackage --cov-report=term-missing --cov-report=html

Safety notes: scripts and network

The skill does not run scripts and does not use the network by itself. It is a set of instructions in SKILL.md, so the agent runs pytest only when you or the agent do so in your environment.

Some examples call https://api.example.com with requests.get, and the integration test marked integration would make a real HTTP call if run. Before running integration tests, check the URL, use a test or staging endpoint, and mock external calls where possible. Run only the fast tests with pytest -m "not slow" if you want to avoid long runs.

  • Requires Python with pytest; pytest-cov is needed for coverage reports.
  • Review generated tests before running them against anything that is not local.

Tips for better results

Give the agent your package name, since the coverage example uses mypackage as a placeholder. Say whether your project already has a pytest.ini or conftest.py so the agent extends them rather than duplicating them.

Ask for mocks when code depends on external services or the file system. The skill includes patterns for patching functions, simulating exceptions with side_effect, and mocking open.

  • State your coverage target if it differs from 80%.
  • Ask for the failing test to be shown before the implementation, to keep the TDD order visible.

What people use it for

  • Writing a new Python function test-first using the red-green-refactor cycle.
  • Designing a pytest suite with shared fixtures in conftest.py.
  • Parametrizing input-output tests with readable IDs for validation logic.
  • Adding slow, integration and unit markers and selecting them with pytest -m.
  • Reviewing coverage reports and identifying untested critical paths.

Frequently asked questions

How do I install the python-testing skill?

Download the ZIP from the skill page and unzip it. Put the folder in ~/.claude/skills/ for personal use or in a project's .claude/skills/ folder, or upload the ZIP in the Claude apps under Settings → Capabilities → Skills.

What does the python-testing skill require?

It requires Python and pytest, and pytest-cov if you want coverage reports. According to the listing it does not run scripts and does not use the network.

Is the python-testing skill free?

The skill is listed under the MIT licence. This page does not state pricing, so check the source repository for licence terms.

Does this skill work with JavaScript or Go projects?

No. The patterns are Python-specific and target pytest, so they are not suited to JavaScript or Go projects.

Will the agent run my tests against production?

The skill itself does not run tests. Some examples call https://api.example.com over HTTP, so review any integration tests and use test or staging endpoints before running them.

What coverage level does the skill recommend?

It sets a target of 80% or more code coverage and 100% coverage for critical paths, and shows pytest --cov for measuring it.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you write or review pytest suites in Python, are learning TDD, or need to set up pytest markers and coverage thresholds. Pick something else if your project is not in Python, or if you need an agent that runs integration tests against live systems without careful review of the endpoints it calls.

Download the skill