Agent skill
Wheels Refactoring
Refactor Wheels code for better performance, security, and maintainability. Use when optimizing code, fixing anti-patterns, improving performance, or enhancing security. Provides refactoring patterns and best practices.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/wheels-refactoring
SKILL.md
Wheels Refactoring
Performance Refactoring
N+1 Query Problem
Before:
<cfloop query="posts">
<p>#posts.user().name#</p> <!--- N+1 queries! --->
</cfloop>
After:
posts = model("Post").findAll(include="user");
<cfloop query="posts">
<p>#posts.userName#</p> <!--- 1 query! --->
</cfloop>
Eager Loading
Before:
posts = model("Post").findAll();
// Associations loaded lazily
After:
posts = model("Post").findAll(include="user,comments,tags");
// All associations loaded upfront
Security Refactoring
Parameter Verification
Before:
function show() {
post = model("Post").findByKey(key=params.key);
}
After:
function config() {
verifies(only="show", params="key", paramsTypes="integer");
}
function show() {
post = model("Post").findByKey(key=params.key);
}
SQL Injection Prevention
Before:
where="userId = #params.userId#" // Vulnerable!
After:
where="userId = #params.userId#" // Wheels escapes automatically
// Or use parameterized queries
Code Quality Refactoring
Extract Method
Before:
function create() {
user = model("User").new(params.user);
user.password = hash(user.password, "SHA-512");
if (user.save()) {
sendMail(to=user.email, subject="Welcome");
redirectTo(action="show", key=user.key());
}
}
After:
function create() {
user = model("User").new(params.user);
if (user.save()) {
redirectTo(action="show", key=user.key());
}
}
// In User model:
private function hashPassword() {
this.password = hash(this.password, "SHA-512");
}
private function sendWelcomeEmail() {
sendMail(to=this.email, subject="Welcome");
}
Generated by: Wheels Refactoring Skill v1.0
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?