Skip to content

Commit 74d29d3

Browse files
authored
feat: add parallel-ticket-pipeline skill (#28)
1 parent bcbec48 commit 74d29d3

1 file changed

Lines changed: 174 additions & 0 deletions

File tree

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
---
2+
name: parallel-ticket-pipeline
3+
description: Use when working on multiple tickets simultaneously, dispatching parallel subagents across worktrees, or needing a CI-fix loop to get branches green. Covers worktree setup, parallel planning, implementation, PRs, tests, and CI monitoring.
4+
---
5+
6+
# Parallel Ticket Pipeline
7+
8+
## Overview
9+
10+
Take N tickets, spin up isolated worktrees, dispatch parallel subagents for planning/implementation/tests, create PRs, and run CI-fix loops until green. Each phase feeds the next.
11+
12+
## When to Use
13+
14+
- User provides multiple tickets to work on simultaneously
15+
- Work can be parallelized across independent branches
16+
- Need automated CI monitoring and fixing
17+
18+
## Pipeline Phases
19+
20+
```dot
21+
digraph pipeline {
22+
rankdir=LR;
23+
"Identify tickets" -> "Create worktrees" -> "Fetch ticket details" -> "Plan (parallel agents)" -> "Implement" -> "Push + PRs" -> "Tests (parallel agents)" -> "CI loop (parallel agents)" -> "Done";
24+
}
25+
```
26+
27+
## Phase 1: Setup
28+
29+
### Identify tickets
30+
Filter the user's list to relevant tickets. Confirm scope with user if ambiguous.
31+
32+
### Create worktrees
33+
```bash
34+
# Check for existing worktree directory
35+
ls -d .worktrees 2>/dev/null
36+
git check-ignore -q .worktrees # Verify ignored
37+
38+
# Create one worktree per ticket
39+
git worktree add .worktrees/TICKET-123-short-name -b TICKET-123-short-name
40+
```
41+
42+
### Fetch ticket details
43+
Use Jira CLI (`acli jira workitem view TICKET-123`) or equivalent in parallel for all tickets.
44+
45+
## Phase 2: Plan (Parallel Agents)
46+
47+
Dispatch one subagent per ticket with `mode: "plan"` and `run_in_background: true`.
48+
49+
Each agent prompt needs:
50+
- **Worktree path** as working directory
51+
- **Ticket details** from Jira
52+
- **Event/feature spec** if available (spreadsheet data, etc.)
53+
- **Codebase conventions** (reference skill docs, CLAUDE.md patterns)
54+
- **Commit conventions** (`feat(TICKET-123): description`, no co-authored-by)
55+
56+
Agents return plans. Present summaries to user for approval.
57+
58+
## Phase 3: Implement
59+
60+
### Subagent limitations
61+
Subagents often cannot get edit/bash permissions regardless of mode (`plan`, `acceptEdits`, `bypassPermissions`). Be prepared for this.
62+
63+
### Strategy
64+
1. **Try subagents first** with `mode: "bypassPermissions"` and `run_in_background: true`
65+
2. **If agents can't edit**, implement directly using their plans as blueprints
66+
3. **For small changes**, implement directly from the start (faster than agent round-trips)
67+
68+
### Worktree commit gotchas
69+
```bash
70+
# Husky pre-commit hooks break in worktrees
71+
git commit --no-verify -m "feat(TICKET-123): description"
72+
73+
# GPG signing can timeout - use --no-gpg-sign as fallback
74+
git commit --no-verify --no-gpg-sign -m "feat(TICKET-123): description"
75+
76+
# ALWAYS run prettier/eslint manually since --no-verify skips hooks
77+
npx prettier --write <changed-files>
78+
npx eslint --fix <changed-files>
79+
```
80+
81+
## Phase 4: Push + PRs
82+
83+
Push all branches and create draft PRs in parallel:
84+
```bash
85+
# Push from each worktree
86+
cd .worktrees/TICKET-123-short-name && git push -u origin TICKET-123-short-name
87+
88+
# Create draft PR with Jira link
89+
gh pr create --draft --title "feat(TICKET-123): short description" --body "$(cat <<'EOF'
90+
[TICKET-123](https://your-jira.atlassian.net/browse/TICKET-123)
91+
92+
Short description of changes.
93+
EOF
94+
)"
95+
```
96+
97+
### SSH key issues
98+
Hardware security keys can lock between operations. Batch pushes when key is available. If push fails with `agent refused operation`, notify user to unlock and retry.
99+
100+
## Phase 5: Tests (Parallel Agents)
101+
102+
Dispatch one agent per ticket to write tests. Each prompt needs:
103+
- Working directory (worktree path)
104+
- What was changed (files, functions, patterns)
105+
- Existing test patterns in the codebase (provide a reference test file)
106+
- Instructions to run tests, lint, commit, and push
107+
108+
**Key**: agents often can't bash either. Be prepared to:
109+
1. Let agents write test files
110+
2. Run tests locally: `TZ=America/Los_Angeles npx vitest run <TestName>`
111+
3. Run lint: `npx prettier --write <file> && npx eslint --fix <file>`
112+
4. Commit and push yourself
113+
114+
## Phase 6: CI Loop (Parallel Agents)
115+
116+
Dispatch one CI monitor agent per PR. Each agent:
117+
118+
```
119+
Loop (max 5 attempts):
120+
1. Check CI: gh pr checks <PR_NUMBER>
121+
2. If all pass → done
122+
3. If failure → investigate:
123+
- gh run view <run-id> --log-failed
124+
- Read failing output
125+
- Fix the issue
126+
- Commit with --no-verify --no-gpg-sign
127+
- Push
128+
- Back to step 1
129+
```
130+
131+
### Common CI failures after --no-verify commits
132+
| Failure | Fix |
133+
|---------|-----|
134+
| Prettier formatting | `npx prettier --write <file>` |
135+
| Import ordering | `npx eslint --fix <file>` |
136+
| Unused imports | Remove the import |
137+
| React hooks rules | Move hooks before early returns |
138+
| `vitest/require-top-level-describe` | Move `beforeEach` inside `describe` blocks |
139+
| Type errors in tests | Use `as unknown as Type` for partial mocks |
140+
141+
### Verifying CI status
142+
`gh pr checks` can show stale results. After pushing fixes, verify the check is from the latest commit:
143+
```bash
144+
# Compare latest commit vs what CI ran
145+
git rev-parse --short HEAD
146+
gh api repos/OWNER/REPO/commits/BRANCH/status --jq '.statuses[] | {context, state}'
147+
```
148+
149+
### Non-blocking checks
150+
Codacy Static Code Analysis and Codacy Diff Coverage are typically non-blocking. Focus on CircleCI checks (lint, tests, build).
151+
152+
## Reporting
153+
154+
After each phase, give the user an honest status table:
155+
156+
```
157+
| Ticket | PR | Status | Notes |
158+
|--------|----|--------|-------|
159+
| TICKET-123 | #42 | Green | Complete |
160+
| TICKET-456 | #43 | Lint fail | Fix pushed, waiting for CI |
161+
```
162+
163+
Don't report stale CI results as green. Check before claiming success.
164+
165+
## Common Mistakes
166+
167+
| Mistake | Fix |
168+
|---------|-----|
169+
| Reporting stale CI as green | Always `gh pr checks` before claiming status |
170+
| Skipping prettier before push | Commits with --no-verify skip all hooks |
171+
| Agents can't edit but you keep retrying | Implement directly after first failure |
172+
| Pushing during SSH key lockout | Batch pushes, notify user to unlock |
173+
| Modifying shared files across worktrees | Each worktree is independent; shared changes may need coordination |
174+
| Not verifying tests pass locally | Always run tests before committing |

0 commit comments

Comments
 (0)