Use before starting any new phase - explains how sequential and parallel phases automatically chain together through base branch inheritance (main worktree tracks progress, parallel phases inherit from current branch, no manual intervention needed)
View on GitHubskills/understanding-cross-phase-stacking/SKILL.md
January 23, 2026
Select agents to install to:
npx add-skill https://github.com/arittr/spectacular/blob/main/skills/understanding-cross-phase-stacking/SKILL.md -a claude-code --skill understanding-cross-phase-stackingInstallation paths:
.claude/skills/understanding-cross-phase-stacking/# Understanding Cross-Phase Stacking
## Overview
**Phases automatically build on each other's completed work.** Understanding how phases chain together is essential for correct execution.
This is a **reference skill** - read it to understand cross-phase dependencies, not to execute a workflow.
## When to Use
Use this skill when:
- Starting a new phase (need to understand what base to build from)
- Debugging stack relationships across phase boundaries
- Verifying phases are chaining correctly
- Understanding why parallel worktrees use specific base branches
**Mental model check:** If you're thinking "create worktrees from `{runid}-main` branch", you need this skill.
## The Cross-Phase Inheritance Principle
```
MAIN WORKTREE CURRENT BRANCH = LATEST COMPLETED WORK
```
**Key insight:**
- Sequential phases leave main worktree **on their last task's branch**
- Parallel phases leave main worktree **on their last stacked branch**
- Next phase (sequential or parallel) inherits from **current branch**, not original base
**This creates automatic linear chaining across all phases.**
## Example: Sequential → Parallel → Sequential
### Phase 1 (Sequential) - Database Setup
```bash
# Working in: .worktrees/{runid}-main
# Starting from: {runid}-main (base branch)
# Task 1: Database schema
gs branch create {runid}-task-1-1-database-schema
# Creates branch, commits work
# Main worktree now on: {runid}-task-1-1-database-schema ← KEY STATE
```
**Phase 1 result:**
- Branch created: `{runid}-task-1-1-database-schema`
- Main worktree current branch: `{runid}-task-1-1-database-schema`
- **This branch becomes Phase 2's base**
### Phase 2 (Parallel) - Three Feature Implementations
```bash
# Base detection (CRITICAL):
BASE_BRANCH=$(git -C .worktrees/{runid}-main branch --show-current)
# Returns: {runid}-task-1-1-database-schema ← Inherits from Phase 1
# Create parallel worktrees FROM Phase 1's completed branch
git worktree add .worktrees/{runid}-task-2-1 --detach "$BASE_BRANC