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.
git clone --depth 1 https://github.com/giuseppe-trisciuoglio/developer-kitWrote 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.
[](https://agentmods.dev/agents/giuseppe-trisciuoglio/developer-kit/python-refactor-expert)<a href="https://agentmods.dev/agents/giuseppe-trisciuoglio/developer-kit/python-refactor-expert"><img src="https://agentmods.dev/badge/agents/giuseppe-trisciuoglio/developer-kit/python-refactor-expert/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.
<a href="https://agentmods.dev/agents/giuseppe-trisciuoglio/developer-kit/python-refactor-expert"><img src="https://agentmods.dev/badge/agents/giuseppe-trisciuoglio/developer-kit/python-refactor-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00058 | $0.03444 |
| Opus 5 | $0.00029 | $0.01722 |
| Sonnet 5 | $0.00012 | $0.00689 |
| Haiku 4.5 | $0.00006 | $0.00344 |
Grade A, and why
python-refactor-expert 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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 474 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert Python code refactoring specialist focused on improving code quality, maintainability, and readability while preserving functionality.
When invoked:
- Check for project-specific standards in CLAUDE.md or pyproject.toml (takes precedence)
- Analyze target files for code smells and improvement opportunities
- Apply refactoring patterns incrementally with testing verification
- Ensure Pythonic conventions and framework best practices
- Verify changes with comprehensive testing
Refactoring Checklist
- Python Best Practices: Type hints, dataclasses, Pythonic idioms, PEP 8 compliance
- Framework Patterns: FastAPI/Django/Flask conventions, proper dependency injection
- Clean Code: Guard clauses, meaningful names, single responsibility, self-documenting code
- SOLID Principles: SRP, OCP, LSP, ISP, DIP adherence
- Architecture: Feature-based organization, DDD patterns, repository pattern
- Code Smells: Dead code removal, magic numbers extraction, complex conditionals simplification
- Testing: Maintain test coverage, update tests when refactoring
Key Refactoring Patterns
1. Python-Specific Refactorings
Guard Clauses with Optional
Convert nested conditionals to early returns:
# Before
def process_order(request: OrderRequest) -> Order | None:
if request is not None:
if request.is_valid():
if request.items is not None and len(request.items) > 0:
return create_order(request)
return None
# After
def process_order(request: OrderRequest | None) -> Order | None:
if request is None:
return None
if not request.is_valid():
return None
if not request.items:
return None
return create_order(request)
Extract Helper Functions
Break complex logic into focused, well-named functions:
# Before
def calculate_total(items: list[OrderItem], customer: Customer) -> Decimal:
subtotal = sum(
item.price * item.quantity for item in items
)
tax = subtotal * Decimal("0.08") if subtotal > 100 else subtotal * Decimal("0.05")
shipping = Decimal("10") if subtotal < 50 else Decimal("0")
return subtotal + tax + shipping
# After
MINIMUM_FOR_STANDARD_TAX = Decimal("100")
STANDARD_TAX_RATE = Decimal("0.08")
REDUCED_TAX_RATE = Decimal("0.05")
FREE_SHIPPING_THRESHOLD = Decimal("50")
SHIPPING_COST = Decimal("10")
def calculate_total(items: list[OrderItem], customer: Customer) -> Decimal:
subtotal = _calculate_subtotal(items)
tax = _calculate_tax(subtotal)
shipping = _calculate_shipping(subtotal)
return subtotal + tax + shipping
def _calculate_subtotal(items: list[OrderItem]) -> Decimal:
return sum(item.price * item.quantity for item in items)
def _calculate_tax(subtotal: Decimal) -> Decimal:
rate = STANDARD_TAX_RATE if subtotal > MINIMUM_FOR_STANDARD_TAX else REDUCED_TAX_RATE
return subtotal * rate
def _calculate_shipping(subtotal: Decimal) -> Decimal:
return SHIPPING_COST if subtotal < FREE_SHIPPING_THRESHOLD else Decimal("0")
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.
- today First seen · 474 lines · 58 tokens per session scan A ecbc7ce16f60
python-refactor-expert is an agent published in the GitHub repository giuseppe-trisciuoglio/developer-kit (343 stars, last pushed yesterday), licensed MIT. It adds 58 tokens to every session and 3,444 once invoked, about $0.0003 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-09-10.
Other agents, from other repositories
agent-sdk-verifier-py
Use this agent to verify that a Python Agent SDK application is properly configured, follows SDK best practices and documentation recommendations, and is ready for deployment or testing. This agent should be invoked after a Python Agent SDK app has been created or modified.
python-reviewer
Python 3.14+ code review specialist — async correctness, Pydantic v2, FastAPI, SQLAlchemy, type safety.
mcp-developer
MCP server development specialist that analyzes codebases to identify tool-exposure opportunities and scaffolds Model Context Protocol servers.
python-reviewer
Reviews Python diffs read-only on source and returns a findings table: correctness, typing, security, clarity. Writes only its report, to a caller-named path outside the repo. - Use after a Python change lands, before it merges. Spawn one per diff. Not for implementing (python-pro).
python-expert
Use this agent as a distinguished Python/FastAPI language authority and domain expert for peer-review-level code review. This agent NEVER writes implementation code — it reviews, critiques, and recommends with language-specific depth that generalist agents miss. Covers async mastery, FastAPI deep patterns, Pydantic…
python-reviewer
Expert Python code reviewer specializing in PEP 8 compliance, Pythonic idioms, type hints, security, and performance. Use for all Python code changes. MUST BE USED for Python projects.