From pyscn-mcp
Finds refactoring targets in Python code using pyscn: duplicate code (clones), overly complex functions, and dead code. Useful for code cleanup and quality improvements.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pyscn-mcp:refactoringThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Run the pyscn CLI to locate concrete refactoring targets. No install needed: `uvx pyscn@latest <command>`.
Run the pyscn CLI to locate concrete refactoring targets. No install needed: uvx pyscn@latest <command>.
| 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> |
--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.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.
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.
npx claudepluginhub ludo-technologies/pyscn --plugin pyscn-mcpAnalyze Python module architecture using pyscn: class coupling (CBO), cohesion (LCOM), dependency cycles, and module community detection. Helpful for understanding module structure and planning refactors.
Refactors code for reduced duplication, better algorithms, cleaner structure, and architectural fit after rapid development or before releases.
Detects unused Python code including functions, classes, variables, imports using Vulture and deadcode tools. Use for cleaning codebases, removing dead code, or enforcing hygiene in CI.