Skip to main content
skill CX Codex

python-testing-strategies — Claude Code skill for FastAPI tests

A skill that tells your coding agent how to test FastAPI apps: pytest-asyncio, httpx AsyncClient, data factories and the checks every endpoint needs.

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

What python-testing-strategies does

This skill hands the agent a working set of conventions for testing a FastAPI project. It covers the async client built on httpx.AsyncClient with ASGITransport, fixture layout, small factory functions for test data, and test names that say what broke — test_get_item_not_found, test_create_item_missing_name.

Each endpoint gets a checklist: the happy path through create, read, update and delete, a 404 case, a 422 validation error, a 401 when the route is protected, and soft delete where removed rows must not come back. A gotchas section lists the failures that waste the most time. Skip asyncio_mode = "auto" in pyproject.toml and async tests either collect nothing or hang. Reach for Starlette's synchronous TestClient instead of AsyncClient and async bugs stay hidden, because the sync client never touches the event loop. Database state also bleeds across tests unless an autouse=True fixture resets it, and then CI failures depend on run order.

The skill can read, write and edit files, search the project, and run shell commands. Install it with npx skills add for Claude, Codex, Cursor, Gemini CLI or OpenCode; GitHub Copilot uses gh skill install instead.

What it helps with

  • write tests for async FastAPI routes
  • set up conftest.py and a client fixture
  • cover each endpoint with 404, 422 and 401 cases
  • replace copy-pasted dicts with test data factories
  • fix async tests that never get collected

Example prompts for the agent

  • Write tests for the items endpoints following the skill's patterns
  • Set up conftest.py with an AsyncClient and ASGITransport
  • Add an autouse=True fixture that resets the database between tests

How to install python-testing-strategies

1Skills CLI (Vercel)

npx skills add c0x12c/ai-toolkit --skill python-testing-strategies -a claude-code

2Manually: put the files in place

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

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

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about python-testing-strategies

How do I install python-testing-strategies in Claude Code?

Run npx skills add c0x12c/ai-toolkit --skill python-testing-strategies -a claude-code. The skill lands at ~/.claude/skills/python-testing-strategies/SKILL.md.

What does python-testing-strategies do?

It gives the agent FastAPI testing patterns: an async client, fixtures, data factories, and the per-endpoint checks to write.

Why are my async tests not running?

Most likely asyncio_mode = "auto" is missing from pyproject.toml. Without it async tests collect nothing or hang, so the skill says to set it before writing the first one.

Similar skills

All skills for Testing and QA →

From the same set11

testing-strategies Gives your coding agent ready test patterns for a Micronaut and Kotlin backend: integration tests, repository tests, test data builders. CX Codex +1 ★ 109repo stars terraform-review Walks Terraform changes through an 8-category checklist and returns a verdict: Approved, Needs Changes or Blocked. Useful before merging an infrastructure PR. CX Codex +1 ★ 109repo stars startup-pipeline Moves a startup idea through four stages: brainstorm, validation, market research and pitch materials. Gates between stages stop weak ideas early. CX Codex +1 ★ 109repo stars ops-oncall-log Pulls alerts from your monitoring platform and writes a structured on-call log to the team wiki. Useful at the end of a shift or during a review. CX Codex +1 ★ 109repo stars kotlin-best-practices A skill that pins down Kotlin conventions: null safety, Either instead of thrown exceptions, coroutines, and Exposed ORM patterns. Useful while writing or reviewing Kotlin. CX Codex +1 ★ 109repo stars investor-materials A skill for producing investor-facing documents: a pitch deck, one-pager, memo and financial model. Useful when the numbers and the story have to line up across every file. CX Codex +1 ★ 109repo stars design-intelligence Bootstraps a design system from scratch: palette, type scale, spacing, radii and a component inventory in three formats. CX Codex +1 ★ 109repo stars database-patterns Hands your agent a fixed set of database rules: column types, UUID keys, soft deletes and migration templates. Useful when it writes tables or repositories. CX Codex +1 ★ 109repo stars

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