kata-add-phase
Add planned work discovered during execution to the end of the current milestone in the roadmap. This skill appends sequential phases to the current milestone's phase list, automatically calculating the next phase number. Triggers include "add phase", "append phase", "new phase", and "create phase". This skill updates ROADMAP.md and STATE.md accordingly.
What this skill does
<objective>
Add a new integer phase to the end of the current milestone in the roadmap.
This command appends sequential phases to the current milestone's phase list, automatically calculating the next phase number based on existing phases.
Purpose: Add planned work discovered during execution that belongs at the end of current milestone.
IMPORTANT: When showing examples to users, always use `/kata-add-phase` (the command), not the skill name.
</objective>
<execution_context>
@.planning/ROADMAP.md
@.planning/STATE.md
</execution_context>
<process>
<step name="parse_arguments">
Parse the command arguments:
**With `--issue` flag:**
- `/kata-add-phase --issue .planning/issues/open/2026-02-06-phase-lookup.md`
- Read the issue file to extract title, provenance, and context
- `description` = issue title from frontmatter
- `ISSUE_FILE` = the path argument
- `ISSUE_PROVENANCE` = provenance field from frontmatter (e.g., `github:owner/repo#102`)
- `ISSUE_NUMBER` = extracted from provenance if GitHub-linked (e.g., `102`)
```bash
if echo "$ARGUMENTS" | grep -q "^--issue "; then
ISSUE_FILE=$(echo "$ARGUMENTS" | sed 's/^--issue //')
if [ ! -f "$ISSUE_FILE" ]; then
echo "ERROR: Issue file not found: $ISSUE_FILE"
exit 1
fi
description=$(grep "^title:" "$ISSUE_FILE" | cut -d':' -f2- | xargs)
ISSUE_PROVENANCE=$(grep "^provenance:" "$ISSUE_FILE" | cut -d' ' -f2)
ISSUE_NUMBER=""
if echo "$ISSUE_PROVENANCE" | grep -q "^github:"; then
ISSUE_NUMBER=$(echo "$ISSUE_PROVENANCE" | grep -oE '#[0-9]+' | tr -d '#')
fi
fi
```
**Without `--issue` flag:**
- All arguments become the phase description
- Example: `/kata-add-phase Add authentication` → description = "Add authentication"
- `ISSUE_FILE`, `ISSUE_PROVENANCE`, `ISSUE_NUMBER` are empty
If no arguments provided:
```
ERROR: Phase description required
Usage: /kata-add-phase <description>
/kata-add-phase --issue <issue-file-path>
Example: /kata-add-phase Add authentication system
```
Exit.
</step>
<step name="preflight_roadmap_format">
**Pre-flight: Check roadmap format (auto-migration)**
If ROADMAP.md exists, check format and auto-migrate if old:
```bash
if [ -f .planning/ROADMAP.md ]; then
node "${CLAUDE_PLUGIN_ROOT}/skills/kata-add-phase/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.
</step>
<step name="load_roadmap">
Load the roadmap file:
```bash
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.
</step>
<step name="find_current_milestone">
Parse the roadmap to find the current milestone section:
1. Locate the "## Current Milestone:" heading
2. Extract milestone name and version
3. Identify all phases under this milestone (before next "---" separator or next milestone heading)
4. Parse existing phase numbers (including decimals if present)
Example structure:
```
## Current Milestone: v1.0 Foundation
### Phase 4: Focused Command System
### Phase 5: Path Routing & Validation
### Phase 6: Documentation & Distribution
```
</step>
<step name="calculate_next_phase">
Find the highest integer phase number in the current milestone:
1. Extract all phase numbers from phase headings (### Phase N:)
2. Filter to integer phases only (ignore decimals like 4.1, 4.2)
3. Find the maximum integer value
4. Add 1 to get the next phase number
Example: If phases are 4, 5, 5.1, 6 → next is 7
Format as two-digit: `printf "%02d" $next_phase`
</step>
<step name="generate_slug">
Convert the phase description to a kebab-case slug:
```bash
# Example transformation:
# "Add authentication" → "add-authentication"
# "Fix critical performance issues" → "fix-critical-performance-issues"
slug=$(echo "$description" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
```
Phase directory name: `{two-digit-phase}-{slug}`
Example: `07-add-authentication`
</step>
<step name="validate_slicing">
Validate that the new phase follows vertical slicing principles:
1. **Read slicing principles:**
```bash
cat "$(dirname "$0")/references/slicing-principles.md"
```
2. **Check phase description against red flags:**
**Red Flag 1: Horizontal layer name**
- Does description mention "models", "APIs", "components", "frontend", "backend", "database" without feature context?
- Examples: "Add database models", "Create API layer", "Build UI components"
**Red Flag 2: Setup-only phase**
- Is this pure infrastructure with no user-facing feature?
- Examples: "Set up database", "Configure API", "Initialize framework"
**Red Flag 3: Continuation of previous phase**
- Does description suggest incomplete work from prior phase?
- Examples: "Finish authentication", "Complete product catalog", "Add remaining endpoints"
3. **If red flag detected, use AskUserQuestion:**
```markdown
The phase description "{description}" may not follow vertical slicing principles.
**Detected issue:** {red flag type}
**Vertical slicing principle:** Each phase should deliver a complete, demo-able feature (DB + API + UI) rather than a horizontal layer or infrastructure setup.
**Alternative structures:**
Option 1: Feature-focused phase
- Description: "{suggest feature-focused alternative}"
- Structure: Complete capability from DB to UI
- Demo-able: {what can be demonstrated}
Option 2: Inline setup with feature
- Description: "{suggest inlined alternative}"
- Structure: Setup combined with first feature using it
- Demo-able: {what can be demonstrated}
Option 3: Proceed as-is
- Use current description
- Note: May result in non-demo-able phase
```
4. **If no red flags, continue silently.**
**Purpose:** Prevent horizontal layer phases and setup-only phases from entering the roadmap. Catch slicing issues at insertion time, not during planning.
</step>
<step name="create_phase_directory">
Create the phase directory structure:
```bash
phase_dir=".planning/phases/pending/${phase_num}-${slug}"
mkdir -p "$phase_dir"
```
Confirm: "Created directory: $phase_dir"
</step>
<step name="update_roadmap">
Add the new phase entry to the roadmap:
1. Find the insertion point (after last phase in current milestone, before "---" separator)
2. Insert new phase heading:
```
### Phase {N}: {Description}
**Goal:** [To be planned]
**Depends on:** Phase {N-1}
{if ISSUE_NUMBER: **Issue:** Closes #{ISSUE_NUMBER}}
**Plans:** 0 plans
Plans:
- [ ] TBD (run /kata-plan-phase {N} to break down)
**Details:**
[To be added during planning]
```
If `ISSUE_NUMBER` is set (from `--issue` flag), include the `**Issue:** Closes #{N}` line.
This ensures PRs referencing this phase will auto-close the GitHub issue.
3. Write updated roadmap back to file
Preserve all other content exactly (formatting, spacing, other phases).
</step>
<step name="update_project_state">
Update STATE.md to reflect the new phase:
1. Read `.planning/STATE.md`
2. Under "## Current Position" → "**Next Phase:**" add reference to new phase
3. Under "## Accumulated Context" → "### Roadmap Evolution" add entry:
```
- Phase {N} added: {description}
```
If "Roadmap Evolution" section doesn't exist, create it.
</step>
<step name="completion">
Present completion summary:
```
Phase {N} added to current milestone:
- Description: {description}
- Directory: .planning/phases/{phase-num}-{slug}/
- Status: Not planned yet
{if ISSUE_NUMBER: - Issue: Closes #${ISSUE_NUMBER} (linked from ${ISSUE_FILE})}
Roadmap updated: {roadmap-path}
Project state updated: .planning/STATE.md
---
## ▶ Next Up
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.