Skip to content
Back to skills

Refactor

ASecurity

Refactors a file or function for clarity, maintainability, and performance without changing behavior

  • 10 stars
  • 0 votes
  • 0 copies
  • 23 views
  • Added June 1, 2026
ai-agentsrefactoringperformance

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill refactor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor?

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

Security grade badge for Refactor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-refactor/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-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
---
name: refactor
description: Refactors a file or function for clarity, maintainability, and performance without changing behavior
argument-hint: <file-path> [focus-area]
user-invocable: true
allowed-tools: Read Edit Grep
effort: medium
---

## Refactor

Target: **$1**
Focus: **$2** (or general if not specified)

1. Read the file thoroughly.

2. Identify refactoring opportunities:
   - **Extract**: large functions that do multiple things
   - **Simplify**: complex conditionals that can be flattened
   - **Naming**: variables/functions that don't communicate intent
   - **Duplication**: repeated logic that should be a shared utility
   - **Early returns**: replace nested if-else with guard clauses
   - **Data structures**: arrays used where Maps/Sets would be clearer
   - **Async**: callback hell → async/await

3. Show a before/after diff for each change. Explain the reasoning.

4. List any tests that should be updated (behavior must be identical).

5. Ask for confirmation, then apply changes.

**Rule:** Do not change observable behavior. If a change would affect behavior, note it and ask separately.

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…