AI Skill StudioAI Skill Studio
Presets:

Target Standard & File Format

AI agent rules & skills
Context shields & privacy (ignore files)
Integrations & machine documentation
AI governance & multi-agent planning suite

Identity & Activation Rules

3 chips
Scoped domain keywords evaluated in real time
api-routescode-auditsrefactoring
Suggested chips:

Technology Stack Context

Engineering Philosophy

Flexible & Adaptable

Architectural & Code Quality Conventions

Less rigid & configurable

Agent Behavioral Guardrails

Select active rules
Security & Trust Boundaries
Always included
  • Untrusted Content Is Data
  • Encoded Payloads
  • Least-Privilege File Access
  • Confirm Irreversible Actions
  • Secret Handling
  • Validation Failures
  • Conflicting Requests

Step-by-Step Workflow Procedures

Specialist Persona · Claude Code

Refactoring Claude Skill (Behavior-Preserving)

Generate a Claude Code skill that refactors in small verified steps, pinning behaviour with characterization tests before changing code.

Path
.claude/skills/safe-refactor/SKILL.md
Loads
Description match or /skill-name
Format
Folder skill (SKILL.md)
Used by
Claude Code
All Claude Skill presets and how SKILL.md works

What this file tells the agent

Asked to clean up code, agents rewrite whole files, rename public APIs, and fix unrelated bugs in the same diff, which makes the change impossible to review. This skill pins current behaviour first, applies one small refactoring at a time with tests after each, and keeps public interfaces stable.

  • Add characterization tests before touching uncovered code.
  • One refactoring step at a time, tests after each; revert a step that breaks.
  • Keep exported names, signatures, import paths, and formats stable.
  • Never mix behaviour changes or formatting into a refactor diff.
  • Add an abstraction only when three real call sites need it.

Install it in one command

  1. 01

    Go to your project root

    The file goes at .claude/skills/safe-refactor/SKILL.md, relative to the root.

  2. 02

    Download the file

    Run the command on the right. It downloads this preset and writes the file.

  3. 03

    Make sure it gets used

    Claude Code lists the skill at startup and loads it when a request matches its description. You can also run it with /<skill-name>.

$ mkdir -p ".claude/skills/safe-refactor" && curl -fsSL "https://www.devscratchpad.tech/api/raw/claude-skills/safe-refactor" -o ".claude/skills/safe-refactor/SKILL.md"

writes .claude/skills/safe-refactor/SKILL.md

path

.claude/skills/safe-refactor/SKILL.md

To write the file from your own code instead, use Read your code or Convert Legacy Rules in the editor above.

Questions

How does it choose which refactoring to apply?
The bundled `references/refactoring-catalog.md` maps common smells (long functions, deep nesting, duplication, boolean flags) to small, safe refactorings and what to watch out for.
What if it finds a bug while refactoring?
It notes the bug and fixes it in a separate change, so the refactor diff stays behaviour-neutral.