**Skill Type**: Actuator (TDD Workflow)
/plugin marketplace add foolishimp/ai_sdlc_method/plugin install aisdlc-methodology@aisdlcThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Skill Type: Actuator (TDD Workflow) Purpose: Improve code quality and enforce Principle #6 ("No Legacy Baggage") by refactoring and pruning technical debt Prerequisites:
You are in the REFACTOR phase of TDD (RED → GREEN → REFACTOR).
Your goal is to improve code quality and eliminate technical debt before committing.
CRITICAL: Before committing, you MUST perform these checks and pruning actions:
# BEFORE
import hashlib # ❌ Not used anywhere
import re # ❌ Not used anywhere
from typing import Dict, List # ✓ Only List is used
# AFTER
from typing import List # ✓ Kept only what's used
# BEFORE
def legacy_hash_password(password): # ❌ No callers
return md5(password)
def hash_password(password): # ✓ Used
return bcrypt.hash(password)
# AFTER
def hash_password(password): # ✓ Kept only what's used
return bcrypt.hash(password)
# BEFORE
def login(email, password):
# Old implementation (broken)
# user = User.query.get(email)
# if user and user.password == password:
# return user
# New implementation
user = User.get_by_email(email)
return authenticate(user, password)
# AFTER
def login(email, password):
user = User.get_by_email(email)
return authenticate(user, password)
# BEFORE (Complexity: 18)
def login(email, password):
if email is None:
return error("Email required")
if not is_valid_email(email):
return error("Invalid email")
if not User.exists(email):
return error("User not found")
user = User.get(email)
if user.is_locked:
if not user.lockout_expired():
return error("Account locked")
else:
user.unlock()
if not user.check_password(password):
user.increment_attempts()
if user.attempts >= 3:
user.lock()
return error("Invalid password")
return success(user)
# AFTER (Complexity: 6)
def login(email, password):
validation_error = validate_login_input(email, password)
if validation_error:
return validation_error
user = get_user_or_fail(email)
if user.is_locked and not user.lockout_expired():
return error("Account locked")
return authenticate_user(user, password)
# Extracted functions (each < 10 lines, complexity < 5)
def validate_login_input(email, password):
if not email:
return error("Email required")
if not is_valid_email(email):
return error("Invalid email")
return None
def get_user_or_fail(email):
if not User.exists(email):
raise UserNotFoundError(email)
return User.get(email)
def authenticate_user(user, password):
if not user.check_password(password):
handle_failed_login(user)
return error("Invalid password")
return success(user)
def handle_failed_login(user):
user.increment_attempts()
if user.attempts >= 3:
user.lock()
# BEFORE
def create_user(email):
if not re.match(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', email):
return error("Invalid email")
# ...
def update_user(email):
if not re.match(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', email):
return error("Invalid email")
# ...
# AFTER
def validate_email(email):
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
return re.match(pattern, email) is not None
def create_user(email):
if not validate_email(email):
return error("Invalid email")
# ...
def update_user(email):
if not validate_email(email):
return error("Invalid email")
# ...
After EVERY refactoring change:
You MUST verify:
If ANY checklist item fails, DO NOT COMMIT. Fix it first.
When you complete the REFACTOR phase, show:
[REFACTOR Phase]
Code Quality Improvements:
✓ Added type hints to 5 functions
✓ Improved variable names (3 changes)
✓ Added docstrings to 2 public methods
Tech Debt Pruning (Principle #6):
✓ Deleted 5 unused imports
✓ Removed 2 dead functions (17 lines deleted)
✓ Deleted 15 lines of commented code
✓ Simplified login() - complexity 18 → 6
✓ Extracted 4 helper functions
✓ Removed code duplication (2 occurrences)
File size: 487 lines → 312 lines (-36%)
Running tests...
✓ All 47 tests passing
Before Commit Checklist:
✓ All tests passing (GREEN)
✓ No unused imports
✓ No dead code
✓ No commented-out code
✓ Max complexity ≤ 10 (current max: 6)
✓ No duplicated code
✓ Code follows style guide
Ready to commit!
Before invoking this skill, ensure:
If prerequisites not met, invoke:
green-phase (if tests not passing)red-phase (if no tests exist)After refactoring is complete:
commit-with-req-tag skill to create git committdd-workflow for next REQ-*)Why explicit pruning?
Homeostasis Goal:
desired_state:
tech_debt: 0
max_complexity: 10
code_duplication: 0
"Excellence or nothing" 🔥
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.