bail

Reflects, updates GitHub Issue, closes PR if open, cleans up worktree/branch.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "bail" with this command: npx skills add camacho/ai-skills/camacho-ai-skills-bail

Bail-out protocol: always reflect FIRST, then clean up.

Inputs

  • Optional reason string (if not provided, ask for one)

Steps

  1. Detect current step by examining what exists:

    What existsEstimated step
    Just an issue, no branchStep 0 (Capture)
    .branch-context.md, no worktreeStep 1 (Orient)
    Worktree exists, no code changesStep 2 (Isolate)
    Plan file on branchStep 3-4 (Design/Review)
    Code changes committedStep 5-7 (Build/Verify/Archive)
    PR open on GitHubStep 8 (Ship)
  2. Prompt for reason if not provided.

  3. Write learnings to .branch-context.md:

    • What was attempted
    • Why bailing (the reason)
    • What was learned
    • Any partial work worth preserving
  4. Consolidate learnings: Read .branch-context.md and append relevant items to ai-workspace/MEMORY.md on main:

    git stash
    git checkout main
    # Append learnings to MEMORY.md
    git add ai-workspace/MEMORY.md
    git commit -m "docs: consolidate learnings from abandoned <branch>"
    git checkout <branch>
    git stash pop
    
  5. Update GitHub Issue (if accessible):

    # Find issue number from branch name or PR
    gh issue comment <number> --body "Bailing: <reason>. Learnings captured in MEMORY.md."
    gh issue edit <number> --add-label "deferred" --remove-label "triage"
    
  6. Close PR if open:

    PR_NUM=$(gh pr list --head "<branch>" --json number -q '.[0].number')
    if [ -n "$PR_NUM" ]; then
      gh pr close "$PR_NUM"
    fi
    
  7. Ask about branch preservation:

    • Default: preserve the branch (user can resume later)
    • If user says delete:
      git worktree remove .worktrees/<name> 2>/dev/null
      git branch -D <branch> 2>/dev/null
      git push origin --delete <branch> 2>/dev/null
      
  8. Return to main:

    git checkout main
    

Edge Cases

  • No worktree exists (bailing at Step 0-1) → skip worktree cleanup, just update issue
  • No GitHub access → skip issue update, still do local cleanup + memory consolidation
  • PR already merged → don't close, just note it in the output
  • No .branch-context.md → create one with just the bail reason before consolidating

Output: Summary of what was cleaned up and where learnings were saved.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

plan-review

No summary provided by upstream source.

Repository SourceNeeds Review
General

archive

No summary provided by upstream source.

Repository SourceNeeds Review
General

orient

No summary provided by upstream source.

Repository SourceNeeds Review
General

clone-website

No summary provided by upstream source.

Repository SourceNeeds Review