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 agentmods add skills/ludo-technologies/pyscn/refactoringnpx skills add ludo-technologies/pyscn --skill refactoringgit clone --depth 1 https://github.com/ludo-technologies/pyscnWhat 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 | $0.00052 | $0.00547 |
| Opus 5 | $0.00026 | $0.00273 |
| Sonnet 5 | $0.00010 | $0.00109 |
| Haiku 4.5 | $0.00005 | $0.00055 |
Grade A, and why
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 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.
What it actually says
Python Refactoring Analysis with pyscn
Run the pyscn CLI to locate concrete refactoring targets. No install needed: uvx pyscn@latest <command>.
Commands
| User Request | Command |
|---|---|
| "Find complex functions" | uvx pyscn@latest analyze --select complexity <path> |
| "Find duplicate code" | uvx pyscn@latest analyze --select clones <path> |
| "Find dead code" | uvx pyscn@latest analyze --select deadcode <path> |
| "What should I refactor first?" | uvx pyscn@latest analyze --select complexity,deadcode,clones <path> |
Key Flags
--min-complexity <n>: minimum complexity to report (default: 5). Risk levels: Low (<10), Medium (10-20), High (>20)--clone-threshold <0.0-1.0>: minimum similarity for clone detection (default: 0.65)--min-severity <critical|warning|info>: dead code severity floor (default: warning). Critical means code after return/break/continue/raise that can never execute.--json: write a detailed report with line-level findings. Report files are NOT written to stdout; they go to.pyscn/reports/and the path is printed on completion.
Prioritizing Findings
- Critical dead code: safe deletions, do these first.
- High-complexity functions (>20): extract functions, flatten conditionals.
- Clone groups spanning multiple files: extract shared helpers; clones within one file are usually quicker wins.
When suggesting a refactor, cite the specific function names, files, and line ranges from the results, and re-run the same command afterward to confirm the improvement.
MCP Alternative
If the pyscn-mcp MCP server is connected, you can use its tools instead of the CLI: check_complexity (min_complexity), detect_clones (similarity_threshold, min_lines), find_dead_code, or analyze_code with analyses: ["complexity", "clone", "dead_code"] to run several at once. Results are returned inline with no report files.
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 · 37 lines · 52 tokens per session scan A c8bf61b74aba
refactoring is a skill published in the GitHub repository ludo-technologies/pyscn (1,039 stars, last pushed 3d ago), licensed MIT. It adds 52 tokens to every session and 547 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-08-30.
Other skills, from other repositories
erase
Guided cleanup of CodeEraser findings — read the reports, verify every candidate against the actual code, delete safely, and prove convergence with ce check. Invoke when the user asks to clean up duplication, dead code, or act on CodeEraser findings.
deploy
Invisible to clients.
ok-skill
Discoverable.
greet
Say hello.
code-analysis
Full code navigation — replaces grep, glob, and file reads. Find symbol definitions, trace callers and callees, read source code, and map module structure. Pass symbol names or questions as arguments.
gen-pr
Generate a PR description as a Markdown file in .claude/scratch using git history and code analysis. Fills in the project's PR template.