Skip to content
Back to skills

Code Refactor

ASecurity

Refactor code following SOLID principles and best practices

  • 58 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added February 8, 2026
developmentrefactoringapi

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add laurigates/claude-plugins --skill code-refactor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Refactor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Refactor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/laurigates-code-refactor/badge)](https://www.skillsdirectory.com/skills/laurigates-code-refactor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
model: opus
created: 2025-12-16
modified: 2025-12-16
reviewed: 2025-12-16
allowed-tools: Task, TodoWrite
argument-hint: <file-path|directory>
description: Refactor code following SOLID principles and best practices
name: code-refactor
---

## Context

- Target path: !`test -n "$1" && echo "$1" || echo "NOT_PROVIDED"`
- File type: !`test -n "$1" && file "$1" 2>/dev/null`
- Lines of code: !`test -n "$1" && wc -l "$1" 2>/dev/null`

## Parameters

- `$1`: Required file path or directory to refactor

## Your task

**Delegate this task to the `code-refactoring` agent.**

Use the Task 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:

1. **Identify refactoring opportunities**:
   - Long methods that should be extracted
   - Large classes that need decomposition
   - Duplicated code patterns
   - Feature envy and primitive obsession
   - Complex conditional logic

2. **Apply SOLID principles**:
   - Single Responsibility Principle
   - Open/Closed Principle
   - Liskov Substitution Principle
   - Interface Segregation Principle
   - Dependency Inversion Principle

3. **Apply best practices**:
   - DRY (Don't Repeat Yourself)
   - KISS (Keep It Simple)
   - Extract methods for clarity
   - Introduce meaningful abstractions

4. **Preserve functionality**:
   - Ensure all existing tests pass
   - Maintain the external API contract
   - No behavioral changes

5. **Output the refactored code** with clear structure

Provide the agent with:
- The target file or directory path
- The detected programming language
- Any style guide examples from the project

The agent has expertise in:
- Behavior-preserving code transformations
- Design pattern application
- Code smell detection and remediation
- Semantic code search for similar patterns

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…