Guide
What you get: The agent writes typed, ruff-clean, mypy-clean Python with dataclasses instead of dicts, specific exceptions, I/O kept at the edges, and pytest tests in tests/ mirroring the package. Best for Python teams who want an agent to match their typing, linting and test conventions..
Before you start
- A Python project with ruff, mypy and pytest installed as dev dependencies
- Fill python_version, dependency_tool and test_command (we used 3.12, uv, uv run pytest -q)
- Cursor: .cursor/rules/python.mdc. Claude Code/Codex: the same text in CLAUDE.md / AGENTS.md
Worked example (Nov 14, 2026, Claude Code 2.1.318 (claude-opus-5-5); Codex 0.151.0 (gpt-5.6-sol))
Input
A small uv package (invoicekit, src layout, mypy strict) with an existing parse_amount helper. Task: add an importer for supplier CSV invoices (sku, description, qty, unit_price, vat_rate) returning line items and net/VAT/gross totals, reporting malformed rows with row numbers.
Result
Claude Code: frozen dataclasses InvoiceLine/InvoiceTotals/RowError, read_invoice_csv(path) wrapping a pure parse_invoice_csv(text), InvalidRowError for bad rows; 15 tests pass. Codex: frozen slotted dataclasses, import_supplier_csv(path or stream), row-numbered InvoiceRowError list; 11 tests pass.
Not tested in Cursor or Copilot: the rule text was saved verbatim (front matter included) as CLAUDE.md for Claude Code and AGENTS.md for Codex, the files those agents load at startup, plus a copy at its normal path. Re-run by us: uv run pytest -q, uv run mypy src tests (strict), ruff check and ruff format --check all clean for both; no bare except; no new dependencies. Both reused parse_amount and both also fixed it to reject 'NaN'/'Infinity' (and said so).
How to check it worked
- Run the four checks yourself: pytest, mypy, ruff check, ruff format --check
- Check pyproject.toml/uv.lock for unexplained new dependencies
Common problems
- mypy not configured (no [tool.mypy]) makes 'mypy clean' meaningless; set strict or your own flags
- The agent may change existing helpers it reuses; check the diff for edits outside the new module
Log in to join the discussion.