Getting it into your agent
This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.
/plugin marketplace add acaprino/daodan/plugin install python-developmentWrote 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/commands/acaprino/daodan/python-refactor)<a href="https://agentmods.dev/commands/acaprino/daodan/python-refactor"><img src="https://agentmods.dev/badge/commands/acaprino/daodan/python-refactor.svg" alt="Measured on agentmods" 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.00080 | $0.01747 |
| Opus 5 | $0.00040 | $0.00873 |
| Sonnet 5 | $0.00016 | $0.00349 |
| Haiku 4.5 | $0.00008 | $0.00175 |
Grade A, and why
python-refactor 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 yesterday.
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 — 250 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Python Refactoring
CRITICAL RULES
- Execute phases in order. Analysis -> Planning -> Approval -> Execution -> Validation.
- Write output files. Each phase writes to
.python-refactor/for persistence and context. - Stop at checkpoint. Get user approval of the refactoring plan BEFORE making any code changes.
- Run tests after every change. Never proceed if tests fail.
- Never enter plan mode. Execute immediately.
- One pattern at a time. Don't combine multiple refactorings in a single edit.
Pre-flight
1. Check for existing session
Check if .python-refactor/state.json exists:
- If in progress: offer to resume or start fresh
- If complete: offer to archive and start fresh
2. Initialize state
Create .python-refactor/ directory and state.json:
{
"target": "$ARGUMENTS",
"status": "in_progress",
"flags": {
"strict_mode": false
},
"current_phase": 1,
"completed_phases": [],
"files_created": [],
"started_at": "ISO_TIMESTAMP"
}
Phase 1: Analysis
-
Read the target code to understand current structure
-
Run complexity metrics (if available):
uv run python ${CLAUDE_PLUGIN_ROOT}/skills/python-refactor/scripts/measure_complexity.py $ARGUMENTS 2>/dev/null uv run python ${CLAUDE_PLUGIN_ROOT}/skills/python-refactor/scripts/analyze_with_flake8.py $ARGUMENTS 2>/dev/nullIf scripts aren't available, analyze manually by reading the code.
-
Identify issues against thresholds:
- Cyclomatic complexity: >10 per function (high priority)
- Cognitive complexity: >15 per function (high priority)
- Function length: >30 lines (medium priority)
- Nesting depth: >3 levels (medium priority)
-
Establish test baseline:
pytest [test files] -v 2>/dev/null || python -m pytest -v 2>/dev/nullRecord which tests exist and their pass/fail status.
Output file: .python-refactor/01-analysis.md
# Phase 1: Analysis
## Target
[file/directory path]
## Current Metrics
| Metric | Value | Threshold | Status |
|--------|-------|-----------|--------|
| Cyclomatic Complexity (avg) | X | <10 | PASS/FAIL |
| Cognitive Complexity (max) | X | <15 | PASS/FAIL |
| Max Function Length | X lines | <30 | PASS/FAIL |
| Max Nesting Depth | X | <=3 | PASS/FAIL |
## Issues Found
[Ordered by severity: HIGH, MEDIUM, LOW]
## Test Baseline
- Tests found: [count]
- Passing: [count]
- Failing: [count]
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.
- yesterday First seen · 250 lines · 80 tokens per session scan A 2f70a940bf0c
python-refactor is a command published in the GitHub repository acaprino/daodan (8 stars, last pushed yesterday), licensed MIT. It adds 80 tokens to every session and 1,747 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-09-05.
Other commands, from other repositories
type-coverage
Vérification Couverture des Types Python.
execute-pydantic-ai-prp
Implement a Pydantic AI agent using the PRP file.
fastapi
FastAPI application design and implementation conventions. Use this skill when building, updating, or reviewing FastAPI services, routers, dependencies, request/response schemas, streaming endpoints, or API tests. Trigger on FastAPI-specific work such as path operation design, dependency injection, response models…
scaffold-service
Scaffold a thin ArchiPy FastAPI or gRPC service under services/{domain}/v{n}/.
savant-python
Python performance optimization with Python Developer agent.
python-review
Comprehensive Python code review for PEP 8 compliance, type hints, security, and Pythonic idioms. Invokes the python-reviewer agent.