Agent skill
start-refactor-task
Start or complete a specific refactoring task from a task file (for sub-agents)
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/start-refactor-task
SKILL.md
Start Refactor Task
You are implementing a specific refactoring task from a plugin refactoring plan.
<task_input> $ARGUMENTS </task_input>
Parse Arguments
task_file_path: Path to the task file (required)--task <id>: Task ID to start (optional, defaults to first ready task)--complete <id>: Task ID to mark complete (optional)
If --complete <task-id> Provided
- READ the task file
- EDIT the task status from
🔄 IN PROGRESSto✅ COMPLETE - Output:
Task {ID}: {Name} marked as COMPLETE - EXIT
Starting a Task
1. Load Context
READ the task file. It contains everything you need:
- Task details (status, dependencies, priority, complexity)
- Target file being refactored
- Issue type (SKILL_SPLIT, AGENT_OPTIMIZE, DOC_IMPROVE, ORPHAN_RESOLVE, STRUCTURE_FIX)
- Acceptance criteria (your definition of done)
- Required inputs (design spec sections, source files to read)
- Expected outputs (files to create/modify)
- Verification steps (how to prove completion)
The task file header links to the design spec. READ it for refactoring context.
2. Select Task
If --task <id> specified: Use that task.
Otherwise, find the first task where:
- Status is
❌ NOT STARTED - All dependencies are
✅ COMPLETEor "None"
If no ready task: Output "No ready tasks" and EXIT.
3. Update Status
EDIT the task file: Change ❌ NOT STARTED to 🔄 IN PROGRESS
4. Track Progress
Use the Task API to track acceptance criteria:
TaskCreate(
subject="AC1: {criterion}",
description="{detailed criterion description}",
activeForm="Implementing {criterion}"
)
TaskCreate(
subject="Verification: Run all verification steps",
description="{verification steps}",
activeForm="Running verification"
)
5. Implement
Work through each acceptance criterion based on the issue type:
For SKILL_SPLIT Tasks
- READ the current skill file completely
- READ the design spec section for this split
- IDENTIFY content domains as specified in design
- CREATE new skill directories and SKILL.md files
- DISTRIBUTE content according to design spec
- UPDATE cross-references between skills
- CREATE shared references if specified
- VERIFY all links resolve
For AGENT_OPTIMIZE Tasks
- READ the current agent file
- READ the design spec section for optimization
- LOAD reference skills: claude-skills-overview-2026, prompt-optimization-claude-45
- REWRITE description with trigger keywords
- IMPROVE instruction clarity
- REVIEW tool restrictions
- VALIDATE frontmatter format
For DOC_IMPROVE Tasks
- READ the current file
- READ the design spec section for improvements
- IDENTIFY specific quality issues
- REWRITE with improved clarity, triggers, examples
- ENSURE proper markdown formatting
- VALIDATE frontmatter if applicable
For ORPHAN_RESOLVE Tasks
- READ the orphaned file
- READ the design spec classification
- IF integrating: ADD link from appropriate SKILL.md
- IF removing: DELETE the file (after confirming no references)
- IF merging: COMBINE content with target file
For STRUCTURE_FIX Tasks
- READ all affected files
- IDENTIFY broken links or structural issues
- FIX links to point to correct locations
- VERIFY all cross-references resolve
Mark todos as you complete them.
6. Verify
Run each verification step from the task. All must pass.
Common verification steps:
Read the created/modified files to confirm contentVerify all internal links resolveCheck frontmatter validates against schemaConfirm file structure matches design spec
7. Complete
When all verification passes:
/plugin-creator:start-refactor-task {task_file_path} --complete {task_id}
Working Environment
Collaborative Agents
Other agents may be working nearby on related tasks. If you notice edits to files you didn't make:
- This is intentional - the user or other agents made those changes
- Include these changes in your considerations
- If the changes block your work, STOP and report to the orchestrator with your reasoning
Reference Skills
Load these skills for guidance on proper formats:
| Skill | Use For |
|---|---|
| claude-skills-overview-2026 | Skill SKILL.md format |
| claude-plugins-reference-2026 | Plugin structure |
| Command format | |
| claude-hooks-reference-2026 | Hooks format |
| prompt-optimization-claude-45 | Agent prompt optimization |
Research and Knowledge
Be bold with research. Be skeptical of built-in knowledge.
Your training data may be outdated. The codebase and reference skills are the source of truth.
Before implementing:
- READ existing skills/agents that are well-formatted
- CHECK reference skills for format requirements
- USE context7, Ref MCPs for documentation questions
- VERIFY patterns match what's actually in the codebase
# Good: Verify format before writing
READ ./plugins/example-plugin/skills/example/SKILL.md # Check actual format
Skill(skill="claude-skills-overview-2026") # Load format reference
Quality Standards
- Follow existing patterns in the plugin
- Preserve content fidelity during splits (no information loss)
- Maintain or improve frontmatter quality
- Ensure all cross-references resolve
- Keep line counts under thresholds (skills <500 lines)
Error Handling
Blocked by dependency: Report which tasks must complete first.
Verification failure: After 3 fix attempts, STOP and report the failure details.
Design conflict: If the design spec conflicts with codebase reality, STOP and report.
Content loss: If splitting would lose content, STOP and request design clarification.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?