
python-refactor
by Cissou34730
SKILL.md
name: python-refactor description: Assist with automated, safe, and explainable Python refactorings. Detects simple anti-patterns and offers AST-based transformations with patches and unit-test friendly changes.
Python Refactor Skill
Overview
This skill helps authors and agents perform automated, small, safe Python refactorings. It focuses on detectable, low-risk transformations (formatting to f-strings, simplify boolean expressions, remove unused imports, small function extraction suggestions) and produces patch files or dry-run diffs.
Use this skill when you want a reproducible, reviewable set of refactor suggestions that can be applied automatically or passed to a human reviewer.
Quick Start
- Use the
scripts/analyze.pyto scan a directory for refactor opportunities. - Use the
scripts/refactor.pyto generate patches (preview mode by default). - Use the
scripts/apply_patch.pyto apply confirmed patches safely (creates backups).
When to use
- Large repositories where repetitive low-risk refactors are needed.
- Codebases with inconsistent formatting or migration to modern Python features (f-strings, type hints).
- As a pre-PR pass to reduce mechanical review comments.
Scripts
scripts/analyze.py: static analysis for refactor candidates.scripts/refactor.py: performs AST transforms and outputs unified diffs.scripts/apply_patch.py: applies diffs to files with backups.
Resources
references/python-style-guide.md: opinionated style guidance used by the skill.references/refactoring-patterns.md: patterns the skill recognizes and how it changes code.
Safety and Scope
This skill only performs transformations that can be verified via unit tests. Always run tests after applying patches and review diffs before committing.
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon