Seven steps that carry one ticket from clarifying the request to a merged pull request. Use at the start of a request to implement a component, page, or route, add or change a feature, fix a bug that needs more than a one-line change, or refactor a module, including when the user only says to add, build, fix, or refactor something and names no workflow. Skip a one-line fix, a single config value, or a docs-only change.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ticket Work?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/imaimai17468-ticket-work)
---
name: ticket-work
description: "Seven steps that carry one ticket from clarifying the request to a merged pull request. Use at the start of a request to implement a component, page, or route, add or change a feature, fix a bug that needs more than a one-line change, or refactor a module, including when the user only says to add, build, fix, or refactor something and names no workflow. Skip a one-line fix, a single config value, or a docs-only change."
---
# Ticket work
In a fresh worktree, run `bun run setup` before anything else, because without `node_modules` and the types `bun run generate-void` writes into `.void/` the pre-push `bun run check` fails even on a docs-only ticket. Its install also runs the `prepare` script, `vp config --no-agent`, which writes the git hooks into that worktree's gitignored `.vite-hooks/_`; a worktree that skipped it commits and pushes with no hook. `bun run dev` runs `vp dev` with Void's plugin, which needs no Cloudflare login, keeps the local D1 and R2 under `.void/`, and applies the migrations in `src/db/migrations/` when it starts, so a fresh worktree's first `bun run dev` begins from an empty but migrated D1. The void CLI and plugin need Node 24.22+ or 26.12+, which `mise.toml` pins, and they stop while any dotenv file other than the root `.env` sits at the root. It runs through portless, which assigns the dev server a free port and the URL `http://<last segment of the branch name>.my-app.localhost:1355` (no prefix on `main`, and two branches that share a last segment share a URL), and Better Auth takes its base URL from the request, so login redirects return to that URL. Google accepts a redirect URI only on a public-suffix TLD or on `localhost` itself, so check Google login with `PORTLESS=0 bun run dev`, which serves `http://localhost:5173` without the proxy in one checkout at a time. Everything short of Google login is checkable on any worktree's URL. A worktree-isolated session's Bash calls meet the guard AGENTS.md's Degraded Environments names. It has passed commands joined with `;` or `&&`, a chain naming `git`, a `for` loop, a heredoc feeding `git commit -F -`, and output sent to `/dev/null`. It has refused a `$(...)` substitution, `$?` in a chain naming `git`, a `for` loop piping `git` output to another program, and a chain that writes a file through a heredoc and then runs `gh`. Write a path or a value as a literal rather than through one of those forms, and where the guard refuses a chain, send its parts one per Bash call.
## Tickets and waves
**A request becomes tickets before anyone codes.** A ticket is the smallest change that leaves `main`'s CI green when it merges alone, in any order with the other tickets, and that one worker can carry to a merged PR in one session. Split a request by that test top to bottom through the layer order AGENTS.md's Rules section names, because `fallow dead-code` fails an export nothing consumes, so a layer alone never passes. Two pieces of which either fails the test alone, or that edit the same files, are one ticket. A piece only one ticket needs stays inside that ticket. A piece two or more tickets need, such as a new entity, is the first ticket, and the others are dispatched after it merges. A PR is one ticket with every commit it needs, opened once the decision behind it is settled.
**Dispatch a wave of two or more tickets, and carry a wave of one yourself.** The session that received the request resolves the ambiguities that change the split (step 1, Clarify, below, with the user when present), splits, and groups the split into waves, a wave being the tickets that share no file and wait on none of the others. A wave of two or more is dispatched, one `general-purpose` worker per ticket (a docs-only ticket included), naming the `dispatch-run` skill in each worker's prompt, and on each `Agent` call the model and effort `dispatch-run`'s *Choosing model and effort* gives the ticket, running that skill itself, and reporting the run's PRs once its watch says every one of them is closed. A wave of one is done in this session with `ticket-work`, because a worker buys no wall-clock there and needs every fact this session holds restated, so five tickets that must merge in order are five waves of one. A request whose tickets cannot be settled yet, because the design between them is open, is one ticket until the design is decided.
**Parallel tickets each get their own worktree.** Start a session with `claude --worktree <name>`, or give a subagent `isolation: worktree`, then run the setup the opening paragraph above names.
**Bound the dispatch count by free memory and by what the account's usage windows have left.** Before each dispatch run `bun .claude/skills/dispatch-run/scripts/orchestrate.ts free-gib` and dispatch only while the GiB it prints stays above 4 per worker that will be running after this dispatch, plus 8 for the machine. Run `bun .claude/skills/dispatch-run/scripts/orchestrate.ts remaining-budget` before each dispatch as well, which prints one line on the account's usage windows, and hold the run while the five-hour window prints 80% or more, starting it again after the reset that line names. Right before each `Agent` call that dispatches a worker, run `bun .claude/skills/dispatch-run/scripts/orchestrate.ts record-dispatch <branch> <model> <effort> <kind>`, as `dispatch-run`'s *Bounding the dispatch* says. The seven-day window is not a hold condition, and where the line opens `unknown`, the cap that follows is the whole bound. Dispatch at most three workers in flight at once, however much memory `free-gib` reports and however much of a window `remaining-budget` leaves. `dispatch-run`'s *Bounding the dispatch* holds the reasons behind the per-worker memory and the in-flight cap, what a limit hit does to the workers in flight, and what the cost log records.
**Dead code first / phased execution:** Before structural refactors on files >300 LOC, remove dead code first (separate commit). Break multi-file refactors into phases of ≤5 files. Each phase is its own PR, and the next phase starts after that PR merges.
**Resolve a conflict by rebasing onto main.** `git fetch origin && git rebase origin/main`, resolve, run `bun run check` and `bun run test`, then `git push --force-with-lease` to the PR's own branch and no other. A PR no person has reviewed counts as Draft for the History rule in `.claude/hooks/guidance/commits.md`. Where the PR already carries comments, post that you force-pushed and that GitHub marked those comments Outdated, and leave why you rebased until they ask.
## Steps
1. **Clarify.** Resolve ambiguous acceptance criteria or constraints from the codebase, the assets, or git history. If that fails, a session with the user present hands back the ambiguity that blocks the most work, shaped as AGENTS.md's *Decide what the work needs and act on it* paragraph says. A dispatched worker states the assumption it took in the PR body and proceeds.
2. **Judge the design.** Creative or architectural work (new UI, a new pattern, a choice between credible alternatives) is proposed with its alternatives. A session with the user present implements after they approve. A dispatched worker implements the alternative it recommends and writes the others into the PR body.
3. **Set acceptance.** Write the acceptance criteria and the commands that verify them (`bun run check` / `bun run test` / build / manual smoke test, as applicable). Where the user asked for a plan, enter plan mode and present these with the files you will change, one line each.
4. **Check the interaction, when it is complex.** Wizards and multi-step forms, auth or session flows, async guards, permission branching: lay out the states, the initial one, the actions as guarded transitions, the invariants that must hold, and the flows that must never happen. Then attack it. Hunt a path whose every guard holds and that still breaks one of them, and a sequence of individually-allowed actions whose combination reaches an effect the design would refuse if asked for it directly: a required step skipped, one action replayed for a second effect, a privileged state entered by a route nobody weighed, an authority kept after it was revoked. The moves that find these: back, reload, cancel, retry, double-submit, a second tab, and a session or permission change mid-flow. An action you cannot place is a gap in the design, not licence to assume one. Fix the design before implementing.
**The invariants become an oracle where the behavior meets all four of these**, built with `@tanstack/oracles`, whose own `oracles-explore` skill carries the steps:
1. It breaks by the order or the combination of actions (a retry, a rollback, two writes at once, an event delivered twice or out of order), which no handful of examples enumerates.
2. A model far simpler than the code computes the right answer, such as two maps standing for D1 and R2. A model as intricate as the code repeats its bugs.
3. A break loses data, reaches another user's data, or leaves the stored state inconsistent with nothing reported.
4. The existing tests and Mootant cannot state the promise.
Cart and stock reservation, a payment webhook, an order's status transitions, an optimistic write queue, a cache with invalidation, cursor pagination under inserts, offline sync, and a permission table typically meet them. A form, a display component, a thin route, a wrapper over an external API, and a pure validation whose answer one input decides fail the first or the second, and take example tests, with a `fast-check` property added where examples run thin. A rewrite meets the second for free, because the old implementation serves as the model. Each law quotes the doc, the comment or the test that promises it. Behavior that only the code shows, with nothing promising it, is a question for the user rather than a law. Where a law fails, the oracle shows the failing run before the smallest fix goes in.
5. **Implement.** The parent implements directly, and delegates only to keep an investigation's raw output out of its context, to run independent units at once, or to hand mechanical implementation to the Codex CLI under the `codex-delegation` skill. The tests that go with what you add follow AGENTS.md's Testing section. When debugging, reproduce the failure and check what changed recently before forming a hypothesis, then test that hypothesis with the smallest possible change. Never try changes to see which one sticks. Before adding a flag, an override, or a shim to keep a failing mechanism working, remove the mechanism and run the tests; where nothing fails, the mechanism goes rather than the workaround.
6. **Self-check.** Read the full diff. Run `bun run check` and `bun run test`, fixing every error. CI adds checks the gate does not run, unfiltered by which files your diff touched, and what they find is yours to fix: `bun run test`, `bun run dead-code`, `bun run dupes`, `bun run build`, which runs the build `void deploy` runs without deploying, `bun run smoke`, which boots the dev server on an empty local D1 and R2 and requests the routes `scripts/smoke/smoke.expected.ts` names (run it where a change could reach a request), and `bun scripts/claude-frontmatter/check-claude-frontmatter.entry.ts` (run it after editing anything under `.claude/`, which the Stop gate passes and CI then fails), `bun run check:pins` after changing `package.json` or `bun.lock`, `mise exec -- actionlint` after editing `.github/workflows/`, and `mise exec -- bun run check:shell` after editing a `*.sh` file. No git hook runs these last three. No gate reads rendered text beyond the one marker string smoke checks on a route, so where a change alters what a page renders, run `bun run dev` and read the route at the URL it prints. Where the diff changes a module the coverage gate measures, run `bun run mutate <those modules>`, which mutates only them and reuses the verdicts Mootant cached under `node_modules/.cache/mootant` for mutants whose code and tests did not change. List the mutants no test notices, the survivors, with `bun run mutate --json <those modules> | jq -r '.mutants[] | select(.status == "Survived" or .status == "NoCoverage") | "\(.file):\(.line):\(.column) \(.status) \(.mutator) \(.focus.replacement // "")"'`. CI fails a pull request while a module it changes holds a survivor, so this step ends with none left. Where the diff changes a module an oracle owns (an `*.oracle.test.ts` file names it in an `owns` list), run that oracle's gap check too: `bunx oracle-gaps --package . --source <the owned file> --seed <n> --config vitest.config.mts`, which runs every test file unmutated (the oracle files twice), then mutates the `--source` file and reports a mutant in code no oracle owns as `unowned`, a warning rather than a gap. Its last line is `oracle-gaps: done completed, <n> gaps, report <path>/summary.md` with exit 0 even when gaps remain, and the report lands under the OS temp directory, never in the repository. Exit 2 is a refusal whose `fix:` line says what to change, and exit 3 is a bug in `oracle-gaps` whose stack is in `error.log` beside the report. Close each gap the report lists by widening the oracle's histories or its checks until the run reports 0 gaps; `node_modules/@tanstack/oracles/skills/oracles-design/SKILL.md` step 8 says what each gap class asks for.
Read each survivor as the question of what its code promises that no test states, and give it one of three answers:
1. **A caller relies on the behaviour.** Write the test that states it, titled `should <what the caller relies on> when <the condition>` as the tests here are. Code that reads or writes D1, R2 or Better Auth carries behaviour, so its survivor takes this answer. So does an `Effect.fn` name, because a failure reported inside the operation carries it in the record's `operations` field in Workers Logs, and the test that makes the operation report that failure states the name. A service key takes this answer too: `src/shared/lib/service-keys.test.ts` compares each exported key with the package name, module path and class name it derives for that class.
2. **Nothing relies on it.** The code does nothing a caller can observe, so delete it or simplify it until the mutant has nothing to change. A mutant that behaves the same as the original, such as one dropping a regex anchor the pattern already implies, takes this answer.
3. **The code promises a value rather than behaviour**, such as page copy. A kind of value is kept out of mutation in `scripts/mutate/mutation-targets.ts`, by a file pattern it leaves unmutated. Move the value into a file that list already leaves unmutated, or, where no exclusion there fits its kind, add one in this pull request, so the reviewer sees the new kind.
Write a test only for the first answer. A test that restates how the implementation reaches its result protects no caller, and the survivor it was aimed at takes the second or third answer instead. A survivor never stays in place with a reason in the PR body or a disable comment in the code.
The tests credited with a kill are listed by `bun run mutate --json --all --verbose <those modules> | jq -r '[.mutants[].killedBy | select(. != null) | "\(.file) \(.name)"] | unique[]'`, so a test the diff adds or changes that the list leaves out killed nothing. Mootant credits a kill only to the first test that failed, so read such a test before deleting it.
Confirm step 3's acceptance criteria, reading the diff yourself for anything a subagent implemented rather than its summary. Where a criterion watches a `requestAnimationFrame` loop, confirm it in a page Chrome DevTools MCP's `new_page` opened, which is in the foreground unless `background` is set, because a tab opened with `tabs_create_mcp` can report `hidden` and run no frames while `javascript_tool` still runs scripts in it, timers included.
7. **Review, then commit.** A PR's author holds it until it merges, and no repository setting is involved. It is Draft from the first commit, ready once `bun run check` and `bun run test` pass on the branch, and merged once the CI `build` check passes on the merged result, after which its remote branch is deleted.
1. Dispatch the `code-reviewer` agent on the uncommitted diff as the ticket's whole review, telling it what changed and why, what is out of scope, and what you are least sure of. Pass `model: "opus"` and `effort: "high"`, the row `dispatch-run`'s *Choosing model and effort* names for the review. A `code-reviewer` that returned no report, whether it died or hit a rate limit, is dispatched again.
2. Apply the fix each finding returns. Where a finding needs a decision, write the finding, the change it asks for, and your reason into the PR body, and continue.
3. Read `.claude/hooks/guidance/prose.md` before writing the first commit message or the PR body, because the hook that points at it fires on the command that already carries the text. Split the commits as `.claude/hooks/guidance/commits.md` says. `gh pr create --draft` opens the PR after the first commit.
4. Mark the PR ready once `bun run check` and `bun run test` pass on the branch and every finding a review returned has been answered.
5. Poll the CI check in one foreground Bash call: `until gh pr checks <number> --json name,bucket --jq '.[] | select(.name=="build") | .bucket' | grep -xE 'pass|fail|cancel|skipping'; do sleep 30; done`, which prints the bucket it stopped on. The loop stops on every final bucket, because waiting for `pass` alone would hold the call until the Bash timeout ends it. A background watch ends the turn before the check reports, and `--watch` waits on the third-party checks too, one that never reports holding it forever. `build` in `.github/workflows/ci.yaml` waits on every other job in that file and fails when any of them did not pass, so `select(.name=="build")` covers all of this repository's CI, and a job added to that file goes into the `needs` of `build` rather than into the loop. `--json` prints each object's fields in alphabetical order, `{"bucket":"pass","name":"build"}`, so a grep for `"name":"build","bucket":"pass"` matches nothing.
6. On `fail`, `cancel` or `skipping`, read the failing step with `gh run view <run-id> --log-failed`, where `<run-id>` is the number after `/runs/` in the `link` that `gh pr checks <number> --json name,link` prints for `build`, fix it on the branch, and poll again.
7. Where `gh pr view --json mergeStateStatus` says `BEHIND`, run `gh pr update-branch` so the check runs on the merged result, `git pull` before committing on the branch again, and poll once more.
8. Run `gh pr merge --squash <number>`, with `--squash` right after `merge` and the number after it, because the `.claude/settings.json` allow rule matches from the start of the command and `--merge`, `--rebase`, `--admin`, or the number before `--squash` reaches the auto-mode classifier instead.
9. Run `git push origin --delete <branch>`, because `--delete-branch` checks `main` out locally and fails in a worktree.