关于 seam-plan
seam-plan 是围绕代码边界规划重构的 Skill,采用分阶段迁移策略。它规定扩展、迁移、收缩阶段,并标注回滚点及待审或未解决状态。
主要功能
- 01定位接口与依赖接缝
- 02规划扩展、迁移、收缩阶段
- 03定义回滚关口与机制
- 04标记已暂存或未解决状态
适用场景
- 01规划渐进式旧代码重构
- 02准备可回滚的调用方迁移
- 03识别阻碍隔离的耦合
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ venhdev/ skills --skill seam-plan安装后在 Claude Code 中输入/seam-plan确认已加载。
详细介绍
seam-plan — 基于接缝的重构与扩展-收缩策略
领域评分标准
1. 接缝坐标与隔离机制
在接口、依赖注入或包边界处识别拦截接缝。选择一种零停机隔离机制:接口适配器、功能标志、影子代理或抽象分支。
2. 扩展-收缩三阶段不变量
- 阶段 1:扩展(仅添加,不造成破坏):在旧代码旁引入新接口、架构或影子服务。调用方签名和旧版测试套件保持不变并全部通过。
- 阶段 2:迁移(渐进式切换):通过功能标志或适配器,逐个将调用方重新路由到新抽象。通过切换标志即可立即回滚到旧路径,无需重新部署代码。
- 阶段 3:收缩(裁剪与清理):完整回归测试通过后,移除旧实现、删除临时标志,并清除过时分支和垫片。
3. 状态
STAGED:三阶段迁移策略和回滚坐标已准备就绪,供人工审核。UNRESOLVED:代码耦合过紧,若不进行基础性重新设计,就无法识别接缝。
规范输出约定
# Seam Migration Plan: <Refactor Target> · <STAGED | UNRESOLVED>
Basis: <Frozen contract, architectural direction, or structural audit>
Seam Coordinate: <Repo-relative file and symbol representing the interception point>
Isolation Mechanism: <Interface Adapter | Feature Flag | Shadow Proxy | Branch by Abstraction>
## Phase 1: Expand (Additive Non-Breaking)
- Operations: [CREATE] <New interfaces, adapters, or shadow implementations>
- Invariant: Zero modifications to existing caller signatures; legacy tests remain unmodified and GREEN.
## Phase 2: Migrate (Progressive Cutover)
- Migration Steps:
1. `<Caller A>`: Rerouted via `<Flag / Seam>` -> Verified via `<Parity Check>`.
2. `<Caller B>`: Rerouted via `<Flag / Seam>` -> Verified via `<Parity Check>`.
- Fallback Gate: <Observable condition triggering instant rollback to legacy seam>
## Phase 3: Contract (Pruning & Cleanup)
- Operations:
- [DELETE] `<Legacy implementation files or obsolete branches>`
- [UPDATE] `<Remove temporary flags, adapters, and redundant shims>`
- Final Verification: <Full regression test suite execution without legacy paths>
Summary: 3 atomic phases planned, rollback exposure confined to Phase 2 flag.
*(omit if clean)* Gap: <Coupling blocker preventing clean seam extraction.>
路由
- 迁移策略已准备就绪,可将每个阶段拆分为 DAG →(通过 /split-tasks)。
- 单个阶段已准备就绪,可立即规划文件影响 →(通过 /changeset)。
- 若不进行重大架构调整就无法隔离接缝 →(通过 /architect-decision)。
执行协议
- 检查目标重构范围,定位拦截接缝,并制定三阶段推进计划(扩展 -> 迁移 -> 收缩)。
- 准备接缝迁移计划,明确回滚关卡。报告
STAGED(若耦合导致无法隔离接缝,则报告UNRESOLVED)。
评论
支持 Markdown