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/refactorSKILL.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-firstinstead.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
- Read the code thoroughly
- Identify code smells (see checklist below)
- Prioritize by impact vs. risk
- Create a plan with specific steps
Phase 2: Execute
- Make one small change
- Run tests
- Commit if green
- Repeat
Phase 3: Verify
- Full test suite
- Manual smoke test
- Performance check (if relevant)
- 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
Rename for Clarity
Introduce Type
Risk Levels
| Level | Refactor Type | Tests Required | |
|---|---|---|---|
| Low | Rename, format | Unit tests | |
| Medium | Extract function | Unit + integration | |
| High | Change structure | Full suite + manual | |
| Critical | Core logic | Full suite + staging |
Output Format
Usage
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
- SKILL.md in the repositoryCheckingtemplate/.claude/skills/refactor/SKILL.md
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
[](https://verified-skill.com/skills/adongwanai/agent-ready-template/refactor)