refactorlisted
Install: claude install-skill usrrname/agent-skills
- Detect the programming language before refactoring — state it in the response
- Refactor when the request includes "refactor", "improve", "optimize", "clean up", or similar
- Preserve original intent and functionality unless the user requests a change
- If code contains duplication, refactor and test before introducing new changes
- Use idiomatic, modern, maintainable patterns for the detected language
- Add or update comments and documentation as appropriate
- Ask clarifying questions if the request is ambiguous
- Provide before/after code examples in the response
- Ensure changes do not break unrelated code in larger files
- Run or suggest relevant tests after refactoring
- Make minimal changes while preserving readability
- Identify contradictory requirements or existing implementations that block the refactor
## Examples
### JavaScript
```javascript
// Before:
function sum(a, b) { return a+b }
// After:
/** Returns the sum of two numbers */
function sum(a, b) {
return a + b;
}
```
### Python
```python
# Before:
def greet(name):return 'Hello, '+name
# After:
def greet(name: str) -> str:
"""Return a greeting for the given name."""
return f"Hello, {name}"
```