refactor — for Claude Code refactor, psc-comet, community, for Claude Code, ide skills, Behavior-preserving, restructuring, different, structure, produces

v0.1.0

关于此技能

适用场景: Ideal for AI agents that need behavior-preserving restructuring. the goal is a different structure that produces identical. 本地化技能摘要: # Refactor Skill Behavior-preserving restructuring. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

功能特性

Behavior-preserving restructuring. The goal is a different structure that produces identical
What Claude Gets Wrong Without This Skill
The Behavior Contract
The One-Change Rule
One structural change at a time:

# 核心主题

andrem-sec andrem-sec
[1]
[0]
更新于: 4/2/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 8/11

This page remains useful for operators, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution
Review Score
8/11
Quality Score
44
Canonical Locale
en
Detected Body Locale
en

适用场景: Ideal for AI agents that need behavior-preserving restructuring. the goal is a different structure that produces identical. 本地化技能摘要: # Refactor Skill Behavior-preserving restructuring. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

核心价值

推荐说明: refactor helps agents behavior-preserving restructuring. the goal is a different structure that produces identical. Refactor Skill Behavior-preserving restructuring. This AI agent skill supports Claude Code

适用 Agent 类型

适用场景: Ideal for AI agents that need behavior-preserving restructuring. the goal is a different structure that produces identical.

赋予的主要能力 · refactor

适用任务: Applying Behavior-preserving restructuring. The goal is a different structure that produces identical
适用任务: Applying What Claude Gets Wrong Without This Skill
适用任务: Applying The Behavior Contract

! 使用限制与门槛

  • 限制说明: Do not batch. Do not "while I'm in here" add improvements. Do not rename AND restructure in one change.
  • 限制说明: Remove duplication Same logic in 3+ places — but only if the logic is genuinely identical, not just similar
  • 限制说明: Do not refactor code you do not understand. Read it until you can state its behavior contract before touching it.

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.
  • - The underlying skill quality score is below the review floor.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

评审后的下一步

先决定动作,再继续看上游仓库材料

Killer-Skills 的主价值不应该停在“帮你打开仓库说明”,而是先帮你判断这项技能是否值得安装、是否应该回到可信集合复核,以及是否已经进入工作流落地阶段。

实验室 Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

常见问题与安装步骤

以下问题与步骤与页面结构化数据保持一致,便于搜索引擎理解页面内容。

? FAQ

refactor 是什么?

适用场景: Ideal for AI agents that need behavior-preserving restructuring. the goal is a different structure that produces identical. 本地化技能摘要: # Refactor Skill Behavior-preserving restructuring. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

如何安装 refactor?

运行命令:npx killer-skills add andrem-sec/psc-comet/refactor。支持 Cursor、Windsurf、VS Code、Claude Code 等 19+ IDE/Agent。

refactor 适用于哪些场景?

典型场景包括:适用任务: Applying Behavior-preserving restructuring. The goal is a different structure that produces identical、适用任务: Applying What Claude Gets Wrong Without This Skill、适用任务: Applying The Behavior Contract。

refactor 支持哪些 IDE 或 Agent?

该技能兼容 Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer。可使用 Killer-Skills CLI 一条命令通用安装。

refactor 有哪些限制?

限制说明: Do not batch. Do not "while I'm in here" add improvements. Do not rename AND restructure in one change.;限制说明: Remove duplication Same logic in 3+ places — but only if the logic is genuinely identical, not just similar;限制说明: Do not refactor code you do not understand. Read it until you can state its behavior contract before touching it.。

安装步骤

  1. 1. 打开终端

    在你的项目目录中打开终端或命令行。

  2. 2. 执行安装命令

    运行:npx killer-skills add andrem-sec/psc-comet/refactor。CLI 会自动识别 IDE 或 AI Agent 并完成配置。

  3. 3. 开始使用技能

    refactor 已启用,可立即在当前项目中调用。

! 参考页模式

此页面仍可作为安装与查阅参考,但 Killer-Skills 不再把它视为主要可索引落地页。请优先阅读上方评审结论,再决定是否继续查看上游仓库说明。

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

refactor

# Refactor Skill Behavior-preserving restructuring. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows. Behavior-preserving

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

Refactor Skill

Behavior-preserving restructuring. The goal is a different structure that produces identical observable behavior.

What Claude Gets Wrong Without This Skill

Without refactor discipline, "refactoring" becomes a mix of restructuring, behavior changes, and new features in one pass. When something breaks, there is no way to know which change caused it. Tests that fail mid-refactor mean the scope was too large, but without the discipline to go one change at a time, the error is impossible to isolate.

The Behavior Contract

Before touching any code, state what it currently does in terms of observable behavior — inputs, outputs, side effects. This is the contract.

If the refactor changes any of these, it is not a refactor — it is a feature change or a bug fix. Handle those separately.

The One-Change Rule

One structural change at a time:

  • Extract a function
  • Rename a variable
  • Remove duplication
  • Flatten nesting
  • Extract a class
  • Move a module

Run tests after each. If they pass, continue. If they fail, the change broke something — revert it and understand why before proceeding.

Do not batch. Do not "while I'm in here" add improvements. Do not rename AND restructure in one change.

The Coverage Gate

Refactoring without tests is rearranging furniture in the dark. Before the first structural change:

  • Run the test suite
  • Check coverage
  • If coverage is below 80% on the code being refactored, stop and write tests first

This is not optional. Skipping it means the refactor cannot be verified.

Common Refactor Operations

OperationWhen to Use
Extract functionBlock of code used in 2+ places, or a block that has a single clear responsibility
RenameName does not reflect current purpose (this happens after behavior is understood, not before)
Remove duplicationSame logic in 3+ places — but only if the logic is genuinely identical, not just similar
Flatten nestingMore than 3 levels of nesting in a single function
Extract classA function or module has grown to handle 2+ distinct concerns
InlineAn abstraction that adds complexity without clarity — sometimes the direct version is better

Anti-Patterns

Do not refactor code you do not understand. Read it until you can state its behavior contract before touching it.

Do not refactor and fix bugs in the same pass. Fix first, then refactor.

Do not refactor code with no tests. Write tests first.

Do not "improve" variable names speculatively — rename only when you understand the current name is wrong.

Mandatory Checklist

  1. Verify test coverage was checked before any changes
  2. Verify the behavior contract was stated before any structural changes
  3. Verify only one structural change was made per test run
  4. Verify no test failures occurred without a full stop and reassessment
  5. Verify the full test suite passes after all changes
  6. Verify coverage did not regress
  7. Verify the behavior contract is still satisfied after all changes

相关技能

寻找 refactor 的替代方案 (Alternative) 或可搭配使用的同类 community Skill?探索以下相关开源技能。

查看全部

openclaw-release-maintainer

Logo of openclaw
openclaw

Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞

333.8k
0
AI

widget-generator

Logo of f
f

为prompts.chat的信息反馈系统生成可定制的插件小部件

149.6k
0
AI

flags

Logo of vercel
vercel

React 框架

138.4k
0
浏览器

pr-review

Logo of pytorch
pytorch

Python中具有强大GPU加速的张量和动态神经网络

98.6k
0
开发者工具