code-quality-plugin/skills/code-refactor/SKILL.md
Refactor toward pure functions, immutability, composition. Use when extracting pure functions, removing side effects, replacing loops with map/filter/reduce, or separating I/O.
npx skillsauth add laurigates/claude-plugins code-refactorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Use this skill when... | Use something else when... |
|------------------------|---------------------------|
| A file or directory has mixed side effects and business logic | Deduplicating code across files → /code:dry-consolidation |
| Functions mutate state or parameters | Detecting code smells without fixing → /code:antipatterns |
| Business logic is tangled with I/O or logging | Reviewing overall quality and architecture → /code:review |
| Imperative loops can be replaced with map/filter/reduce | Large multi-phase refactor spanning 10+ files → /workflow:checkpoint-refactor |
| Deep nesting obscures intent | |
echo "$1"$1: Required file path or directory to refactorDelegate this task to the code-refactoring agent.
Use the Agent tool with subagent_type: code-refactoring to refactor the specified code. Pass all the context gathered above to the agent.
The code-refactoring agent should:
Identify refactoring opportunities — look for these FP code smells:
for, while) that could be map, filter, reduce, or flatMapApply functional programming principles:
spread, map, Object.assign, structural copies)map, filter, reduce, flatMap, findPreserve functionality:
Output the refactored code with clear structure
Provide the agent with:
The agent has expertise in:
/code:complexity/code:dry-consolidation/configure:lintingdevelopment
Debug HTTP APIs: trace requests, inspect headers. Use when a request fails: check status first.
documentation
Render architecture diagrams from text sources. Use when documenting system topology.
tools
Inspect JSON payloads and extract nested fields. Use when parsing API responses.
tools
--- name: no-description allowed-tools: Read --- # No Description This skill has no description and must be dropped with a warning.