Use when execute command encounters errors - diagnostic guide for phase failures, parallel agent failures, merge conflicts, worktree issues, and recovery strategies
Provides diagnostic guidance for execute command failures, including phase execution errors, parallel agent failures, merge conflicts, and worktree issues. Use this reference when execution fails to identify root causes and apply recovery strategies.
/plugin marketplace add arittr/spectacular/plugin install spectacular@spectacularThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Reference guide for diagnosing and recovering from execute command failures.
This skill provides recovery strategies for common execute command errors. Use it when execution fails or produces unexpected results.
Use this skill when:
This is a reference skill - consult when errors occur, not part of normal execution flow.
Symptoms:
Error message format:
❌ Phase {id} Execution Failed
**Task**: {task-id}
**Error**: {error-message}
Resolution steps:
Review the error output - Understand what failed (test? build? implementation?)
Check current state:
cd .worktrees/{runid}-main
git status
git log --oneline -5
Fix manually if needed:
# Current branch already has completed work from previous tasks
# Fix the issue in the working directory
# Run quality checks
bash <<'EOF'
npm test
if [ $? -ne 0 ]; then
echo "❌ Tests failed"
exit 1
fi
npm run lint
if [ $? -ne 0 ]; then
echo "❌ Lint failed"
exit 1
fi
npm run build
if [ $? -ne 0 ]; then
echo "❌ Build failed"
exit 1
fi
EOF
# Create branch if task completed but branch wasn't created
gs branch create {runid}-task-{phase}-{task}-{name} -m "[Task {phase}.{task}] {description}"
Resume execution:
Symptoms:
Error message format:
❌ Parallel Phase {id} - Agent Failure
**Failed Task**: {task-id}
**Branch**: {task-branch}
**Error**: {error-message}
**Successful Tasks**: {list}
Resolution options:
Use when fix is small and task mostly completed:
# Navigate to task's worktree
cd .worktrees/{runid}-task-{phase}-{task}
# Debug and fix issue
# Edit files, fix code
# Run quality checks
bash <<'EOF'
npm test
if [ $? -ne 0 ]; then
echo "❌ Tests failed"
exit 1
fi
npm run lint
if [ $? -ne 0 ]; then
echo "❌ Lint failed"
exit 1
fi
npm run build
if [ $? -ne 0 ]; then
echo "❌ Build failed"
exit 1
fi
EOF
# Commit fix on existing branch
git add --all
git commit -m "[Task {phase}.{task}] Fix: {description}"
# Return to main repo
cd "$REPO_ROOT"
# Proceed with stacking (failed branch now exists)
Use when fix is significant or logically separate:
# Navigate to task's worktree
cd .worktrees/{runid}-task-{phase}-{task}
# Ensure original work is committed
git status # Should be clean
# Create stacked fix branch
gs branch create {runid}-task-{phase}-{task}-fix-{issue} -m "[Task {phase}.{task}] Fix: {issue}"
# Implement fix
# Edit files
# Commit fix
git add --all
git commit -m "[Task {phase}.{task}] Fix: {description}"
# Return to main repo
cd "$REPO_ROOT"
Use when task implementation is fundamentally wrong:
# Navigate to main repo
cd "$REPO_ROOT"
# Remove task worktree
git worktree remove .worktrees/{runid}-task-{phase}-{task}
# Delete failed branch if it exists
git branch -D {runid}-task-{phase}-{task}-{name}
# Recreate worktree from base
BASE_BRANCH=$(git -C .worktrees/{runid}-main branch --show-current)
git worktree add .worktrees/{runid}-task-{phase}-{task} --detach "$BASE_BRANCH"
# Install dependencies
cd .worktrees/{runid}-task-{phase}-{task}
{install-command}
{postinstall-command}
# Spawn fresh agent for this task only
# [Use Task tool with task prompt]
Use when task is non-critical or can be addressed later:
Symptoms:
gs upstack onto fails with merge conflictError message format:
❌ Merge Conflict - Tasks Modified Same Files
**Conflict**: {file-path}
**Branches**: {branch-1}, {branch-2}
This should not happen if task independence was verified correctly.
Root cause: Tasks were marked parallel but have file dependencies.
Resolution steps:
Verify task independence:
# Check which files each task modified
git diff {base-branch}..{task-1-branch} --name-only
git diff {base-branch}..{task-2-branch} --name-only
# Should have no overlap for parallel tasks
Resolve conflict manually:
cd .worktrees/{runid}-main
# Checkout first task branch
git checkout {task-1-branch}
# Attempt merge with second task
git merge {task-2-branch}
# Conflict will occur
# Resolve in editor
# Edit conflicted files
# Complete merge
git add {conflicted-files}
git commit -m "Merge {task-2-branch} into {task-1-branch}"
# Continue stacking remaining branches
Update plan for future:
Symptoms:
{runid}-main worktree.worktrees/{runid}-main does not existError message format:
❌ Worktree Not Found
**Error**: .worktrees/{run-id}-main does not exist
This means `/spectacular:spec` was not run, or the worktree was removed.
Root cause: Spec command not run, or worktree manually deleted.
Resolution:
Run the spec command first to create workspace:
/spectacular:spec {feature-name}
This will:
.worktrees/{runid}-main/ directoryspecs/{runid}-{feature-slug}/spec.md{runid}-mainThen:
/spectacular:plan to generate execution plan/spectacular:execute to execute the planNever skip spec - execute depends on worktree structure created by spec.
Symptoms:
git worktree add fails for parallel tasksError message format:
❌ Parallel Task Worktree Creation Failed
**Error**: {error-message}
Common causes and fixes:
# Clean existing path
rm -rf .worktrees/{runid}-task-{phase}-{task}
# Prune stale worktree entries
git worktree prune
# Retry worktree creation
git worktree add .worktrees/{runid}-task-{phase}-{task} --detach {base-branch}
# Stash changes
git stash
# Or commit changes
git add --all
git commit -m "WIP: Save progress before parallel phase"
# Retry worktree creation
# Check status
git status
# Either commit or stash changes
git add --all
git commit -m "[Task {X}.{Y}] Complete task"
# Or stash if work is incomplete
git stash
# Retry worktree creation
# Verify not in worktree
REPO_ROOT=$(git rev-parse --show-toplevel)
if [[ "$REPO_ROOT" =~ \.worktrees ]]; then
echo "Error: In worktree, navigate to main repo"
cd "$(dirname "$(dirname "$REPO_ROOT")")"
fi
# Navigate to main repo root
MAIN_REPO=$(git rev-parse --show-toplevel | sed 's/\.worktrees.*//')
cd "$MAIN_REPO"
# Retry worktree creation
Check execution state:
# List all worktrees
git worktree list
# View current branches
git branch | grep "{runid}-"
# View stack structure
cd .worktrees/{runid}-main
gs log short
# Check main worktree state
cd .worktrees/{runid}-main
git status
git branch --show-current
Verify phase readiness:
# Before parallel phase
cd .worktrees/{runid}-main
BASE_BRANCH=$(git branch --show-current)
echo "Parallel phase will build from: $BASE_BRANCH"
# Before sequential phase
cd .worktrees/{runid}-main
CURRENT_BRANCH=$(git branch --show-current)
echo "Sequential phase starting from: $CURRENT_BRANCH"
Check task completion:
# Verify all task branches exist
TASK_BRANCHES=({runid}-task-{phase}-1-{name} {runid}-task-{phase}-2-{name})
for BRANCH in "${TASK_BRANCHES[@]}"; do
if git rev-parse --verify "$BRANCH" >/dev/null 2>&1; then
echo "✅ $BRANCH exists"
else
echo "❌ $BRANCH missing"
fi
done
If you fixed an issue manually:
Verify state is clean:
cd .worktrees/{runid}-main
git status # Should be clean
git log --oneline -3 # Verify commits exist
Continue to next task/phase:
If phase is fundamentally broken:
Reset main worktree to pre-phase state:
cd .worktrees/{runid}-main
git reset --hard {base-branch}
Remove failed task branches:
git branch -D {failed-task-branches}
Re-run phase:
If feature implementation should be abandoned:
Remove all worktrees:
git worktree remove .worktrees/{runid}-main
git worktree remove .worktrees/{runid}-task-*
git worktree prune
Delete all feature branches:
git branch | grep "^ {runid}-" | xargs git branch -D
Clean spec directory:
rm -rf specs/{runid}-{feature-slug}
Prevent failures before they occur:
Validate plan before execution:
Run setup validation:
validating-setup-commands skillUse skills correctly:
executing-parallel-phase for ALL parallel phasesexecuting-sequential-phase for ALL sequential phasesunderstanding-cross-phase-stacking for phase boundariesVerify before proceeding:
gs log shortCommon error patterns:
| Error | Quick Fix |
|---|---|
| Phase execution failed | Check error, fix manually, resume or retry |
| Parallel agent failed | Fix in branch, restart agent, or continue without |
| Merge conflict | Resolve manually, update plan to sequential |
| Worktree not found | Run /spectacular:spec first |
| Worktree creation failed | Clean path, stash changes, prune worktrees |
Diagnostic sequence:
Most failures are recoverable. Understand the error, verify state, fix the issue, and resume execution.
The execute command is designed to be resilient - you can fix issues manually and continue from any phase.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.