skills/code-review/improvement/SKILL.md
Suggest improvements to existing code including refactoring opportunities, performance optimizations, and modernization. Use for identifying technical debt, suggesting refactors, improving code architecture, and modernizing legacy patterns.
npx skillsauth add simplerick0/com.ackhax.configs code-improvementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Identify opportunities to improve existing code quality, performance, and maintainability.
# Before: Long function with multiple responsibilities
def process_order(order):
# Validate
if not order.items:
raise ValueError("Empty order")
if not order.user.is_active:
raise ValueError("Inactive user")
# Calculate totals
subtotal = sum(item.price * item.quantity for item in order.items)
tax = subtotal * 0.1
total = subtotal + tax
# Save
order.subtotal = subtotal
order.tax = tax
order.total = total
order.save()
# After: Extracted methods
def process_order(order):
validate_order(order)
calculate_totals(order)
order.save()
def validate_order(order):
if not order.items:
raise ValueError("Empty order")
if not order.user.is_active:
raise ValueError("Inactive user")
def calculate_totals(order):
order.subtotal = sum(item.price * item.quantity for item in order.items)
order.tax = order.subtotal * TAX_RATE
order.total = order.subtotal + order.tax
# Before: Type-checking conditional
def calculate_area(shape):
if shape.type == 'circle':
return math.pi * shape.radius ** 2
elif shape.type == 'rectangle':
return shape.width * shape.height
elif shape.type == 'triangle':
return 0.5 * shape.base * shape.height
# After: Polymorphic method
class Circle:
def area(self):
return math.pi * self.radius ** 2
class Rectangle:
def area(self):
return self.width * self.height
# Before: Too many parameters
def create_user(name, email, age, address, city, country, phone):
...
# After: Parameter object
@dataclass
class UserData:
name: str
email: str
age: int
address: str
city: str
country: str
phone: str
def create_user(data: UserData):
...
# Before: Repeated expensive computation
def get_user_stats(user_id):
# Complex queries every time
return calculate_stats(user_id)
# After: With caching
from functools import lru_cache
@lru_cache(maxsize=100)
def get_user_stats(user_id):
return calculate_stats(user_id)
# Before: N+1 queries
def get_order_details(order_ids):
orders = []
for order_id in order_ids:
order = Order.query.get(order_id) # N queries
orders.append(order)
return orders
# After: Single query
def get_order_details(order_ids):
return Order.query.filter(Order.id.in_(order_ids)).all()
# Before: Load everything upfront
class Report:
def __init__(self):
self.data = self._load_all_data() # Expensive
# After: Load on demand
class Report:
def __init__(self):
self._data = None
@property
def data(self):
if self._data is None:
self._data = self._load_all_data()
return self._data
## Improvement Suggestions: [File/Module Name]
### High Impact
Improvements with significant benefit, relatively low effort.
#### 1. [Title]
**Current:**
```python
current_code()
Suggested:
improved_code()
Benefits:
Effort: Low/Medium/High
Worth doing but lower priority.
...
Ideas for later, not urgent.
## When NOT to Suggest Improvements
Avoid suggesting changes that:
- Add complexity without clear benefit
- Are purely stylistic preferences
- Would require large rewrites for small gains
- Are speculative ("might be useful someday")
- Break working code for theoretical improvements
Focus on improvements that:
- Fix actual problems (bugs, performance, security)
- Significantly improve maintainability
- Have clear, measurable benefits
- Can be done incrementally
development
Manage VSCode/Cursor configuration in this dotfiles repository. Use when working with settings.json, keybindings.json, or tasks.json files, or when asked about VSCode/Cursor configuration structure.
tools
Design user interfaces and experiences for web applications without requiring design tools. Use for wireframing in text/ASCII, defining user flows, creating component hierarchies, establishing design systems, planning responsive layouts, and making accessibility decisions.
development
Testing specialist focused on comprehensive test coverage for Python applications. Use for pytest patterns, unit/integration/E2E testing, fixtures, mocking, property-based testing with Hypothesis, and factory patterns.
development
Project management adapted for solo developers working without a team. Use for personal project planning, time-boxing work sessions, managing scope creep alone, maintaining momentum on side projects, tracking progress without overhead, making decisions without external input, and staying accountable to yourself.