name: stackit
description: Manage stacked Git branches with Stackit. Use when creating/managing stacked branches, submitting PRs for branch stacks, navigating branch trees, rebasing stacks, syncing with main/trunk, troubleshooting stack issues, absorbing changes, resolving rebase conflicts, or any workflow involving dependent Git branches. Keywords stackit, stacked changes, stacked PRs, branch stack, restack, absorb, git stack.
allowed-tools: Bash(stackit:), Bash(git:), Bash(~/.claude/skills/stackit/scripts/:), Read, Grep, Glob
version: {{VERSION}}
Stackit - Stacked Branch Management
You are an expert at using Stackit to manage stacked Git branches. Stackit helps developers break large features into small, focused PRs that stack on top of each other.
Before Any Operation
Always run stackit log --no-interactive first to understand:
- Current branch position in the stack
- Parent/child relationships
- Which branches need attention
CRITICAL: Non-Interactive Mode
When calling stackit commands, ALWAYS include the --no-interactive flag. This ensures the command fails or proceeds according to defaults rather than hanging for user input. For commands that require confirmation, include the --force flag (for absorb) or --yes flag (for undo/merge) in addition to --no-interactive.
Check for project conventions:
- Read
README.md and CONTRIBUTING.md for project-specific guidelines before generating commit messages or branch names.
- Follow documented commit message formats, PR templates, and workflows.
- Respect any branching or testing requirements specified.
Quick Health Check
Run the stack analyzer to check health and get actionable suggestions:
bash ~/.claude/skills/stackit/scripts/analyze_stack.sh
Note: All stackit commands below should be called with --no-interactive.
Core Workflows
Creating a New Branch
- Stage changes:
git add <files> or use --all flag
- Generate commit message after checking
README.md / CONTRIBUTING.md; follow project conventions if documented, otherwise write a clear, descriptive summary.
- Create branch (name optional, auto-generated from message and respects
stackit config branch.pattern):# Preferred: pipe format
echo "commit message" | stackit create --no-interactive
# With explicit name
echo "commit message" | stackit create branch-name --no-interactive
- If currently on trunk (e.g., main/master), warn and confirm or switch to a feature branch before creating.
- Show stack:
stackit log --no-interactive
Submitting PRs
- Check stack state:
stackit log --no-interactive
- Submit options:
- Current + ancestors:
stackit submit --no-interactive
- Entire stack:
stackit submit --stack --no-interactive
- As drafts:
stackit submit --draft --no-interactive
Syncing with Main
- Sync with trunk and cleanup:
stackit sync --no-interactive
- If branches were deleted:
stackit restack --no-interactive
Fixing Issues
- Rebase conflicts: Resolve files, then
stackit continue --no-interactive
- Absorb conflicts: See workflows/absorb-conflict.md or use
stackit absorb --show-conflict --no-interactive
- Abort operation:
stackit abort --no-interactive
- Undo last command:
stackit undo --no-interactive --yes
- Stack health issues: See workflows/fix-absorb.md or run
/stack-fix
- Intelligent folding: See workflows/stack-fold.md or run
/stack-fold
Commit Message Examples
Generate commit messages following these patterns:
Example 1: Feature addition
feat(auth): implement JWT-based authentication
Add login endpoint and token validation middleware.
Supports refresh tokens and role-based access.
Example 2: Bug fix
fix(cache): prevent race condition in invalidation
Add mutex locking around cache clear operations.
Fixes issue where concurrent requests could see stale data.
Example 3: Multiple changes
chore: update dependencies and refactor errors
- Upgrade lodash to 4.17.21
- Standardize error response format
- Add error codes for API responses
Format:
- Follow project conventions from README.md/CONTRIBUTING.md if documented
- Otherwise: clear, descriptive subject line + blank line + explanation of "why"
- Some projects use conventional commits:
type(scope): description
Command Reference
For detailed command information, see:
- Navigation: commands/navigation.md - log, checkout, up, down, trunk
- Branch operations: commands/branch.md - create, modify, absorb, delete
- Stack operations: commands/stack.md - restack, submit, sync, foreach
- Recovery & utilities: commands/recovery.md - undo, continue, abort, doctor
Quick reference: reference.md
Detailed Workflows
For complex operations requiring multiple steps:
- Fixing compilation errors after absorb: workflows/fix-absorb.md
- Resolving conflicts during rebase: workflows/conflict-resolution.md
- Resolving absorb conflicts: workflows/absorb-conflict.md
Auto-Generation Guidelines
Branch Names
Branch names are optional - stackit auto-generates from commit message:
- Only provide if user explicitly requests a specific name
- Auto-generated format: kebab-case from commit message
- Example: "Add user authentication" → "add-user-authentication"
Commit Messages
When generating commit messages:
- Check README.md and CONTRIBUTING.md for project guidelines
- Follow documented conventions if available
- If no conventions documented, write a clear, descriptive message
- Always use pipe format:
echo "message" | stackit create --no-interactive
Validation loop:
- Generate message
- Verify: Clear description? Follows project conventions (if documented)?
- If fails: revise and re-validate
- Only proceed when message meets quality standards
PR Descriptions
When generating PR descriptions:
- Check for .github/pull_request_template.md or CONTRIBUTING.md
- Follow project-specific templates if available
- Default format:
## Summary
- Bullet point summary of changes
## Test Plan
- [ ] Specific testing steps
- [ ] Verification procedures
[Additional sections per project templates]
Validation before submission:
- Title is clear and descriptive?
- Body has meaningful content (not placeholders)?
- Test plan is specific?
- Use
bash ~/.claude/skills/stackit/scripts/validate_pr.sh "title" "body" to validate
Important Rules
- Never use raw git for branch operations - always use stackit commands
- Check state before destructive operations - run
stackit log first
- Always validate after absorb - absorb can cause compilation errors, see fix-absorb workflow
- Handle conflicts gracefully - guide user through resolution, see conflict-resolution workflow
- Keep PRs small and focused - suggest splitting if too large
- Use validation loops - for commit messages, PR descriptions, and post-absorb builds
Version {{VERSION}} Changes
New features:
- Progressive disclosure with organized reference files
- Workflow checklists for complex operations (fix-absorb, conflict resolution)
- Utility scripts for stack analysis and PR validation
- Enhanced slash commands with validation loops
- New
/stack-absorb and /stack-fold commands
- Expanded commit message examples
- Better error recovery patterns
Migration:
- Re-run
stackit agent install --force to update files
- No breaking changes to existing workflows
1---2name: stackit-23description: Manage stacked Git branches with Stackit. Use when creating/managing stacked branches, submitting PRs for branch stacks, navigating branch trees, rebasing stacks, syncing with main/trunk, troubleshoot4---56---7name: stackit8description: Manage stacked Git branches with Stackit. Use when creating/managing stacked branches, submitting PRs for branch stacks, navigating branch trees, rebasing stacks, syncing with main/trunk, troubleshooting stack issues, absorbing changes, resolving rebase conflicts, or any workflow involving dependent Git branches. Keywords stackit, stacked changes, stacked PRs, branch stack, restack, absorb, git stack.9allowed-tools: Bash(stackit:*), Bash(git:*), Bash(~/.claude/skills/stackit/scripts/*:*), Read, Grep, Glob10version: {{VERSION}}11---1213# Stackit - Stacked Branch Management1415You are an expert at using Stackit to manage stacked Git branches. Stackit helps developers break large features into small, focused PRs that stack on top of each other.1617## Before Any Operation1819**Always run `stackit log --no-interactive` first** to understand:20- Current branch position in the stack21- Parent/child relationships22- Which branches need attention2324**CRITICAL: Non-Interactive Mode**25When calling `stackit` commands, **ALWAYS** include the `--no-interactive` flag. This ensures the command fails or proceeds according to defaults rather than hanging for user input. For commands that require confirmation, include the `--force` flag (for absorb) or `--yes` flag (for undo/merge) in addition to `--no-interactive`.2627**Check for project conventions:**28- Read `README.md` and `CONTRIBUTING.md` for project-specific guidelines before generating commit messages or branch names.29- Follow documented commit message formats, PR templates, and workflows.30- Respect any branching or testing requirements specified.3132## Quick Health Check3334Run the stack analyzer to check health and get actionable suggestions:35```bash36bash ~/.claude/skills/stackit/scripts/analyze_stack.sh37```3839> **Note:** All stackit commands below should be called with `--no-interactive`.4041## Core Workflows4243### Creating a New Branch44451. **Stage changes:** `git add <files>` or use `--all` flag462. **Generate commit message** after checking `README.md` / `CONTRIBUTING.md`; follow project conventions if documented, otherwise write a clear, descriptive summary.473. **Create branch** (name optional, auto-generated from message and respects `stackit config branch.pattern`):48 ```bash49 # Preferred: pipe format50 echo "commit message" | stackit create --no-interactive5152 # With explicit name53 echo "commit message" | stackit create branch-name --no-interactive54 ```554. If currently on trunk (e.g., main/master), warn and confirm or switch to a feature branch before creating.565. Show stack: `stackit log --no-interactive`5758### Submitting PRs59601. Check stack state: `stackit log --no-interactive`612. Submit options:62 - Current + ancestors: `stackit submit --no-interactive`63 - Entire stack: `stackit submit --stack --no-interactive`64 - As drafts: `stackit submit --draft --no-interactive`6566### Syncing with Main67681. Sync with trunk and cleanup: `stackit sync --no-interactive`692. If branches were deleted: `stackit restack --no-interactive`7071### Fixing Issues7273- **Rebase conflicts:** Resolve files, then `stackit continue --no-interactive`74- **Absorb conflicts:** See [workflows/absorb-conflict.md](workflows/absorb-conflict.md) or use `stackit absorb --show-conflict --no-interactive`75- **Abort operation:** `stackit abort --no-interactive`76- **Undo last command:** `stackit undo --no-interactive --yes`77- **Stack health issues:** See [workflows/fix-absorb.md](workflows/fix-absorb.md) or run `/stack-fix`78- **Intelligent folding:** See [workflows/stack-fold.md](workflows/stack-fold.md) or run `/stack-fold`7980## Commit Message Examples8182Generate commit messages following these patterns:8384**Example 1: Feature addition**85```86feat(auth): implement JWT-based authentication8788Add login endpoint and token validation middleware.89Supports refresh tokens and role-based access.90```9192**Example 2: Bug fix**93```94fix(cache): prevent race condition in invalidation9596Add mutex locking around cache clear operations.97Fixes issue where concurrent requests could see stale data.98```99100**Example 3: Multiple changes**101```102chore: update dependencies and refactor errors103104- Upgrade lodash to 4.17.21105- Standardize error response format106- Add error codes for API responses107```108109**Format:**110- Follow project conventions from README.md/CONTRIBUTING.md if documented111- Otherwise: clear, descriptive subject line + blank line + explanation of "why"112- Some projects use conventional commits: `type(scope): description`113114## Command Reference115116For detailed command information, see:117- **Navigation:** [commands/navigation.md](commands/navigation.md) - log, checkout, up, down, trunk118- **Branch operations:** [commands/branch.md](commands/branch.md) - create, modify, absorb, delete119- **Stack operations:** [commands/stack.md](commands/stack.md) - restack, submit, sync, foreach120- **Recovery & utilities:** [commands/recovery.md](commands/recovery.md) - undo, continue, abort, doctor121122Quick reference: [reference.md](reference.md)123124## Detailed Workflows125126For complex operations requiring multiple steps:127- **Fixing compilation errors after absorb:** [workflows/fix-absorb.md](workflows/fix-absorb.md)128- **Resolving conflicts during rebase:** [workflows/conflict-resolution.md](workflows/conflict-resolution.md)129- **Resolving absorb conflicts:** [workflows/absorb-conflict.md](workflows/absorb-conflict.md)130131## Auto-Generation Guidelines132133### Branch Names134Branch names are **optional** - stackit auto-generates from commit message:135- Only provide if user explicitly requests a specific name136- Auto-generated format: kebab-case from commit message137- Example: "Add user authentication" → "add-user-authentication"138139### Commit Messages140When generating commit messages:1411. Check README.md and CONTRIBUTING.md for project guidelines1422. Follow documented conventions if available1433. If no conventions documented, write a clear, descriptive message1444. **Always use pipe format:** `echo "message" | stackit create --no-interactive`145146**Validation loop:**147- Generate message148- Verify: Clear description? Follows project conventions (if documented)?149- If fails: revise and re-validate150- Only proceed when message meets quality standards151152### PR Descriptions153When generating PR descriptions:1541. Check for .github/pull_request_template.md or CONTRIBUTING.md1552. Follow project-specific templates if available1563. Default format:157 ```markdown158 ## Summary159 - Bullet point summary of changes160161 ## Test Plan162 - [ ] Specific testing steps163 - [ ] Verification procedures164165 [Additional sections per project templates]166 ```167168**Validation before submission:**169- Title is clear and descriptive?170- Body has meaningful content (not placeholders)?171- Test plan is specific?172- Use `bash ~/.claude/skills/stackit/scripts/validate_pr.sh "title" "body"` to validate173174## Important Rules1751761. **Never use raw git for branch operations** - always use stackit commands1772. **Check state before destructive operations** - run `stackit log` first1783. **Always validate after absorb** - absorb can cause compilation errors, see fix-absorb workflow1794. **Handle conflicts gracefully** - guide user through resolution, see conflict-resolution workflow1805. **Keep PRs small and focused** - suggest splitting if too large1816. **Use validation loops** - for commit messages, PR descriptions, and post-absorb builds182183## Version {{VERSION}} Changes184185New features:186- Progressive disclosure with organized reference files187- Workflow checklists for complex operations (fix-absorb, conflict resolution)188- Utility scripts for stack analysis and PR validation189- Enhanced slash commands with validation loops190- New `/stack-absorb` and `/stack-fold` commands191- Expanded commit message examples192- Better error recovery patterns193194Migration:195- Re-run `stackit agent install --force` to update files196- No breaking changes to existing workflows