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 chen3feng/agent-skills --skill python-modernization-sweepgit clone --depth 1 https://github.com/chen3feng/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/chen3feng/agent-skills/python-modernization-sweep)<a href="https://agentmods.dev/skills/chen3feng/agent-skills/python-modernization-sweep"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/python-modernization-sweep/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/chen3feng/agent-skills/python-modernization-sweep"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/python-modernization-sweep.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.00037 | $0.04798 |
| Opus 5.5 | $0.00015 | $0.01919 |
| Sonnet 5.5 | $0.00007 | $0.00960 |
| Haiku 4.5 | $0.00004 | $0.00480 |
Grade A, and why
python-modernization-sweep scanned grade A with 1 finding 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 1mo 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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
# PLW1510 on a subprocess.run that returns returncode. How it starts
The opening of the file, as written. The whole thing — 401 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Python modernization sweep
When to use
You own a Python codebase that has just dropped support for an old
interpreter (Py2, or <3.10), and you want to actually use the
newer language features that dropping support unlocked: f-strings,
super(), PEP 585 generics, match statements, type hints, etc.
Signals this skill applies:
- The user says "全面拥抱 Py3 新特性", "modernize this codebase", "clean up the Py2 shim residue", or similar.
- The repo still has
super(Cls, self),class X(object):,'%s' % x,u'...'literals,IOError/EnvironmentError, etc. - There is no (or patchy) type-hint coverage, and the user wants to start adding hints.
This is different from [python-code-audit-sweep] (which finds latent bugs with pyflakes + grep and splits them into bug / dead-code / style PRs). A modernization sweep introduces no bug fixes; every change is either a pure AST-level rewrite or a new type annotation.
Problem
The naive approach is one giant "modernize.py" PR that does everything at once:
- f-string rewrites for every
%and.format()call (often hundreds of sites). super()call modernization.- Dropping
(object)base class. - Adding type hints to every public function.
- Killing
deps=[]mutable-default args. - Turning
except IOErrorintoexcept OSError.
Reviewers cannot tell what is mechanical and what is semantic. The type-hint portion alone needs slow review; the f-string portion is 300 identical rewrites that no human should read line by line. They merge into one blob, one reviewer blocks on the hardest single line, and the whole modernization stalls for weeks.
A second failure mode: guessing what's in the repo. Without a
tool-assisted census, you don't know whether f-string rewrites are
20 sites or 400, whether there are 3 mutable-default anti-patterns
or 167, whether super() rewrites are AST-safe or whether
something is calling a sibling class's __init__ manually. Picking
tools before counting is how you end up writing manual sed scripts
for something pyupgrade --py310-plus would do in one command.
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.
- 1mo ago First seen · 401 lines · 37 tokens per session scan A 6ebb4a8a8317
python-modernization-sweep is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 37 tokens to every session and 4,798 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
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.
git-workflow
Git operations: commits, branches, PRs, and conflict resolution.
refactoring-python
Use when refactoring or modernizing existing Python code without changing behavior: splitting a long function or module, removing drifted duplication, isolating I/O behind a port to make code testable, replacing Java-style classes with idiomatic Python, or judging whether an interface is over-engineering. Triggers…
marketing-council-pack-conventions
Development conventions and patterns for marketing-council-pack. Python project with conventional commits.
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.