← ClaudeAtlas

py-improvelisted

Python code improvement — god-fn splitting / dead code removal / duplicate method merging / dict constant dedup / silent-swallow fixes / logging observability / pre-merge CR. Includes the ruff/vulture/bandit/radon/pyright MCP toolchain. Triggers: god-fn, code review, Python, pytest, mypy, ruff, vulture, refactor, dedup, silent error, god function
liyong-labs/repo-medic · ★ 0 · Code & Development · score 75
Install: claude install-skill liyong-labs/repo-medic
# py-improve — Python code improvement Self-contained skill. Copy the whole directory to share it with other projects. ## 🛑 MANDATORY WORKFLOW — check all before declaring done ### Phase 0: Reconnaissance - [ ] **Read** `references/code-refactor.md` in full (17 phases methodology) - [ ] **Read** `references/code-review-checklist.md` (pre-merge mechanical rules) - [ ] **Read** `references/logging-observability.md` (silent-swallow scan commands) - [ ] **Read** `references/dict-dedup.md` if dict/constant changes involved - [ ] **Run** the silent-swallow scan: `python scripts/silent_swallow.py src/` - [ ] **Run** the reference-residue scan: `python scripts/reorg_drift.py` (if renaming/moving) - [ ] **Build** codegraph (large projects, ≥ 5 min): `codegraph build --no-incremental` - [ ] 🛑 **GATE**: enter Phase 1 only after baseline metrics are captured (no baseline = no improvement evidence) ### Phase 1: Diagnose - [ ] **List god-fn candidates**: cyclomatic > 15 OR > 100 lines (`radon cc -s src/`) - [ ] **List dead-code candidates**: ruff `F401` / `F841` / pyright `reportUnused*` - [ ] **List duplicates**: identical function signatures in ≥ 2 places (grep function def) - [ ] **List dict/constant duplicates**: cross-check against the 4 problem categories in `references/dict-dedup.md` - [ ] 🛑 **GATE**: start editing only after candidates are listed and the user confirms scope (avoids aimless large changes) ### Phase 2: Execute - [ ] **1 commit = 1 logical unit** (hard rule