Safely improve code quality through test-driven refactoring with automatic validation and rollback. Use during quality review to reduce technical debt while preserving behavior.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
refactor-code
description
Safely improve code quality through test-driven refactoring with automatic validation and rollback. Use during quality review to reduce technical debt while preserving behavior.
acceptance
[{"config_validated":"Configuration allows refactoring and prerequisites verified"},{"opportunities_identified":"Refactoring opportunities identified and prioritized by risk"},{"refactorings_applied":"Selected refactorings applied incrementally with test validation"},{"log_created":"Refactoring log documenting all changes with rationale"},{"tests_passing":"All tests passing after refactoring with no behavioral changes"}]
inputs
{"task_file":{"type":"string","required":true,"description":"Path to task specification with quality findings"},"aggressiveness":{"type":"enum","required":false,"description":"Refactoring scope: conservative, moderate, aggressive","default":"moderate"},"allow_refactoring":{"type":"boolean","required":false,"description":"Override config to allow/disallow refactoring"}}
outputs
{"refactorings_applied":{"type":"number","description":"Number of refactorings successfully applied"},"refactorings_failed":{"type":"number","description":"Number of refactorings that failed and were rolled back"},"files_modified":{"type":"array","description":"List of files modified during refactoring"},"quality_impact":{"type":"object","description":"Before/after quality metrics showing improvements"}}
Safely improve code quality through automated refactoring while maintaining behavioral correctness. This skill identifies refactoring opportunities from quality findings and applies them incrementally with continuous test validation.
Core Capabilities:
Test-driven refactoring (run tests after each change)
Refactoring opportunities identified and prioritized
Selected refactorings applied incrementally
All tests passing after refactoring
Refactoring log created with full documentation
Task file updated with summary
Quality metrics improved or maintained
User notified with actionable next steps
Safety Guarantees
Behavioral preservation (no functionality changes) | Test validation (after each change) | Automatic rollback (on failures) | Full traceability (logged) | Incremental (one at a time) | User control (choose scope)
Integration with Quality Review
Runs after nfr-assess, before quality-gate in quality workflow. Optional - only if user opts in and tests exist/pass. Improvements reflected in final gate decision.