Code refactor

From laurigates/claude-plugins · View interactive version

Code refactor is an AI agent skill from the GitHub repository laurigates/claude-plugins. Refactor toward pure functions, immutability, composition. Use when extracting pure functions, removing side effects, replacing loops with map/filter/reduce, or separating I/O.

How to use this skill

Skill file

When to Use This Skill

| 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 | |

Context

Parameters

Your task

Delegate this task to the agents-plugin:refactor agent.

Use the Agent tool with subagent_type: agents-plugin:refactor to refactor the specified code. Pass all the context gathered in Context to the agent.

The refactor agent should:

  1. Identify refactoring opportunities — look for these FP code smells:
  1. Apply functional programming principles:
  1. Preserve functionality:
  1. Output the refactored code with clear structure

Provide the agent with:

The agent has expertise in:

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.