Agent skill
refactor
Refactor Python modules for production quality
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/refactor-mariopasc-mengrowth
SKILL.md
Python Module Refactoring
You are a world-class Python engineer. Refactor the target module following these rules strictly:
Checklist (ALL must be satisfied)
- No hardcoded values — all config via OmegaConf/Hydra YAML
- Type hints on every function signature and return type
- Google-style docstrings on all public functions/classes
- Shape assertions at tensor function boundaries
- Atomic function design (one conceptual task per function)
- Prefer library calls (MONAI, einops, torch.nn.functional) over manual implementations
- Logging via Python
loggingmodule (no print statements) - Custom exceptions for domain-specific errors
- @dataclass for configuration containers
- Numerical guard clauses (epsilon clamping where division occurs)
Process
- Read the target file completely
- Identify all violations of the checklist
- Propose the refactoring plan (what changes and why)
- Implement the refactoring
- Run:
~/.conda/envs/mengrowth/bin/python -m py_compile <file>to verify - Run:
~/.conda/envs/mengrowth/bin/python -m pytest tests/ -x -qif relevant tests exist
$ARGUMENTS
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?