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 · Windsurf Cascade

Behavior-Preserving Refactoring Windsurf Cascade Rules

Generate Windsurf Cascade rules for Behavior-Preserving Refactoring in .windsurf/rules/, with the stack's conventions and checks.

Path
.windsurf/rules/safe-refactor.md
Loads
Per-rule trigger
Format
Markdown with frontmatter (.md)
Used by
Windsurf Cascade
All Windsurf presets and how <rule-name>.md works

What this file tells the agent

Windsurf's Cascade agent reads rules from .windsurf/rules/. This rule gives Cascade the Behavior-Preserving Refactoring conventions, commands and patterns to avoid, so its edits follow the stack instead of generic or outdated defaults.

  • 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 .windsurf/rules/safe-refactor.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

    Cascade reads rules in .windsurf/rules/ and applies this one according to its trigger.

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

writes .windsurf/rules/safe-refactor.md

path

.windsurf/rules/safe-refactor.md

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

Questions

Where do I save this Windsurf rule?
Save it as .windsurf/rules/safe-refactor.md in your project. Cascade picks up rules in that folder automatically.
When does Windsurf apply this rule?
According to the trigger in its frontmatter: always on, on a glob match, when Cascade decides the description fits the task, or when you @-mention it.