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

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit 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.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/movebrickschi/harness-engineering-mcp/refactor-flow
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor-flow

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00098 $0.01042
Opus 5.5 $0.00039 $0.00417
Sonnet 5.5 $0.00020 $0.00208
Haiku 4.5 $0.00010 $0.00104

Measured 1mo ago against content hash 5c3810afda2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.md、REFACTOR_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. 1mo 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 4mo ago), licensed MIT. It adds 98 tokens to every session and 1,042 once invoked, about $0.0004 per session on Opus 5.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

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

chronicle

Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting…

microsoft/vscode · 72 tokens

systematic-debugging

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

obra/superpowers · 21 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

component-fixtures

Use when creating or updating component fixtures for screenshot testing or their shared infrastructure, or when designing UI components to be fixture-friendly. Covers fixture file structure, theming, service setup, CSS scoping, async rendering, validation, and common pitfalls.

microsoft/vscode · 53 tokens