ワンクリックで
refactor
Refactor existing code for quality, performance, or maintainability. Enforces six quality principles with ratchet gate.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Refactor existing code for quality, performance, or maintainability. Enforces six quality principles with ratchet gate.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Autonomous build loop with Karpathy ratcheting, GAN evaluator, and session chaining. Iterates story groups until all features pass or stopping criteria met.
Socratic interview to create a Business Requirements Document. First step in the SDLC pipeline.
Generate system architecture, machine-readable schemas, and UI mockups. Spawns planner + ui-designer concurrently.
Evaluation patterns — sprint contract format, three-layer verification, scoring rubric references.
Standard GitHub issue workflow. Branch, reproduce, fix, test, PR.
Generate production code and tests for a story group using agent teams for parallel execution.
| name | refactor |
| description | Refactor existing code for quality, performance, or maintainability. Enforces six quality principles with ratchet gate. |
| argument-hint | [file-or-module-path] |
| context | fork |
/refactor src/service/extraction.py
/refactor src/repository/
Provide a file path or directory. The skill analyzes the target against six quality principles, plans the changes, and executes them one principle at a time.
Refactoring improves the internal structure of existing code without changing its observable behavior. No new features. No behavior changes. Every change must trace to a violation of one of the six quality principles.
Read .claude/skills/code-gen/SKILL.md in full. The six principles are the refactoring standard. Every change planned in Step 4 must cite a specific principle.
For each file in the target path:
architecture/SKILL.md)any (TypeScript) or missing type hints (Python). Count unannotated parameters and return types.Record findings in a structured list before proceeding.
Map each finding from Step 2 to one of the six principles:
any, missing annotations, untyped domain concepts.except, untyped catches, swallowed errors.Only violations of these six principles justify a change. Do not refactor code that complies with all six principles.
Produce a written plan before touching any code:
File: src/service/extraction.py
Change: Split extract_data() into extract_raw(), validate_schema(), transform_fields()
Principle: #3 — extract_data() is 87 lines
Risk: One caller in api/routes.py — update import after split
File: src/service/extraction.py
Change: Add return type annotation to all 4 functions
Principle: #2 — return types missing
Risk: None
List every file, what will change, which principle it violates, and any known call-site impact.
Apply changes for one principle across all affected files. Then run the test suite. Then proceed to the next principle.
Order of execution:
After each principle: run tests, run lint, run type checks. If anything breaks, fix it before moving to the next principle.
After all changes are complete, spawn the code-reviewer agent on the full diff.
The reviewer will return findings at three severity levels:
Address every BLOCK finding. Re-run the reviewer after each fix cycle. Maximum 3 retry cycles.
If BLOCK findings remain after 3 cycles, stop and report the unresolved issues. Do not ship code with unresolved BLOCK findings.
/improve.The target path contains refactored code that:
getattr, decorator registries, and plugin systems reference symbols by string. Verify with a project-wide search before deleting.