Remove Phase Skill
You are helping the user remove a phase from an existing tracker. Removing a phase will delete all tracks and tasks within that phase, and renumber subsequent phases.
Your Task
Remove a phase from the tracker, including all associated tracks and tasks, and update the structure accordingly.
Hierarchy Reminder
The tracker follows this structure:
- •Phase (sequential stages) → contains multiple Tracks
- •Track (feature groupings) → spans across Phases, contains Tasks
- •Task (individual work items) → belongs to a Phase and Track
WARNING: Removing a phase will permanently delete all tasks within that phase across all tracks.
Process Flow
Step 1: Parse Arguments and Find Tracker
- •
Parse
$ARGUMENTSfor:- •Tracker name (first argument)
- •Optional flags:
- •
--phase=N- Phase number to remove - •
--confirm- Skip confirmation prompt
- •
- •
If tracker name not provided:
- •List available trackers:
bash
ls -1 .trackers/
- •If no trackers exist:
- •Inform user: "No trackers found. Create one with /create-tracker"
- •Exit
- •If trackers exist:
- •Show list and ask user to select
- •List available trackers:
- •
Verify tracker exists:
- •Check if
.trackers/{TRACKER_NAME}/TRACKER.mdexists - •If not found, inform user and exit
- •Check if
- •
Read the tracker file:
- •Use Read tool on
.trackers/{TRACKER_NAME}/TRACKER.md - •Parse existing phases
- •Use Read tool on
Step 2: Identify Phase to Remove
- •
Get phase number (if not from --phase):
codeCurrent phases: 1. Phase 1: {NAME} - {STATUS} 2. Phase 2: {NAME} - {STATUS} 3. Phase 3: {NAME} - {STATUS} Which phase would you like to remove? Enter phase number: - •
Validate phase number:
- •Ensure phase exists
- •If invalid, show available phases and ask again
- •
Count tasks in phase:
- •Parse the Tasks section
- •Count all tasks under
### Phase {N}: - •Store task count for confirmation
Step 3: Confirm Deletion
Unless --confirm flag is provided, display warning and ask for confirmation:
⚠️ WARNING: This will permanently delete Phase {N}: {PHASE_NAME}
This will remove:
- Phase {N}: {PHASE_NAME}
- All tracks within this phase
- {TASK_COUNT} task(s) in this phase
Remaining phases will be renumbered:
{FOR_EACH_SUBSEQUENT_PHASE}
- Phase {OLD_N} → Phase {NEW_N}
{END_FOR}
This action cannot be undone.
Are you sure you want to remove this phase? (yes/no)
- •If user responds "no" or cancels, exit without changes
- •If user responds "yes", proceed with deletion
Step 4: Remove Phase from Phases Section
- •
Find phase section:
- •Locate:
### Phase {N}: {PHASE_NAME} - •Find the entire section until next
### Phaseor end of Phases section
- •Locate:
- •
Delete phase entry:
- •Remove entire phase section including:
- •Phase header
- •Status, dates, description
- •All content until next phase
- •Use Edit tool to remove the section
- •Remove entire phase section including:
- •
Renumber subsequent phases:
- •For each phase after the removed one:
- •Update header:
### Phase {OLD_N}:→### Phase {NEW_N}: - •Update all references to phase numbers in the content
- •Update header:
- •Use Edit tool for each change
- •For each phase after the removed one:
Step 5: Remove Phase from Tasks Section
- •
Find phase section in Tasks:
- •Locate:
### Phase {N}: {PHASE_NAME} - •Find the entire section until next
### Phaseor end of Tasks section
- •Locate:
- •
Delete phase section:
- •Remove entire phase section including:
- •Phase header
- •All track subsections (#### Track: ...)
- •All tasks (##### Task ...)
- •All content until next phase
- •Use Edit tool to remove
- •Remove entire phase section including:
- •
Renumber subsequent phase sections:
- •For each phase section after the removed one:
- •Update header:
### Phase {OLD_N}:→### Phase {NEW_N}:
- •Update header:
- •Use Edit tool for each change
- •For each phase section after the removed one:
Step 6: Update Track Phase Coverage
- •
For each existing track in Tracks section:
- •Find:
### Track: {TRACK_NAME} - •Check Phase Coverage field
- •Update coverage if affected:
- •If track only covered the removed phase: Remove track entirely
- •If track starts at removed phase: Adjust start to next phase
- •If track ends at removed phase: Adjust end to previous phase
- •If track spans through removed phase: Adjust range
- •If track is after removed phase: Decrement phase numbers
- •Use Edit tool for updates
- •Find:
- •
Remove orphaned tracks:
- •If any track's phase coverage is now invalid (no phases), remove it entirely
Step 7: Delete Associated Plan Files
- •
Find all task plan files for deleted tasks:
- •Parse removed tasks to get task numbers
- •For each task with a plan file:
bash
rm .trackers/{TRACKER_NAME}/plans/{TASK_NUMBER}-*.md
- •
Inform user of deleted plan files
Step 8: Update Overview and Metadata
- •
Update phase count:
- •Find:
- **Total Phases**: {OLD_COUNT} - •Replace with:
- **Total Phases**: {NEW_COUNT}
- •Find:
- •
Update task count:
- •Find:
- **Total Tasks**: {OLD_COUNT} - •Calculate new count (old count - deleted tasks)
- •Replace with:
- **Total Tasks**: {NEW_COUNT}
- •Find:
- •
Update track count (if any tracks were removed):
- •Find:
- **Total Tracks**: {OLD_COUNT} - •Replace with:
- **Total Tracks**: {NEW_COUNT}
- •Find:
- •
Update metadata:
- •Update
updated:field in frontmatter to current date - •Get current date:
bash
date +%Y-%m-%d
- •Update
Step 9: Confirm Removal
Phase removed successfully!
**Removed**: Phase {N}: {PHASE_NAME}
**Deleted**: {TASK_COUNT} task(s)
**Plan files deleted**: {PLAN_COUNT}
{IF_RENUMBERED}
**Phases renumbered**:
{FOR_EACH_CHANGE}
- Phase {OLD} → Phase {NEW}
{END_FOR}
{END_IF}
{IF_TRACKS_REMOVED}
**Tracks removed** (no longer cover any phases):
{FOR_EACH_REMOVED_TRACK}
- {TRACK_NAME}
{END_FOR}
{END_IF}
{IF_TRACKS_UPDATED}
**Track coverage updated**:
{FOR_EACH_UPDATED_TRACK}
- {TRACK_NAME}: {OLD_COVERAGE} → {NEW_COVERAGE}
{END_FOR}
{END_IF}
**Tracker updated**:
- Total phases: {OLD_PHASE_COUNT} → {NEW_PHASE_COUNT}
- Total tasks: {OLD_TASK_COUNT} → {NEW_TASK_COUNT}
{IF_TRACK_COUNT_CHANGED}- Total tracks: {OLD_TRACK_COUNT} → {NEW_TRACK_COUNT}{END_IF}
**Next steps**:
- Review tracker: /review-tracker {TRACKER_NAME}
- Add new phase if needed: /add-phase {TRACKER_NAME}
View tracker: .trackers/{TRACKER_NAME}/TRACKER.md
Important Notes
- •Destructive operation: All tasks in the phase are permanently deleted
- •Cascading updates: Subsequent phases are automatically renumbered
- •Track cleanup: Tracks that no longer span any phases are removed
- •Plan files: Associated plan files are deleted from the plans/ directory
- •Dependencies: Task dependencies (Blocked By) are NOT automatically updated
- •Confirmation required: User must confirm unless --confirm flag is used
- •No undo: This operation cannot be reversed
Examples
Example 1: Remove Middle Phase
/remove-phase my-app --phase=2 > Warning: Will delete Phase 2: Implementation with 5 tasks > Confirm: yes > Phase 2 removed > Phase 3 becomes Phase 2 > Phase 4 becomes Phase 3
Example 2: Remove Last Phase
/remove-phase my-app > Select phase: 4 > Warning: Will delete Phase 4: Deployment with 3 tasks > Confirm: yes > Phase 4 removed (no renumbering needed)
Example 3: Skip Confirmation
/remove-phase my-app --phase=1 --confirm > Phase 1 removed immediately without confirmation
Error Handling
- •If tracker doesn't exist, inform user and exit
- •If phase number is invalid, show valid phases
- •If user cancels confirmation, exit without changes
- •If phase is the only phase, warn and require explicit confirmation
- •Validate all inputs before modifying
- •Handle edge cases (removing first or last phase)
- •Ensure tracker structure remains valid after removal
Post-Removal Validation
After removing the phase:
- •Verify all phase numbers are sequential (1, 2, 3...)
- •Ensure no orphaned task references remain
- •Validate all track phase coverage is correct
- •Confirm overview counts match actual content
Integration with Other Skills
- •Use
/review-trackerto see updated structure - •Use
/add-phaseif you need to add a different phase - •Use
/edit-phaseto modify remaining phases - •Check task dependencies manually if needed