refactor-flow

refactor-flow is a skill for Claude Code, Codex from movebrickschi/harness-engineering-mcp. It costs 98 tokens per session (1,042 once invoked), scanned A, original, MIT.

A step-by-step workflow for changing code structure without changing what the software does. It requires tests around the code, small commits, and passing tests after each change.

In plain words
What is it for?
Use it to rename code, extract functions, split modules, remove duplication, or reorganize a codebase. It also helps compare the software before and after the refactor.
Why use it?
It reduces the risk of breaking existing behavior during cleanup or technical-debt work. Problems are caught at each small step instead of after a large rewrite.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/movebrickschi/harness-engineering-mcp/refactor-flow
Any agent
npx skills add movebrickschi/harness-engineering-mcp --skill refactor-flow
Clone the repo
git clone --depth 1 https://github.com/movebrickschi/harness-engineering-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor-flow

README.md
[![agentmods](https://agentmods.dev/badge/skills/movebrickschi/harness-engineering-mcp/refactor-flow.svg)](https://agentmods.dev/skills/movebrickschi/harness-engineering-mcp/refactor-flow)
Your own site
<a href="https://agentmods.dev/skills/movebrickschi/harness-engineering-mcp/refactor-flow"><img src="https://agentmods.dev/badge/skills/movebrickschi/harness-engineering-mcp/refactor-flow.svg" alt="Measured on agentmods" height="20"></a>
Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,042 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00098 $0.01042
Opus 5 $0.00049 $0.00521
Sonnet 5 $0.00020 $0.00208
Haiku 4.5 $0.00010 $0.00104

Measured 3d ago against content hash 5c3810afda2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor-flow scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

assets/skills/refactor-flow/SKILL.md · 101 lines

What it actually says

refactor-flow

适用场景

不改外部行为,只改内部结构(rename、提取函数、模块拆分、消除重复等)。

前置条件

确认 _playbook.md Part B.3 启动参数;额外 refactor_target(要重构的模块/文件/目录)。

流程步骤

阶段 0 · 上下文初始化

move_agent_to_root;建知识库目录(极简 META.md)。

阶段 1 · 现状评估

  • /health 跑当前分数
  • 用 explore subagent 列出待重构区域的:依赖入度 / 出度 / 测试覆盖率 / 已知 TODO/FIXME
  • 输出 REFACTOR_BASELINE.md(行为基线 + 健康分基线)

阶段 2 · 测试网铺设

  • 检查覆盖率:若未覆盖,先补足覆盖到 70%+
  • commit:test(scope): 补充重构前覆盖测试
  • 这一步不通过不许进入阶段 3

阶段 3 · 重构方案 + 卡点

prompt: "测试网就绪,重构方案如下:[方案 A 一句话摘要]。请确认:"
options:
  - "方案 OK,分步执行"
  - "需要修改方案(说明)"
  - "暂不重构(关闭流程)"

阶段 4 · 分步原子 commit

每步:

  • 改一小块 → 跑测试全绿 → commit refactor(scope): 中文描述
  • 任意一步测试不绿 → 立即 revert 该步,不允许"先红着提交后续修"

阶段 5 · 验证无行为变化

  • /qa(重点跑回归)
  • /health 分数应持平或上升
  • /review

阶段 6 · 上线

/ship/land-and-deploy/canary(监控同模块错误率,确认与基线一致)。

阶段 7 · 复盘

append _lessons.md:重构动因 + 收益(健康分变化)+ 成本(工时)。

错误处理

  • 覆盖率不达标且短期补不齐 → 退化为"小范围 PR + 大量手动验证",明确告知用户风险
  • 重构暴露隐藏 Bug → 暂停重构,先按 /bugfix-flow 修复 + 上线,再回来继续
  • 重构后健康分下降 → 不允许 ship,回阶段 4 检查

产物清单

META.mdREFACTOR_BASELINE.md、补测试 commit、若干原子重构 commit、/health 前后对比、PR 链接。

支持的修饰符

无。

与其他 skill 的关系

  • 通常被 /dev-flow 路由到(也可被用户直接触发)
  • 若过程中发现 Bug → 切换到 /bugfix-flow
  • 若实际目的是性能 → 切换到 /perf-flow
  • 自查:/qa/health/review
  • 上线:/ship/land-and-deploy/canary

附录

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 101 lines · 98 tokens per session scan A 5c3810afda2a

Subscribe to this mod's changes

refactor-flow is a skill published in the GitHub repository movebrickschi/harness-engineering-mcp (2 stars, last pushed 3mo ago), licensed MIT. It adds 98 tokens to every session and 1,042 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens