Review code for clean code principles, readability, and maintainability:
Analyzes code for clean code violations and suggests specific refactoring improvements.
/plugin marketplace add lwmacct/260112-cc-plugins-study/plugin install general-standards@cc-plugins-studyReview code for clean code principles, readability, and maintainability:
Clean Code Principles (based on Robert C. Martin's Clean Code):
Meaningful Names
dataList unless it's a List)d, lst, tmpdaysSinceLastLogin, userList, tempBufferFunctions Should Be Small
Comments
Error Handling
DRY (Don't Repeat Yourself)
SOLID Principles
Object and Data Structure
user.getAddress().getStreet().getName()user.getStreetName()Code Organization
Testing
Refactoring Smells
Code Smell Detection:
🔴 SMELL: [Code smell type]
Location: [file:line]
Issue: [Description of the problem]
Impact: [Why it's bad]
Refactoring: [Specific refactoring suggestion with example]
Example Refactorings:
# ❌ Before: Long method with multiple responsibilities
def process_user(user):
# validate
if not user.email:
return False
# save
db.save(user)
# send email
email.send(user.email)
return True
# ✅ After: Single Responsibility
def validate_user(user):
return bool(user.email)
def save_user(user):
db.save(user)
def send_welcome_email(user):
email.send(user.email)
def process_user(user):
if not validate_user(user):
return False
save_user(user)
send_welcome_email(user)
return True
Output Format:
🔴 VIOLATION: [Clean Code principle violated]
Location: [file:line]
Principle: [Which principle]
Issue: [What's wrong]
Refactor: [How to fix with example]
💡 SUGGESTION: [Improvement opportunity]
Location: [file:line]
Current: [Current approach]
Better: [Better alternative]
⭐ GOOD: [Highlight good practices]
Location: [file:line]
What: [What was done well]
Focus on the most impactful issues first (duplication, long functions, poor naming).