Agent skill
refactor-suggestions
Suggest refactors for modified code focusing on security, maintainability, readability, and functional programming purity
Stars
163
Forks
31
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/refactor-suggestions
SKILL.md
Refactor Suggestions
Inspect the repository for code changes and recommend refactors.
Procedure
Phase 1 - Get the Changes
- Get all changes in this branch compared to the default branch since it diverged
- Scoped from those changes, analyze code from modified and added functions
- Suggest (do not re-write functions) refactors focused on:
- Security
- Maintainability
- Readability
- Logic flow
- Functional programming purity
Refactor Categories to Consider
- Increases purity and immutability
- Reduces side effects and shared state
- Improves readability and testability
- Eliminates security anti-patterns
- Simplifies complex conditionals
- Extracts reusable utilities
- Improves error handling
Phase 2 - Return Suggestions
Return Markdown structured as follows:
markdown
# Suggestions
**functionName**
location: src/path/to/file.ts `functionName`
description: Detailed explanation of why this function should be refactored
refactor strategy: Explain rationale explicitly
refactored code:
function() { // suggested implementation }
**anotherFunction**
...
Constraints
- Analyze only within the given code. Do not invent missing context or external APIs
- Be deterministic and concise
- Focus on actionable, specific suggestions
Didn't find tool you were looking for?