adongwanai/agent-ready-template/refactor

Claude Code and agent skill by adongwanai/agent-ready-template

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install adongwanai/agent-ready-template/refactor

SKILL.md

The same SKILL.md was published earlier as adongwanai/agent-ready-template/refactor.

Claude Code Template v1.2


name: refactor description: Safe refactoring playbook with performance, security, and readability focus. Use when improving existing code without changing behavior. For new features, use /tdd-research-first instead. argument-hint: [file-or-module] user-invocable: true


Refactor Skill

Note: For NEW features, use /plan-ceo-review → /tdd-research-first instead.
This skill is for IMPROVING existing code without changing behavior.

Purpose

Guide safe, systematic refactoring that preserves behavior while improving code quality.

Pre-Refactor Checklist

Before starting any refactor:

  • [ ] Tests exist and are passing
  • [ ] Coverage is adequate (≥80% for target code)
  • [ ] Behavior is understood - what should stay the same
  • [ ] Small scope - one refactor at a time
  • [ ] Branch is clean - can rollback easily

Refactor Playbook

Phase 1: Analysis
  1. Read the code thoroughly
  2. Identify code smells (see checklist below)
  3. Prioritize by impact vs. risk
  4. Create a plan with specific steps
Phase 2: Execute
  1. Make one small change
  2. Run tests
  3. Commit if green
  4. Repeat
Phase 3: Verify
  1. Full test suite
  2. Manual smoke test
  3. Performance check (if relevant)
  4. Code review

Code Smells Checklist

Performance
  • [ ] N+1 database queries
  • [ ] Unnecessary loops/recomputations
  • [ ] Large data in memory
  • [ ] Missing indexes
  • [ ] Sync operations that could be async
Security
  • [ ] Exposed sensitive data
  • [ ] Missing input validation
  • [ ] Outdated dependencies
  • [ ] Weak crypto/encoding
Readability
  • [ ] Long functions (>50 lines)
  • [ ] Deep nesting (>3 levels)
  • [ ] Magic numbers/strings
  • [ ] Unclear naming
  • [ ] Missing types (if TypeScript)
  • [ ] Dead code
Maintainability
  • [ ] Code duplication
  • [ ] Tight coupling
  • [ ] Large files (>400 lines)
  • [ ] Mixed responsibilities
  • [ ] Hard-coded values

Safe Refactor Patterns

Extract Function
typescript
// Before
function process(data) {
// 50 lines of mixed logic
}
// After
function process(data) {
const validated = validate(data)
const transformed = transform(validated)
return save(transformed)
}
Rename for Clarity
typescript
// Before
const x = users.filter(u => u.a)
// After
const activeUsers = users.filter(user => user.isActive)
Introduce Type
typescript
// Before
function create(id: string, name: string, email: string)
// After
interface User {
id: string
name: string
email: string
}
function create(user: User)

Risk Levels

LevelRefactor TypeTests Required
LowRename, formatUnit tests
MediumExtract functionUnit + integration
HighChange structureFull suite + manual
CriticalCore logicFull suite + staging

Output Format

## Refactor Plan: [target]
### Current Issues
- [List of identified problems]
### Proposed Changes
1. [Specific change 1]
2. [Specific change 2]
### Risk Assessment
- Level: [Low/Medium/High]
- Affected files: [count]
- Test coverage: [percentage]
### Execution Steps
- [ ] Step 1
- [ ] Step 2
...

Usage

/refactor [file-or-module]

Examples:

  • /refactor src/auth - Analyze auth module
  • /refactor src/utils/date.ts - Specific file

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/adongwanai/agent-ready-template/refactor/badge)](https://verified-skill.com/skills/adongwanai/agent-ready-template/refactor)

Something wrong with this skill or its page? Tell us.