plugins/cache/nyldn-plugins/octo/9.30.0/skills/skill-finish-branch/SKILL.md
Wrap up a branch — run tests, create PR, merge or discard — use when implementation is done. Use when: AUTOMATICALLY ACTIVATE when user requests task completion with git operations:. "commit and push" or "git commit and push". "complete all tasks and commit and push"
npx skillsauth add moliboy5000/.claude skill-finish-branchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Your first output line MUST be: 🐙 **CLAUDE OCTOPUS ACTIVATED** - Branch Completion
Guide completion of development work with clear options and safe execution.
Core principle: Verify tests → Present options → Execute choice → Clean up.
Before presenting options, verify tests pass:
# Run project's test suite
npm test # JavaScript/TypeScript
pytest # Python
cargo test # Rust
go test ./... # Go
If tests fail:
❌ Tests failing (N failures). Must fix before completing:
[Show failures]
Cannot proceed with merge/PR until tests pass.
STOP. Do not proceed to Step 2.
If tests pass: Continue to Step 2.
# Identify the base branch
git merge-base HEAD main 2>/dev/null || \
git merge-base HEAD master 2>/dev/null || \
git merge-base HEAD develop 2>/dev/null
If unclear, ask: "This branch split from main - is that correct?"
Present exactly these 4 options:
✅ Implementation complete. Tests passing. What would you like to do?
1. **Merge locally** - Merge back to <base-branch> on this machine
2. **Create PR** - Push and create a Pull Request for review
3. **Keep as-is** - Leave the branch, I'll handle it later
4. **Discard** - Delete this work permanently
Which option? (1-4)
Keep options concise. Don't add explanations unless asked.
# Get current branch name
FEATURE_BRANCH=$(git branch --show-current)
BASE_BRANCH="main" # or detected base
# Switch to base branch
git checkout $BASE_BRANCH
# Pull latest
git pull origin $BASE_BRANCH
# Merge feature branch
git merge $FEATURE_BRANCH
# Verify tests on merged result
npm test # or appropriate test command
# If tests pass, delete feature branch
git branch -d $FEATURE_BRANCH
Report:
✅ Merged $FEATURE_BRANCH into $BASE_BRANCH
✅ Tests pass on merged result
✅ Feature branch deleted
Ready to push when you want: git push origin $BASE_BRANCH
# Get branch info
FEATURE_BRANCH=$(git branch --show-current)
# Push branch
git push -u origin $FEATURE_BRANCH
# Create PR with description
gh pr create \
--title "feat: [description]" \
--body "$(cat <<'EOF'
## Summary
- [What changed]
- [Why it changed]
## Test Plan
- [x] Unit tests pass
- [x] Manual verification done
- [ ] Code review needed
EOF
)"
Report:
✅ Branch pushed to origin/$FEATURE_BRANCH
✅ PR created: https://github.com/owner/repo/pull/123
Branch preserved for review process.
✅ Keeping branch $FEATURE_BRANCH as-is.
Current state:
- Branch: $FEATURE_BRANCH
- Commits ahead of $BASE_BRANCH: N
- Tests: Passing
When ready, you can:
- Merge: git checkout main && git merge $FEATURE_BRANCH
- PR: git push -u origin $FEATURE_BRANCH && gh pr create
- Discard: git branch -D $FEATURE_BRANCH
Do NOT clean up anything.
Confirm first (REQUIRED):
⚠️ This will PERMANENTLY delete:
- Branch: $FEATURE_BRANCH
- All commits:
- abc1234 feat: add user validation
- def5678 fix: handle edge case
- ghi9012 test: add integration tests
Type 'discard' to confirm, or anything else to cancel.
Wait for exact confirmation: discard
If confirmed:
# Switch to base branch first
git checkout $BASE_BRANCH
# Force delete the feature branch
git branch -D $FEATURE_BRANCH
# If remote exists, delete it too (with confirmation)
git push origin --delete $FEATURE_BRANCH 2>/dev/null || true
Report:
✅ Branch $FEATURE_BRANCH deleted locally
✅ Remote branch deleted (if existed)
Work has been permanently discarded.
For Options 1, 2, 4: Check if in a worktree and clean up:
# Check if current directory is a worktree
if git worktree list | grep -q "$(pwd)"; then
# Get worktree path
WORKTREE_PATH=$(pwd)
# Switch to main worktree
cd $(git worktree list | head -1 | awk '{print $1}')
# Remove the worktree
git worktree remove "$WORKTREE_PATH"
echo "✅ Worktree cleaned up"
fi
For Option 3: Keep worktree intact.
| Option | Merge | Push | Keep Branch | Cleanup | |--------|-------|------|-------------|---------| | 1. Merge locally | ✓ | - | Delete | ✓ | | 2. Create PR | - | ✓ | Keep | - | | 3. Keep as-is | - | - | Keep | - | | 4. Discard | - | - | Delete | ✓ |
After completing octopus workflows, use this skill:
# After tangle (develop) phase completes successfully
# After ink (deliver) phase validates the work
# User says: "I'm done, create a PR"
# → Invoke finishing-branch skill
# → Verify tests
# → Present options
# → Execute Option 2 (Create PR)
# Run octopus validation before finishing
${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh ink "Validate before merge"
# If validation passes, proceed with finishing-branch
| Action | Why It's Dangerous | |--------|-------------------| | Merge without testing | Ships broken code | | Skip confirmation for discard | Loses work permanently | | Force-push without asking | Destroys history | | Delete remote branch silently | Affects collaborators | | Proceed when tests fail | Corrupts main branch |
| Mistake | Fix | |---------|-----| | Offering options before testing | Always verify tests FIRST | | Auto-merging without asking | Present 4 options, let user choose | | Deleting without confirmation | Require typed "discard" | | Cleaning up worktree on "keep" | Only cleanup for options 1, 2, 4 |
Finishing branch → Tests verified AND user chose option
Otherwise → Not complete
Verify tests. Present options. Execute safely. Clean up appropriately.
tools
MANDATORY prerequisite — load this skill BEFORE every `generate_diagram` tool call. NEVER call `generate_diagram` directly without loading this skill first. Trigger whenever the user asks to create, generate, draw, render, sketch, or build a diagram — flowchart, architecture diagram, sequence diagram, ERD or entity-relationship diagram, state diagram or state machine, gantt chart, or timeline. Also trigger when the user mentions Mermaid syntax or wants a system architecture, decision tree, dependency graph, API call flow, auth handshake, schema, or pipeline visualized in FigJam. Routes to type-specific guidance, sets universal Mermaid constraints, and tells you when to use a different diagram type or skip the tool entirely (mindmaps, pie charts, class diagrams, etc.).
development
DEFAULT PIPELINE for all tasks requiring execution. You (Claude) are the strategic orchestrator. Codex agents are your implementation army - hyper-focused coding specialists. Trigger on ANY task involving code, file modifications, codebase research, multi-step work, or implementation. This is NOT optional - Codex agents are the default for all execution work. Only skip if the user explicitly asks you to do something yourself.
development
This skill should be used when the user asks to analyze a UI screen recording and map interaction states into Figma. Trigger for requests such as "put video frames in Figma", "extract states from my recording", "map interactions from video to Figma", "analyze this screen recording", "create a storyboard from my video", "deconstruct this interaction in Figma", "annotate the UI states in my recording", or "pull the key moments from this video into Figma". Also trigger when the user references a video file (.mp4, .mov, .webm, .avi) together with Figma, design review, interaction analysis, prototypes, or UI states. The skill extracts key visual moments from a video, infers interaction triggers, and builds an annotated Figma Design storyboard using native Figma annotations and uploaded screenshot assets.
development
Generate a FigJam project plan board from a PRD plus codebase context. Interactive flow: research → propose sections → per-section deep research → per-section content + block-shape proposal → create FigJam → skeleton → fill → diagrams → wrap. Each content block (section, nested section, intro callout, table, multi-column text, sticky column, diagram section, metadata strip) has its own subskill reference file. Use when the user asks for 'project plan in FigJam', 'interactive project plan', '/generate-project-plan', or provides a PRD and wants per-section confirmation on content + rendering.