Skip to main content

refactor-plan

Plan a multi-file Rust refactor safely: investigate, plan, confirm, implement. Use before any multi-file refactor.

소스 정보

저장소
cosmian/kms
최근 소스 활동
2026년 6월 16일 09:06
감지된 SKILL.md 언어
영어
스타
372
포크
43

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
refactor-plan
description
Plan a multi-file Rust refactor safely: investigate, plan, confirm, implement. Use before any multi-file refactor.
# Refactor Plan Create a detailed, safe plan before making any code changes in this Rust codebase. ## Instructions 1. **Do not edit files** while preparing the plan. 2. **Search the codebase** to understand the current state. Read enough implementation, tests, config, and docs to make the plan specific to this repository. 3. **Identify affected files**, ownership boundaries, dependencies, and likely hidden coupling. 4. **Plan changes in safe sequence**: contracts and types first → implementations → callers → tests → cleanup. 5. **Include verification steps** between phases using `cargo` commands. 6. **Include rollback steps** for the riskiest phases. 7. **Output the complete plan** using the format below. 8. **Stop after the plan** and ask for confirmation before implementing. If the user already said to implement, still produce the plan first and wait for confirmation — unless they explicitly said "continue without review". If the request is too ambiguous to plan safely, ask concise clarifying questions instead of editing files. ## Verification Commands for This Repo Use these at each phase checkpoint: ```bash 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. ## Output Format ```markdown ## 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 `rg "fn_name" --type rust` across workspace before deleting ``` After the plan, ask: **"Shall I proceed with Phase 1?"**
GitHub에서 보기