/awsh:refactorfrom awsh
Refactors code to improve structure, readability, and maintainability. Supports file-specific, pattern-based, extract, rename, and optimize modes with code smell detection and validation.
Ships in awsh. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
pwdYou are a code refactoring specialist focusing on:
Parse Refactor Request:
Refactoring Analysis:
Execute Refactoring:
Code Analysis Phase:
Refactoring Phase:
Validation Phase:
# Before
def process_data(data):
# Validation logic (20 lines)
if not data:
return None
if len(data) < 10:
raise ValueError("Data too small")
# ... more validation
# Processing logic (30 lines)
result = []
for item in data:
# ... complex processing
return result
# After
def process_data(data):
validate_data(data)
return transform_data(data)
def validate_data(data):
if not data:
return None
if len(data) < 10:
raise ValueError("Data too small")
# ... validation logic
def transform_data(data):
result = []
for item in data:
# ... processing logic
return result
# Before
def calculate_price(product_type, base_price):
if product_type == "book":
return base_price * 0.9
elif product_type == "electronics":
return base_price * 1.2
elif product_type == "clothing":
return base_price * 0.8
# After
class Product:
def calculate_price(self, base_price):
raise NotImplementedError
class Book(Product):
def calculate_price(self, base_price):
return base_price * 0.9
class Electronics(Product):
def calculate_price(self, base_price):
return base_price * 1.2
class Clothing(Product):
def calculate_price(self, base_price):
return base_price * 0.8
# Before
if user.is_active and user.has_permission('edit') and not user.is_blocked and user.verified:
allow_edit()
# After
def can_user_edit(user):
return (user.is_active and
user.has_permission('edit') and
not user.is_blocked and
user.verified)
if can_user_edit(user):
allow_edit()
# Before
if status_code == 200:
return "success"
elif status_code == 404:
return "not found"
elif status_code == 500:
return "error"
# After
HTTP_OK = 200
HTTP_NOT_FOUND = 404
HTTP_SERVER_ERROR = 500
STATUS_MESSAGES = {
HTTP_OK: "success",
HTTP_NOT_FOUND: "not found",
HTTP_SERVER_ERROR: "error"
}
return STATUS_MESSAGES.get(status_code, "unknown")
Refactoring Analysis
===================
📁 File: core/validator.py
📊 Metrics:
- Cyclomatic Complexity: 15 → 8
- Lines of Code: 250 → 180
- Number of Methods: 5 → 12
🔍 Issues Found:
1. Long method: validate_record (45 lines)
2. Duplicate code: Error handling repeated 3 times
3. Complex conditional: 5-level nested if statements
4. Poor naming: Variables 'x', 'tmp', 'data2'
✨ Refactoring Applied:
1. Extracted validate_record into 3 methods
2. Created ErrorHandler class for common error logic
3. Simplified conditionals with early returns
4. Renamed variables for clarity
📝 Changes:
- Created: 3 new methods, 1 new class
- Modified: 12 methods
- Removed: 70 lines of duplicate code
✅ Validation:
- All tests passing (245/245)
- No syntax errors
- Code coverage maintained at 78%
User: /refactor validator.py
Response:
Analyzing validator.py for refactoring opportunities...
I'll identify code smells and apply clean code principles.
User: /refactor parser.py --extract
Response:
Analyzing parser.py for method extraction opportunities...
I'll identify long methods and extract logical components.
User: /refactor --optimize data_processor.py
Response:
Analyzing data_processor.py for performance optimizations...
I'll identify bottlenecks and apply performance-oriented refactoring.
Remember: Refactoring should improve code without changing behavior. Always run tests after refactoring.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
code-refactoring, clean-code, technical-debt, design-patterns
120 skills in this plugin
/acp-driveDrive any external ACP agent from your agent. The Agent Client Protocol lets one agent drive another. When your task needs a different model, a different tool surface, or a sandbox your loop doesn't have, you can hand a sub-problem to an external ACP agent — Claude Code (claude-agent-acp), Codex (codex-acp), Gemini CLI (gemini-cli), or any binary that speaks ACP on stdio — and read back its answer. Your memory, faculties and approval gate stay in charge; the external agent runs its own loop underneath./acp-serveExpose an AitherOS agent to ACP editors. ACP editors — JetBrains IDEs, Zed, VS Code, neovim, Obsidian — drive coding agents over the Agent Client Protocol. adk acp serve makes any AitherOS agent one of those agents: the editor spawns it as a subprocess, and every prompt, permission request and tool round-trip goes over stdio JSON-RPC. Your agent's approval gate maps onto ACP permission requests./adk-deepseek-codernpx claudepluginhub aitherium/awdk --plugin awshOther plugins' skills for the same job