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.
npx skills add fgmacedo/agent-skills --skill refactoring-pythongit clone --depth 1 https://github.com/fgmacedo/agent-skillsWrote 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/skills/fgmacedo/agent-skills/refactoring-python)<a href="https://agentmods.dev/skills/fgmacedo/agent-skills/refactoring-python"><img src="https://agentmods.dev/badge/skills/fgmacedo/agent-skills/refactoring-python/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/skills/fgmacedo/agent-skills/refactoring-python"><img src="https://agentmods.dev/badge/skills/fgmacedo/agent-skills/refactoring-python.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.00122 | $0.02623 |
| Opus 5.5 | $0.00049 | $0.01049 |
| Sonnet 5.5 | $0.00024 | $0.00525 |
| Haiku 4.5 | $0.00012 | $0.00262 |
Grade A, and why
refactoring-python 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 193 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Python
A refactoring is done when behavior is provably unchanged, the structure is better by a named measure, and each step is a commit a reviewer can verify alone. Tidy first, then change behavior, never both in one commit (Beck). The moves are Fowler's, the patterns Kerievsky's, the idioms Ramalho's.
Do not report done until all five hold:
- Every commit is one named transformation and the suite is green at each one:
python scripts/check_commits.py --base <sha> --test-cmd "<suite>"passes. - No commit mixes structure and behavior.
refactor:/tidy:commits change no assertion and add no test file;test:commits touch only tests;fix:/feat:commits carry a test that fails without them. - Every function you changed was pinned first. A
test:commit with a characterization test precedes the first structural commit on an untested module. - Every seam is real. A dependency the domain cannot run without faking (I/O, clock, randomness) is a parameter or a port; the domain imports no I/O module; nothing abstract has fewer than two implementations unless it wraps I/O.
- Every idiom the user asked for covers the whole module, verified by grep or AST, and no modernization changed an exception type, an ordering, a rounding, a string format or a mutation callers rely on.
Workflow
0. Map the target
Scope (modules, callers, entry points), the test command, the baseline suite result, and the lint and type checks that must stay green. Then:
python scripts/smell_census.py PATHS # long functions, params, nesting, god modules, I/O outside adapters, duplicates
git grep -n "patch(\|patch.object(" tests/ # mock targets that break when names move
Name what the census found with references/smells.md. Order by value to the user (the
extraction, the testability, the readability they asked for); risk decides where you stop
to verify, not what you do first.
1. Pin behavior before the first move
What ships with it
9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/boundaries.md 7.4 KB
- references/pythonic.md 7.4 KB
- references/safety-net.md 5.4 KB
- references/smells.md 8.0 KB
- references/transformations.md 12 KB
- scripts/__pycache__/check_commits.cpython-312.pyc 29 KB
- scripts/check_boundaries.py 4.1 KB runs code
- scripts/check_commits.py 17 KB runs code
- scripts/smell_census.py 12 KB runs code
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.
- 4d ago First seen · 193 lines · 122 tokens per session scan A 79acb55461dc
refactoring-python is a skill published in the GitHub repository fgmacedo/agent-skills (10 stars, last pushed 5d ago), licensed MIT. It adds 122 tokens to every session and 2,623 once invoked, about $0.0005 per session on Opus 5.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-10-14.
Other skills, from other repositories
cuga-contributor-workflows
Run CUGA contributor workflows: Conventional Commits, create pull requests against origin with gh and PR templates, and ruff check/format via uv. Use when the user says commit, create a commit, create PR, pull request, open a PR, ruff check, ruff format, or conventional commits.
marketing-council-pack-conventions
Development conventions and patterns for marketing-council-pack. Python project with conventional commits.
python-modernization-sweep
Plan a Python 3 modernization sweep (f-strings, super(), type hints) as a series of mechanical PRs, not one mega-PR.
marimo-pair
Work inside the user's live marimo notebook from the code editor: run Python in the same kernel the user does, inspect live notebook state, and commit durable notebook changes through code mode. Use whenever you create, analyze, or improve the user's marimo notebook.
safety
Check secret handling, staged changes and push targets, destructive Git operations, Docker image hygiene, and new dependencies before consequential coding actions. Use for commits, pushes, container builds or publishes, dependency additions, and explicit safety reviews.
python-release
Handle Python SDK release, build, bump, packaging metadata, PyPI client pin, uv.lock, nox/build workflow, and publish verification changes. Use for Python release process work or dependency pin bumps; do not use for ordinary Python feature implementation.