一键导入
speckit-refactor
Create a refactoring workflow with metrics tracking and behavior preservation validation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a refactoring workflow with metrics tracking and behavior preservation validation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Review a production UX checkout harness run against the deployed Studio (daikonic). Use after `pnpm --filter @rune-langium/studio run test:prod-ux` (or test:prod-smoke) completes, when the user asks to review/triage a prod checkout run, or when a nightly prod-ux artifact needs auditing. Consumes report/run-manifest.json + screenshots + traces and produces a severity-ranked UX review with per-journey verdicts.
Documentation site and generated agent skills for rune-langium APIs
Documentation site and generated agent skills for rune-langium APIs Use when: Validating a single `.rosetta` file or snippet in memory.
Documentation site and generated agent skills for rune-langium APIs Use when: Embedding a Rune DSL language server in a web application via WebSocket.
Documentation site and generated agent skills for rune-langium APIs Use when: Rendering two or more `RuneTypeGraph` components simultaneously (different....
Runtime <ZodForm> renderer for Zod v4 schemas Use when: You need form rendering in storybook, playgrounds, or low-traffic admin UIs —.... Also: zod, zod-v4, react, forms, form-generation, react-hook-form, schema-driven, dynamic-forms, form-renderer, hookform-resolver, zod-form-renderer.
| name | speckit-refactor |
| description | Create a refactoring workflow with metrics tracking and behavior preservation validation. |
| compatibility | Requires spec-kit project structure with .specify/ directory |
| metadata | {"author":"github-spec-kit","source":"workflows:commands/refactor.md"} |
The user input to you can be provided directly by the agent or as a command argument - you MUST consider it before proceeding with the prompt (if not empty).
User input:
$ARGUMENTS
The text the user typed after /speckit.workflows.refactor (or /speckit.refactor) in the triggering message is the refactoring description. Assume you always have it available in this conversation even if $ARGUMENTS appears literally below. Do not ask the user to repeat it unless they provided an empty command.
Given that refactoring description, do this:
Run the script .specify/extensions/workflows/scripts/bash/create-refactor.sh --json "$ARGUMENTS" from repo root and parse its JSON output for REFACTOR_ID, BRANCH_NAME, REFACTOR_SPEC_FILE, TESTING_GAPS, METRICS_BEFORE, BEHAVIORAL_SNAPSHOT. All file paths must be absolute.
IMPORTANT You must only ever run this script once. The JSON is provided in the terminal as output - always refer to it to get the actual content you're looking for.
Load .specify/extensions/workflows/templates/refactor/refactor-template.md to understand required sections.
Write the refactor spec to REFACTOR_SPEC_FILE using the template structure:
Update TESTING_GAPS file with initial testing gap assessment:
Update BEHAVIORAL_SNAPSHOT file with key behaviors to preserve:
Report completion with Next Steps:
Refactor workflow initialized
**Refactor ID**: [REFACTOR_ID]
**Branch**: [BRANCH_NAME]
**Refactor Spec**: [REFACTOR_SPEC_FILE]
**Testing Gaps**: [TESTING_GAPS]
**Behavioral Snapshot**: [BEHAVIORAL_SNAPSHOT]
**Next Steps:**
1. **CRITICAL FIRST STEP**: Complete testing gap assessment in [TESTING_GAPS]
- Identify all code that will be modified
- Assess test coverage for affected areas
- Add tests for critical gaps BEFORE capturing baseline
2. Review refactoring goals and behaviors to preserve
3. Once testing gaps are addressed, baseline metrics have been automatically captured
4. Run `/speckit.plan` to create refactoring plan
5. Run `/speckit.tasks` to break down into tasks
6. Run `/speckit.implement` to execute refactoring
**Reminder**: Behavior must not change - all tests must still pass
**NEW**: Testing gap assessment ensures adequate coverage exists to validate behavior preservation
Note: The script creates and checks out the new branch before writing files. Refactoring MUST follow test-first approach - all existing tests must pass before and after. NEW: Testing gaps must be assessed and critical gaps filled BEFORE baseline capture. Baseline metrics are automatically captured during workflow creation but should only be trusted after testing gaps are addressed.