Create and update stacked pull requests. Use this after completing an implementation phase to commit changed files.
This skill enables Claude to create stacked pull requests using git-town automation scripts. Each phase becomes an atomic PR that builds on previous phases.
Invoke this skill after completing a phase from /implement_plan when:
just check-test)DO NOT use this skill:
Before creating the stack, verify:
Check the current branch to determine if this is Phase 1 or Phase N:
git branch --show-current
Decision Logic:
main: This is Phase 1 → Use just new-stackphase-X-*: This is Phase N (where N = X + 1) → Use just append-stackBoth scripts require the same arguments (in order):
1, 2, 3)websocket-foundation, message-parser)Phase 1: WebSocket Connection Foundation)phase-N-<short-description>phase-1-websocket-foundationphase-2-message-parserphase-3-orderbook-state<type>: <phase-summary>
Phase N: <detailed-description>
Changes:
- <key change 1>
- <key change 2>
- <key change 3>
<any relevant context or notes>
Types: feat, fix, refactor, test, chore, docs
## Phase N: <Title>
### Summary
<1-2 sentence overview of what this phase accomplishes>
### Changes
- <key change 1>
- <key change 2>
- <key change 3>
### Stack
<!-- branch-stack -->
### Verification
- [x] All automated tests passed (\`just check-test\`)
- [x] Manual verification completed
- [x] Code follows project patterns
### Related
Part of implementation plan: [link to plan if available]
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
For Phase 1 (on main branch):
just new-stack \
"<phase-num>" \
"<branch-name>" \
"<commit-msg>" \
"<pr-title>" \
"<pr-body>"
For Phase N > 1 (on phase-X-* branch):
just append-stack \
"<phase-num>" \
"<branch-name>" \
"<commit-msg>" \
"<pr-title>" \
"<pr-body>"
# Current state check
$ git branch --show-current
main
$ git status
# Shows: modified files in src/connection/ (uncommitted)
# Execute new-stack
just new-stack \
"1" \
"websocket-foundation" \
"feat: Add WebSocket connection foundation
Phase 1: Implement core WebSocket connection logic
Changes:
- Add WebsocketConnection class with lifecycle management
- Implement exponential backoff reconnection strategy
- Add connection health monitoring
- Create connection stats tracking
Establishes the foundation for real-time market data streaming." \
"Phase 1: WebSocket Connection Foundation" \
"## Phase 1: WebSocket Connection Foundation
### Summary
Implements the core WebSocket connection class with automatic reconnection, health monitoring, and stats tracking.
### Changes
- Add WebsocketConnection class with lifecycle management
- Implement exponential backoff reconnection strategy (1s → 30s)
- Add connection health monitoring (60s silence detection)
- Create connection stats tracking
### Stack
<!-- branch-stack -->
### Verification
- [x] All automated tests passed (\`just check-test\`)
- [x] Manual verification: Connected to Polymarket API successfully
- [x] Code follows project patterns
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)"
What the script does:
main branchphase-1-websocket-foundation via git town hackthoughts/ directory)--base main# Current state check
$ git branch --show-current
phase-1-websocket-foundation
$ git status
# Shows: modified files (uncommitted)
# Execute append-stack
just append-stack \
"2" \
"message-parser" \
"feat: Add message parsing with msgspec
Phase 2: Implement zero-copy message parser
Changes:
- Add msgspec-based message parser
- Define protocol structures for BookSnapshot, PriceChange, LastTradePrice
- Implement generator-based parsing for streaming
- Handle integer scaling for prices/sizes
Enables efficient parsing of WebSocket messages with zero-copy optimization." \
"Phase 2: Message Parser with msgspec" \
"## Phase 2: Message Parser with msgspec
### Summary
Implements zero-copy message parsing using msgspec, enabling efficient processing of WebSocket events.
### Changes
- Add msgspec-based MessageParser class
- Define protocol structures (BookSnapshot, PriceChange, LastTradePrice)
- Implement generator-based parsing for streaming
- Handle integer scaling (PRICE_SCALE=1000, SIZE_SCALE=100)
### Stack
<!-- branch-stack -->
Merge order: This PR should be merged after Phase 1.
### Verification
- [x] All automated tests passed (\`just check-test\`)
- [x] Manual verification: Parsed live messages successfully
- [x] Code follows project patterns
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)"
What the script does:
main (you must be on previous phase branch)phase-1-websocket-foundation)phase-2-message-parser via git town appendthoughts/ directory)--base phase-1-websocket-foundationBoth scripts automatically:
thoughts/ directory)The script checks git status --porcelain. Ensure:
thoughts/ directory (which is excluded)For append-stack, ensure:
phase-N-* patternUse GitHub CLI to fix:
gh pr edit <pr-number> --base <correct-base-branch>
# Checkout the phase that needs changes
git checkout phase-N-<name>
# Make changes and commit
# ...
# Sync stack to propagate changes forward
git town sync --stack
thoughts/ directory from commitsThis skill integrates with the /implement_plan workflow:
/implement_plan implements a phasejust check-test)git-town for stack managementgh)main (configured in git-town)thoughts/ directory is automatically excluded from all commits