Safely refactor code while preserving behavior
59
40%
Does it follow best practices?
Impact
91%
1.00xAverage score across 3 eval scenarios
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./music-analytics-api-with-db-routed/.claude/skills/refactor/SKILL.mdUse this skill when you need to refactor existing code, especially when extracting helpers, reorganizing functions, or improving structure without changing behavior.
When extracting logic into a helper:
# Before: Logic embedded in main function
def process_data(items):
# Preparation logic here
prepared = [transform(i) for i in items if valid(i)]
# Main processing
return calculate(prepared)
# After: Helper extracted
def prepare_items(items):
"""Prepare items for processing by filtering and transforming."""
return [transform(i) for i in items if valid(i)]
def process_data(items):
prepared = prepare_items(items)
return calculate(prepared)Always verify tests pass after extraction.
fd49168
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.