用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Cosmian/kms --skill refactor-plan命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | refactor-plan |
| description | Plan a multi-file Rust refactor safely: investigate, plan, confirm, implement. Use before any multi-file refactor. |
Create a detailed, safe plan before making any code changes in this Rust codebase.
cargo commands.If the request is too ambiguous to plan safely, ask concise clarifying questions instead of editing files.
Use these at each phase checkpoint:
cargo clippy-all # zero warnings required
cargo fmt --all # formatting
cargo test -p <crate> # targeted test (preferred)
cargo test-fips # full FIPS test suite (only if needed)
cargo test-non-fips # full non-FIPS suite (only if needed)
Use cargo test -p <crate> <test_name> to run the narrowest scope first.
## Refactor Plan: [title]
### Current State
[How things work now — be specific to this codebase]
### Target State
[How things will work after — measurable outcome]
### Affected Files
| File | Change Type | Dependencies |
|------|-------------|--------------|
| `crate/foo/src/bar.rs` | modify | blocks `baz.rs`, blocked by `qux.rs` |
### Execution Plan
#### Phase 1: Types and Traits
- [ ] Step 1.1: [action] in `crate/foo/src/bar.rs`
- [ ] Verify: `cargo clippy -p foo` passes
#### Phase 2: Implementations
- [ ] Step 2.1: [action] in `crate/foo/src/impl.rs`
- [ ] Verify: `cargo test -p foo test_name`
#### Phase 3: Callers
- [ ] Step 3.1: Update callers in `crate/server/src/...`
- [ ] Verify: `cargo build --workspace`
#### Phase 4: Tests
- [ ] Step 4.1: Update unit tests
- [ ] Verify: `cargo test -p foo`
#### Phase 5: Cleanup
- [ ] Remove deprecated code
- [ ] Run `cargo fmt --all` and `cargo clippy-all`
- [ ] Final verify: `git diff --stat` — every hunk explainable by the task
### Rollback Plan
If Phase N fails:
1. `git checkout crate/foo/src/bar.rs` — restore original
2. `git stash` — save partial work for inspection
### Risks
- [Potential issue]: [mitigation]
- Trait object overhead: prefer generics if the type set is closed
Public API change: run across workspace before deleting
After the plan, ask: "Shall I proceed with Phase 1?"