python-tdd-with-uv

python-tdd-with-uv is a skill for Claude Code from spencerpauly/awesome-cursor-skills. It costs 35 tokens per session (704 once invoked), scanned A, original, CC0-1.0.

A Python workflow for test-driven development, or TDD: write a failing test, make it pass with the smallest change, then improve the code. It uses uv to manage the Python project, dependencies, and test commands.

In plain words
What is it for?
Use it to set up a Python project with uv and pytest, design testable interfaces, build features in small vertical slices, and repeat the red-green-refactor cycle.
Why use it?
It keeps implementation tied to tested behavior and encourages small changes that are checked after each step.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Good fit Use it to set up a Python project with uv and pytest, design testable interfaces, build features in small vertical slices, and repeat the red-green-refactor cycle.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/spencerpauly/awesome-cursor-skills/python-tdd-with-uv
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add spencerpauly/awesome-cursor-skills --skill python-tdd-with-uv
Clone the repo
git clone --depth 1 https://github.com/spencerpauly/awesome-cursor-skills

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-tdd-with-uv

README.md
[![agentmods](https://agentmods.dev/badge/skills/spencerpauly/awesome-cursor-skills/python-tdd-with-uv/github.svg)](https://agentmods.dev/skills/spencerpauly/awesome-cursor-skills/python-tdd-with-uv)
Your own site
<a href="https://agentmods.dev/skills/spencerpauly/awesome-cursor-skills/python-tdd-with-uv"><img src="https://agentmods.dev/badge/skills/spencerpauly/awesome-cursor-skills/python-tdd-with-uv/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-tdd-with-uv

Your own site · 80×15
<a href="https://agentmods.dev/skills/spencerpauly/awesome-cursor-skills/python-tdd-with-uv"><img src="https://agentmods.dev/badge/skills/spencerpauly/awesome-cursor-skills/python-tdd-with-uv.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 704 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.00704
Opus 5 $0.00017 $0.00352
Sonnet 5 $0.00007 $0.00141
Haiku 4.5 $0.00003 $0.00070

Measured 9d ago against content hash ddacb34fdb5f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

python-tdd-with-uv scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

resources/python-tdd-with-uv/SKILL.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python TDD with uv

Write Python code test-first using uv for fast dependency and environment management.

Setting Up the Project

  1. Check if uv is installed: uv --version
  2. If the project doesn't have a pyproject.toml, initialize:
    uv init
    
  3. Add pytest as a dev dependency:
    uv add --dev pytest pytest-cov
    
  4. Confirm the test runner works:
    uv run pytest --co
    

TDD Workflow — Vertical Slicing

Work in small cycles. Never write more than one failing test at a time.

Planning Phase

Before writing code, answer:

  1. What interface changes are needed? (functions, classes, APIs)
  2. Which behaviors matter most? (prioritize critical paths)
  3. Can we design for testability? (inject dependencies, avoid global state)

The Cycle

RED   → Write ONE failing test for the next behavior
GREEN → Write the MINIMUM code to make it pass
REFACTOR → Clean up without changing behavior
REPEAT

Rules:

  • Never write implementation before a failing test exists
  • Never write more than one failing test at a time
  • Run uv run pytest after every change
  • Tests must assert observable behavior, not implementation details
  • Mocks should only be used at system boundaries (I/O, network, clock)

Test File Structure

# tests/test_<module>.py

class TestFeatureName:
    """Group related behaviors."""

    def test_does_expected_thing_when_given_input(self):
        result = function_under_test(input_value)
        assert result == expected

    def test_raises_when_given_invalid_input(self):
        with pytest.raises(ValueError):
            function_under_test(bad_input)

Running Tests

uv run pytest                      # all tests
uv run pytest tests/test_foo.py    # single file
uv run pytest -k "test_name"       # by name pattern
uv run pytest --cov=src            # with coverage
uv run pytest -x                   # stop on first failure

uv Essentials

uv add <package>           # add dependency
uv add --dev <package>     # add dev dependency
uv remove <package>        # remove dependency
uv sync                    # sync environment from lockfile
uv run <command>           # run in managed environment
uv lock                    # regenerate lockfile

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 100 lines · 35 tokens per session scan A ddacb34fdb5f

Subscribe to this mod's changes

python-tdd-with-uv is a skill published in the GitHub repository spencerpauly/awesome-cursor-skills (765 stars, last pushed 1mo ago), licensed CC0-1.0. It adds 35 tokens to every session and 704 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.