python-refactoring

python-refactoring is a skill for Claude Code, Codex from slamer59/mcp-python-refactoring. It costs 42 tokens per session (960 once invoked), scanned A, original, MIT.

A Python code review and refactoring assistant that combines checks for complexity, dead code, security, outdated patterns, dependencies, and missing tests.

In plain words
What is it for?
Use it to inspect Python files or packages, find overly long functions, get extraction guidance, check test coverage, and return machine-readable results.
Why use it?
It brings several separate code-health checks into one analysis workflow before code is changed.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect Python files or packages, find overly long functions, get extraction guidance, check test coverage, and return machine-readable results.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/slamer59/mcp-python-refactoring/skill
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.

Any agent
npx skills add slamer59/mcp-python-refactoring --skill skill
Clone the repo
git clone --depth 1 https://github.com/slamer59/mcp-python-refactoring

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for python-refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/slamer59/mcp-python-refactoring/skill/github.svg)](https://agentmods.dev/skills/slamer59/mcp-python-refactoring/skill)
Your own site
<a href="https://agentmods.dev/skills/slamer59/mcp-python-refactoring/skill"><img src="https://agentmods.dev/badge/skills/slamer59/mcp-python-refactoring/skill/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.

agentmods 80×15 button for python-refactoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/slamer59/mcp-python-refactoring/skill"><img src="https://agentmods.dev/badge/skills/slamer59/mcp-python-refactoring/skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 960 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00042 $0.00960
Opus 5.5 $0.00017 $0.00384
Sonnet 5.5 $0.00008 $0.00192
Haiku 4.5 $0.00004 $0.00096

Measured 11d ago against content hash 13d2fc4f0126, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-refactoring 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 11d 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.

src/mcp_refactoring_assistant/skill/SKILL.md · 99 lines

How it starts

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

Python Refactoring Assistant

This project ships python-refactor-cli, a CLI that wraps rope, radon, vulture, pyrefly, mccabe, complexipy, bandit, pip-audit, and refurb into one set of refactoring-analysis commands. Use it whenever you are about to refactor, review, or assess the health of Python code in this repository.

Primary usage: CLI

Prefer running the CLI directly via subprocess (e.g. the Bash tool) over starting the MCP server for one-off analysis — it's faster and cheaper:

uv run python-refactor-cli <group> <command> --format json ...

Every analysis command supports --format json for machine-parseable output. Commands are grouped by capability (file, test, security, package, repo). Run uv run python-refactor-cli skills to list every command with examples, or uv run python-refactor-cli <group> <command> --help for full option details.

Command reference

Command Target Use it to...
file analyze <file> file Full refactoring analysis of a single file
file long-functions <file> [-t N] file Find functions at/over N lines (candidates for extraction)
file extraction <file> [-fn NAME] file Get step-by-step guidance for extracting a specific function
test coverage <source> [-t tests/] file/dir Find files/functions missing test coverage
test tdd <file> [-fn NAME] file Get Red-Green-Refactor guidance for a function
security scan <file> file Scan for security vulnerabilities, vulnerable deps, and outdated patterns
package analyze <path> package/dir Full structural analysis of a package
package metrics <path> package/dir Complexity, cohesion, coupling, health score
package issues <path> package/dir Structural issues (god package, circular deps, etc.)
package dependencies <path> package/dir Dependency graph and circular-dependency detection

Example:

uv run python-refactor-cli file long-functions src/app.py --line-threshold 30 --format json

Read the full file on GitHub · 99 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. 11d ago Changed · +3 lines 13d2fc4f0126
  2. 1mo ago First seen · 96 lines · 42 tokens per session scan A 8dd418420edc

Subscribe to this mod's changes

python-refactoring is a skill published in the GitHub repository slamer59/mcp-python-refactoring (13 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 960 once invoked, about $0.0002 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-08-30.

Related

Other skills, from other repositories

mcore-linting-and-formatting

Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.

NVIDIA/skills · 44 tokens

splitting-oversized-modules

Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior. Use on a request to split / break up / decompose a god module or move functions out of one, once a human has agreed to…

PostHog/posthog-foss · 197 tokens

splitting-oversized-modules

Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior. Use on a request to split / break up / decompose a god module or move functions out of one, once a human has agreed to…

PostHog/posthog · 197 tokens

plankton-code-quality

Write-time code quality enforcement using Plankton — auto-formatting, linting, and Claude-powered fixes on every file edit via hooks.

loulanyue/awesome-claude-notes · 34 tokens

coding.make_function_private

Identify private or public functions in a file and rename with underscore.

causify-ai/helpers · 12 tokens

best-practices

Language-specific best practices, code quality standards, and framework detection rules. Use when executing refactoring workflows, applying code quality rules, detecting frameworks, or checking language-specific patterns for TypeScript, Python, Go, Swift, or React.

FradSer/dotclaude · 52 tokens