prompt-refactor
Prompt Refactor Skill
This skill runs the full phase loop of the prompt-builder skill—test, evaluate, research, and update—focused on refactoring existing artifacts. Use the prompt-builder skill's orchestration reference for the phase loop, the sandbox contract, the Prompt Tester, Prompt Evaluator, Researcher Subagent, and Prompt Updater dispatch matrix, the artifact paths, and the cleanup contract. This skill adds only the refactor scope and the cleanup heuristics in references/refactor-checklist.md.
Goal
Refactor existing prompt-engineering artifacts by simplifying, consolidating, and removing confusion while preserving functional intent. When no explicit requirements are supplied, run a baseline evaluation first and derive refactoring objectives from the evaluation findings plus the standard cleanup checklist.
Flow
- Confirm the target existing artifacts and any explicit requirements. Derive the sandbox path from the primary target artifact using the deterministic pattern
.copilot-tracking/sandbox/{{YYYY-MM-DD}}-{{topic}}-{{run-number}}, where{{YYYY-MM-DD}}is today's date and{{topic}}is the primary artifact's base name with the suffix stripped, or the parent folder name when the target is aSKILL.md, in kebab-case. When multiplepromptFilesare supplied, use the lexically first entry as the primary artifact. See theprompt-builderskill's orchestration reference for the full sandbox and dispatch contract. - Run one baseline execution and evaluation in the sandbox with
Prompt TesterandPrompt Evaluator, then inspect the evaluation log. Whenrequirementswere omitted, derive the refactor objectives from this baseline evaluation plus the standard cleanup checklist. - Review the artifacts for clarity problems, duplication, confusing structure, and unnecessary examples by using references/refactor-checklist.md.
- Apply focused refactor edits that align to the requirements or derived objectives and the Prompt Quality Criteria through
Prompt Updater, preserving functional intent unless a requirement changes it. - Re-enter the execution and evaluation loop until the requirements or derived objectives are satisfied and the evaluation log shows no remaining issues.