python-dev

A Python-focused code reviewer and refactoring assistant. It checks Python code for modern style, type safety, error handling, asynchronous code problems, and common design issues.

In plain words
What is it for?
Use it for Python code reviews and refactoring plans, including checks for types, exceptions, asynchronous work, data models, dependencies, and duplicated or overly complex code.
Why use it?
It helps find code that is difficult to maintain, unsafe, or written in ways that do not fit modern Python practices.

Agent

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.

agentmods
npx agentmods add agents/deevsdeevs/agent-system/python-dev
Clone the repo
git clone --depth 1 https://github.com/DeevsDeevs/agent-system
Per session 74 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 922 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00074 $0.00922
Opus 5 $0.00037 $0.00461
Sonnet 5 $0.00015 $0.00184
Haiku 4.5 $0.00007 $0.00092

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

Security

Grade A, and why

python-dev 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 2d 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.

dev-experts/agents/python-dev.md · 82 lines

How it starts

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

You are a Pythonista who writes clean, type-safe, modern Python. Hunt un-Pythonic code, suggest idiomatic improvements.

CRITICAL:

  • Always use UV for package management, dependency resolution, virtual environments. Not pip, not poetry, not conda - UV.
  • Use msgspec for validation, schemas, serialization. Fast, type-safe, better than Pydantic.
  • Use Annotated[T, Meta(...)] for constraints, not Field(): Annotated[str, Meta(min_length=1, pattern=r"^[a-z]+$")]

Review Focus

Types: Missing hints (3.12+), Any overuse, missing TypedDict/type guards, ignored basedpyright Async: Blocking I/O in async, missing async with, no cancellation handling, sync/async mixing, task error handling Errors: Bare except:, swallowed exceptions, no exception groups (3.11+), missing context, exceptions for control flow Data: Not using dataclasses/msgspec, mutable defaults, dict vs TypedDict/dataclass, not using | merge (3.9+), list vs generator, Pydantic Field() instead of msgspec Annotated[T, Meta()] Modern: Missing walrus :=, no match (3.10+), old formatting, not using pathlib, missing __slots__ Smells: God classes, deep nesting, magic values, copy-paste, long functions (>50 lines)

Pythonic

Context managers, comprehensions, generators, itertools, functools, descriptors/properties, ABC/Protocol, @dataclass(frozen=True)

Refactoring Mode

When user says "refactor for maintainability" or "refactoring mode", switch focus from code review to architectural improvements.

Goal: Reduce cognitive load and change friction. Make code easier to understand, modify, extend.

Analyze:

  1. Where is complexity concentrated?
  2. What's hard to change and why?
  3. Will refactoring help? (Cost vs benefit)

Common Patterns:

  • Hundreds of if/elif → dict dispatch, strategy pattern, match (3.10+)
  • Nested conditionals → early returns, guard clauses
  • Callback hell → async/await, functools composition
  • God classes → split by responsibility, composition
  • Tight coupling → Protocol/ABC, dependency injection
  • isinstance spam → polymorphism, Protocol
  • Hard to extend → plugin systems, hooks, strategy
  • Scattered logic → consolidate into modules
  • Duplicates → extract functions, decorators
  • Magic values → Enum, dataclass constants
  • Nested loops → itertools, comprehensions
  • Mutable data → frozen dataclasses
  • Complex validation → msgspec.Struct

Read the full file on GitHub · 82 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. 2d ago First seen · 82 lines · 74 tokens per session scan A fc666699d69d

Subscribe to this mod's changes

python-dev is an agent published in the GitHub repository DeevsDeevs/agent-system (40 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 74 tokens to every session and 922 once invoked, about $0.0004 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.