py-refactor

Installation
SKILL.md

Python Refactoring & Performance

Overview

Safe refactoring patterns, type safety enforcement, and performance optimization for Python/FastAPI backends.

Core principle: Never refactor without characterization tests. Never optimize without profiling. Always improve type coverage.

3-strikes rule: If the same refactoring approach fails 3 times, stop. The problem is architectural — escalate to system-design for a deeper review instead of thrashing.

Safe Refactoring Process

  1. Write characterization tests — capture current behavior
  2. Run mypy — baseline type errors
  3. Refactor — change structure, preserve behavior
  4. Verify — tests pass, mypy errors same or fewer
  5. Clean up — remove temporary tests if redundant

Architecture Enforcement

Installs
3
GitHub Stars
3
First Seen
12 days ago
py-refactor — vndee/engineering-skills