From kata
Inserts urgent work as decimal phase (e.g., 72.1) after integer phase in .planning/ROADMAP.md, with validation, existing decimal detection, and format migration.
npx claudepluginhub withmartian-sandbox/ghrc-x-73d04e3c2aae45e2ac89d7e8506d8eaaThis skill uses the workspace's default tool permissions.
<objective>
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Uses decimal numbering (72.1, 72.2, etc.) to preserve the logical sequence of planned phases while accommodating urgent insertions.
Purpose: Handle urgent work discovered during execution without renumbering entire roadmap.
<execution_context> @.planning/ROADMAP.md @.planning/STATE.md </execution_context>
Parse the command arguments: - First argument: integer phase number to insert after - Remaining arguments: phase descriptionExample: /kata-insert-phase 72 Fix critical auth bug
→ after = 72
→ description = "Fix critical auth bug"
Validation:
if [ $# -lt 2 ]; then
echo "ERROR: Both phase number and description required"
echo "Usage: /kata-insert-phase <after> <description>"
echo "Example: /kata-insert-phase 72 Fix critical auth bug"
exit 1
fi
Parse first argument as integer:
after_phase=$1
shift
description="$*"
# Validate after_phase is an integer
if ! [[ "$after_phase" =~ ^[0-9]+$ ]]; then
echo "ERROR: Phase number must be an integer"
exit 1
fi
**Pre-flight: Check roadmap format (auto-migration)**
If ROADMAP.md exists, check format and auto-migrate if old:
if [ -f .planning/ROADMAP.md ]; then
node scripts/kata-lib.cjs check-roadmap 2>/dev/null
FORMAT_EXIT=$?
if [ $FORMAT_EXIT -eq 1 ]; then
echo "Old roadmap format detected. Running auto-migration..."
fi
fi
If exit code 1 (old format):
Invoke kata-doctor in auto mode:
Skill("kata-doctor", "--auto")
Continue after migration completes.
If exit code 0 or 2: Continue silently.
Load the roadmap file:if [ -f .planning/ROADMAP.md ]; then
ROADMAP=".planning/ROADMAP.md"
else
echo "ERROR: No roadmap found (.planning/ROADMAP.md)"
exit 1
fi
Read roadmap content for parsing.
Verify that the target phase exists in the roadmap:Search for "### Phase {after_phase}:" heading
If not found:
ERROR: Phase {after_phase} not found in roadmap
Available phases: [list phase numbers]
Exit.
Verify phase is in current milestone (not completed/archived)
Examples:
Store as: decimal_phase="$(printf "%02d" $after_phase).${next_decimal}"
slug=$(echo "$description" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
Phase directory name: {decimal-phase}-{slug}
Example: 06.1-fix-critical-auth-bug (phase 6 insertion)
phase_dir=".planning/phases/pending/${decimal_phase}-${slug}"
mkdir -p "$phase_dir"
Confirm: "Created directory: $phase_dir"
Insert the new phase entry into the roadmap:Find insertion point: immediately after Phase {after_phase}'s content (before next phase heading or "---")
Insert new phase heading with (INSERTED) marker:
### Phase {decimal_phase}: {Description} (INSERTED)
**Goal:** [Urgent work - to be planned]
**Depends on:** Phase {after_phase}
**Plans:** 0 plans
Plans:
- [ ] TBD (run /kata-plan-phase {decimal_phase} to break down)
**Details:**
[To be added during planning]
Write updated roadmap back to file
The "(INSERTED)" marker helps identify decimal phases as urgent insertions.
Preserve all other content exactly (formatting, spacing, other phases).
Update STATE.md to reflect the inserted phase:.planning/STATE.md- Phase {decimal_phase} inserted after Phase {after_phase}: {description} (URGENT)
If "Roadmap Evolution" section doesn't exist, create it.
Add note about insertion reason if appropriate.
Present completion summary:Phase {decimal_phase} inserted after Phase {after_phase}:
- Description: {description}
- Directory: .planning/phases/{decimal-phase}-{slug}/
- Status: Not planned yet
- Marker: (INSERTED) - indicates urgent work
Roadmap updated: {roadmap-path}
Project state updated: .planning/STATE.md
---
## ▶ Next Up
**Phase {decimal_phase}: {description}** — urgent insertion
`/kata-plan-phase {decimal_phase}`
<sub>`/clear` first → fresh context window</sub>
---
**Also available:**
- Review insertion impact: Check if Phase {next_integer} dependencies still make sense
- Review roadmap
---
<anti_patterns>
<success_criteria> Phase insertion is complete when:
.planning/phases/pending/{N.M}-{slug}/