Skip to content
Back to skills

Refactor

ASecurity

Refactors the code you name for clarity in small steps, running the tests after each step so behavior never changes.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 15, 2026
ai-agentsgit

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --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/workspace-templates-refactor/badge)](https://www.skillsdirectory.com/skills/workspace-templates-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 the code you name for clarity in small steps, running the tests after each step so behavior never changes.
argument-hint: "[file, function or module]"
user-invocable: true
disable-model-invocation: true
---

Refactor for clarity: $ARGUMENTS

1. Read the code and everything that calls it. Write down in two lines what it does today. Behavior must not change.
2. Run the test suite first and note the result. If the code is not covered, add characterization tests that capture current outputs, including odd cases, and run them green before any edit.
3. List the smells you see (long function, deep nesting, duplicated block, unclear names, mixed concerns) and propose at most five steps, smallest first.
4. Do one step at a time: make the change, run the tests, and move on only when green. If a test fails, undo that step with `git checkout -- <file>` on your own edit and rethink; do not edit the tests to pass.
5. Do not change public signatures, file names or formatting unrelated to the task.
6. Stop after the agreed steps; do not keep polishing.

Finish with the list of steps done, the test results after each, and the diff stat. Ask before committing.

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 ai-agents →

Comments

Loading comments…

Newsletter

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