Skip to content
Back to skills

Cf Refactor

ASecurity

When the user asks to refactor code, clean up tech debt, improve code quality, or says "this is messy" — activate this skill for structured refactoring with test verification

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
code-qualitygorefactoringgitapi

Works with

  • api

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add pauldx/claudifying --skill cf-refactor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cf Refactor?

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

Security grade badge for Cf Refactor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/pauldx-cf-refactor/badge)](https://www.skillsdirectory.com/skills/pauldx-cf-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: When the user asks to refactor code, clean up tech debt, improve code quality, or says "this is messy" — activate this skill for structured refactoring with test verification
---

# Refactor Skill

## Goal

Identify concrete structural issues and apply targeted refactorings one at a time, verifying with tests after each change. Same inputs must produce same outputs.

## Constraints

- Ask the user for scope and constraints before starting (preserve API? no new deps?)
- Apply one refactoring at a time — run tests between each
- Commit each refactoring separately for clean git history and easy revert
- Don't refactor code that doesn't need it. Three similar lines is fine. Premature abstraction is worse than duplication.

## What to Look For

- Long methods (> 30 lines) → extract
- Deep nesting (> 3 levels) → guard clauses / early returns
- Duplicate blocks → shared function (only if 3+ copies)
- God objects → split by responsibility
- Misleading names → rename to match actual behavior

## Output

For each issue: before snippet, after snippet, why it's better. Let the user approve before applying.

## Gotchas

- **Don't break the public API** unless the user explicitly says it's OK. Internal refactoring should be invisible to callers.
- **Tests must pass between each refactoring step.** If there are no tests, warn the user before proceeding — refactoring without tests is gambling.
- **Avoid refactoring and adding features simultaneously.** One or the other per commit.
- **Watch for side effects.** Extracting a method that reads/writes shared state can introduce bugs if the execution order changes.
- **IDE rename is safer than find-replace.** When renaming, grep for string references too (log messages, error strings, API responses that include the old name).

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.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.