360 Secure SkillHub
360 安全技能中心

safe-refactor

以行为保持为边界的安全重构指引:先建立验证手段再逐步做结构化改动;要求特性变更与重构分离、一次只移动一个归属边界、保持公共接口与失败行为、保持中间状态可构建可测试,改动后用同一验证方式确认行为一致。

JuliusBrussee
热度 0.00
最近更新 2026-10-18 15:52:56
分类:开发依赖:纯提示词应用场景:代码生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add juliusbrussee/caveman/safe-refactor
Metadata
name
safe-refactor
description
Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.

Safe refactor

Define behavior-preservation boundary and establish verification before structural edits.

  • Keep feature changes outside refactor.
  • Move one ownership boundary at a time.
  • Preserve public interfaces, failure behavior, ordering, and compatibility unless explicitly scoped.
  • Keep intermediate states buildable and testable.
  • Avoid dependency or configuration growth without correctness need.

Run same proof after change. Stop when behavior matches and requested structure is achieved.