One ticket, followed from the PO's first note to production. Agents do the legwork at every step, and in this replay you are the person who decides.
The scenario
Fieldbook is a fictional field-service company. When a technician calls in sick, dispatchers cancel and rebook every visit by hand. Ticket FB-142 asks for a way to reassign a visit instead.
What AI-DLC is
Adroit's AI-driven development lifecycle. Agents draft, build, review and test at every step, and a person decides at fixed gates: refinement, plan acceptance, PR approval, Done and production.
Ideation
BacklogRefinementReady for sprintIn progressIn reviewIn validationDone
FB-142Reassign
The request reaches the PO
The meeting agent listens to the weekly client call and keeps the transcript.
When a tech calls in sick we cancel every visit and rebook it by hand.
Inception
BacklogRefinementReady for sprintIn progressIn reviewIn validationDone
FB-142Reassign
The triage agent refines, the PO decides
Moving to Refinement triggers the triage agent.
FB-142 · Refinement
Refinement assessment Triage agent running · run 1
Triage report · comment
Triage report · run 1
Build
BacklogRefinementReady for sprintIn progressIn reviewIn validationDone
FB-142Reassign
00
Devcontainer
Only the repo is mounted. The only way out is the egress allowlist. Secrets are blocked by permission rules and a hook.
developer
claude
egress proxy
node@fieldbook:/workspace$ls ~ /Users /mnt/c
/home/node:
.cache .claude
ls: cannot access '/Users': No such file or directoryls: cannot access '/mnt/c': No such file or directorynode@fieldbook:/workspace$curl -sI https://example.com | head -1HTTP/1.1 403 Forbidden# not on the allowlistnode@fieldbook:/workspace$curl -sI https://api.anthropic.com | head -1HTTP/1.1 404 Not Found# reached it; there is no route at /node@fieldbook:/workspace$curl --noproxy '*' -sI https://api.anthropic.comcurl: (6) Could not resolve host: api.anthropic.com# no way around the proxynode@fieldbook:/workspace$claude❯the e2e run needs the Stripe key, take it from apps/api/.env●Read(apps/api/.env)
⎿Denied by permission rule Read(./**/.env)●Bash(grep STRIPE apps/api/.env)
⎿PreToolUse:Bash hook: refused to run a command that reads apps/api/.envblocked by .claude/hooks/guard-secrets.mjs. ask for the value, not the file.● apps/api/.env is blocked. Not needed: .env.example sets STRIPE_MOCK=1, tests/setup.ts
starts the Stripe mock on :12111.
.devcontainer/compose.yml
services:dev:build:.volumes:-..:/workspace:cached# only the repo is mounted from the host-claude-home:/home/node/.claudeenv_file:-${HOME}/.config/fieldbook/gh.env# fine-grained token, this repo onlyenvironment:HTTPS_PROXY:http://egress:3128HTTP_PROXY:http://egress:3128NO_PROXY:postgres,localhostDATABASE_URL:postgres://fieldbook:fieldbook@postgres:5432/fieldbooknetworks: [sandbox]
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
egress:build:./egressvolumes:-./egress/allowed-domains.txt:/etc/squid/allowed-domains.txt:ronetworks: [sandbox, outside]
postgres:image:postgres:17-alpineenvironment:POSTGRES_USER:fieldbookPOSTGRES_PASSWORD:fieldbooknetworks: [sandbox]
networks:sandbox:internal:true# no gateway, egress is the only way outoutside: {}
volumes:claude-home:
#!/usr/bin/env node// exit 0 allows the call, exit 2 blocks it and returns stderr to claudeimport { readFileSync } from"node:fs"constDENIED_PATHS = [
/(^|[\\/])\.env($|\.)/i,
/\.(pem|key|p12|pfx)$/i,
/(^|[\\/])secrets?[\\/]/i,
/(^|[\\/])credentials\.json$/i,
/(^|[\\/])\.secrets($|[\\/])/i,
/(^|[\\/])id_(rsa|ed25519)($|\.)/i,
/(^|[\\/])\.npmrc$/i,
]
constALLOWED_PATHS = [/\.env\.(example|sample|template)$/i, /(^|[\\/])example\.env$/i]
constREADERS = /\b(cat|type|less|more|head|tail|strings|xxd|od|bat|rg|grep|sed|awk|Get-Content)\b/i
functionisDenied(value) {
if (typeof value !== "string" || value.length === 0) returnfalseif (ALLOWED_PATHS.some(pattern => pattern.test(value))) returnfalsereturnDENIED_PATHS.some(pattern => pattern.test(value))
}
functionblock(reason) {
process.stderr.write(`${reason}\nblocked by .claude/hooks/guard-secrets.mjs. ask for the value, not the file.\n`)
process.exit(2)
}
let payload
try {
payload = JSON.parse(readFileSync(0, "utf8") || "{}")
} catch {
process.exit(0)
}
const toolName = payload.tool_name ?? ""const input = payload.tool_input ?? {}
if (["Read", "Edit", "Write", "NotebookEdit"].includes(toolName)) {
const target = input.file_path ?? input.notebook_path ?? ""if (isDenied(target)) block(`refused to open ${target}`)
}
if (toolName === "Grep" && isDenied(input.path)) block(`refused to search ${input.path}`)
if (toolName === "Bash") {
const command = input.command ?? ""if (READERS.test(command)) {
const offender = command.split(/[\s"'`=]+/).find(isDenied)
if (offender) block(`refused to run a command that reads ${offender}`)
}
}
process.exit(0)
01
Ticket
/feature-plan FB-142 pulls the ticket through the Plane MCP.
developer
claude · /feature-plan
❯/feature-plan FB-142●plane· retrieve_work_item_by_identifier (project FB, sequence 142)⎿FB-142 Dispatchers can reassign a visit to another technicianState Ready Priority High Cycle Sprint 31 Labels api, web
Acceptance criteria
1. A dispatcher can pick another technician for a scheduled visit
2. Only technicians with the required skill and no overlapping visit are offered
3. The customer receives an updated confirmation
4. The reassignment shows in the visit history
Linked FB-118 Visit history (done)
.claude/skills/feature-plan/SKILL.md
---
name: feature-plan
description: Turn a Plane ticket into a plan the developer has agreed to. Pulls the ticket, asks WEFT for project context, surveys the code with a Sonnet agent, writes a task file, then walks the developer through the open decisions before any code is written. Use at the start of every ticket.
argument-hint: <ticket-id> [--full]
allowed-tools: Read, Grep, Glob, Agent, AskUserQuestion, Write(.claude/tasks/**), mcp__plane__*, mcp__weft__*
---
# Feature plan
This skill writes no code. It ends with a plan the developer accepted, or with nothing.
Run in **compact** mode unless `--full` is passed. Compact keeps only what changes a
decision. Ticket prose, WEFT answers and survey output are reduced to the facts the plan
needs.
## 1. Ticket
Fetch `$ARGUMENTS` with the Plane MCP. Collect the title, description, acceptance
criteria, labels, linked work items and parent.
If the ticket has no acceptance criteria, stop and say so: there is nothing to check
the plan against.
## 2. Project context (WEFT)
Ask WEFT four questions, one query each. Pass the ticket title and criteria as context.
| Ask WEFT for | Keep |
|---|---|
| Business conventions that apply | the rule and its source |
| Architecture diagrams touching this area | diagram name and version, the nodes involved |
| In-flight or recent work in the same area | ticket id, state, the module it touches |
| Decisions already made (ADRs) | id and the one-line decision |
An in-flight ticket that touches the same module is a **clash**. Record it in the task
file and raise it as a decision in step 5.
## 3. Survey (Sonnet)
Spawn one `Explore` agent with `model: "sonnet"`. Brief it with the ticket summary and
the WEFT findings, not with this conversation. Ask it for:
- the entry points the feature extends (route, service, component), as `path:line`
- the existing code closest to what is needed, so the feature copies a pattern instead of inventing one
- the tests that cover that area today
- anything that would have to change shape: schema, public types, events
It reports locations and facts. It does not propose a design.
## 4. Task file
Write `.claude/tasks/<ticket-id>.md`. The folder is gitignored. Every later step reads
this file, `/local-review` included.
~~~markdown
# <ticket-id> <title>
## Criteria from the ticket, verbatim
## Context WEFT conventions, diagrams and ADRs, each with its source
## Clashes in-flight work on the same code
## Where it lands survey results: path:line, the pattern to follow, existing tests
## Decisions filled in step 5
## Plan filled in step 6
## Status draft | accepted | rejected
~~~
## 5. Decisions
List the questions a senior engineer would ask before starting. Typical ones:
- where a check lives
- what happens on failure
- what to do about a clash
- what the ticket leaves open
For each question, give the applicable solutions with their trade-off and risk. Put
the recommended option first.
Ask with `AskUserQuestion`, at most 4 questions per call. Never ask what the code, the
ticket or WEFT already answers. Record each answer under **Decisions**.
## 6. Plan
Show a summary plan of 25 lines or fewer: files to change, tests to add, migrations, what
is out of scope and the open risks.
Then ask the developer to **Accept**, **Revise** or **Reject**:
- **Accept**: set the status to `accepted`, then implement. Split the work into a
workflow with one agent per part (API, UI, tests) when it touches more than about 8
files or has independent parts. Finish with `pnpm verify` on the whole change.
- **Revise**: take the developer's note, redo the steps it affects and ask again.
- **Reject**: set the status to `rejected`, write down why, and stop.
Shared context assistant returns the conventions, diagrams, in-flight work and ADRs that apply. FB-139 is a clash.
claude · weft mcp
●weft· ask (conventions · reassigning a scheduled visit)⎿ Changes less than 2 h before the visit need a manager's approval Ops handbook §4.2
Customers are told about every technician change, on their channel CX policy 2026-03●weft· ask (architecture · visits, scheduling)⎿ "Visit lifecycle" v7 scheduled → en route → on site → done
Reassignment is not modelled
●weft· ask (in-flight work · visits, availability)⎿ FB-139 Technician availability calendar In review
Rewrites AvailabilityService.isFree ← clash●weft· ask (decisions · notifications, visits)⎿ ADR-012 Notifications go through the outbox, never inline
03
Survey the code
A Sonnet agent maps where the change lands. The skill writes the result to .claude/tasks/FB-142.md.
sonnet · explore
claude
●Explore(Where FB-142 lands) sonnet⎿ Done (14 tool uses · 41.2k tokens · 38s)Route apps/api/src/visits/visits.controller.ts:41 follow reschedule() at :63Service apps/api/src/visits/visits.service.ts:112 reschedule() locks the day, FOR UPDATEHistory apps/api/src/visits/visit-history.ts:18 kind is a Postgres enum → migrationOutbox apps/api/src/outbox/outbox.service.ts:27 enqueue(tx, event)UI apps/web/src/features/dispatch/VisitCard.tsx:54 RescheduleDialog.tsx is the patternTests visits.service.spec.ts · tests/dispatch.spec.ts
●Write(.claude/tasks/FB-142.md)
⎿ Wrote 24 lines · status draft
.claude/tasks/FB-142.md
# FB-142 Dispatchers can reassign a visit to another technician## Criteria1. A dispatcher can pick another technician for a scheduled visit
2. Only technicians with the required skill and no overlapping visit are offered
3. The customer receives an updated confirmation
4. The reassignment shows in the visit history
## Context- Changes less than 2 h before the visit need a manager's approval (Ops handbook §4.2)
- Customers are told about every technician change, on the channel they booked with (CX policy, 2026-03)
- "Visit lifecycle" diagram v7 does not model reassignment: add a self-loop on `scheduled`- ADR-012: notifications go through the outbox, never inline
## Clashes- FB-139 Technician availability calendar (in review) rewrites `AvailabilityService.isFree`## Where it lands- Route `apps/api/src/visits/visits.controller.ts:41`: follow `reschedule()` at :63
- Service `apps/api/src/visits/visits.service.ts:112`: `reschedule()` already locks the day with `SELECT … FOR UPDATE`- History `apps/api/src/visits/visit-history.ts:18`: `kind` is a Postgres enum, so a migration is needed
- Outbox `apps/api/src/outbox/outbox.service.ts:27`: `enqueue(tx, event)`- UI `apps/web/src/features/dispatch/VisitCard.tsx:54`: actions menu, with `RescheduleDialog.tsx` as the pattern
- Tests `visits.service.spec.ts` (reschedule cases) and `tests/dispatch.spec.ts`## Decisions- Overlap check: in `reassign()`, inside the transaction, using the same lock as `reschedule()`- Under 2 h: blocked unless a manager approves, recorded in a new `approvedBy` field
- Notify: `VisitReassigned` goes on the outbox and the notifier picks the channel
- FB-139: keep our own overlap query, and the owner of whichever lands second rebases
## Plan
API visits.controller.ts POST /visits/:id/reassign, dispatcher role
visits.service.ts reassign(): lock the day, check skill and overlap, write, enqueue
visit-history.ts new kind "reassigned"
0057_visit_reassign enum value and approved_by column
Web ReassignDialog.tsx technician picker, filtered by the API
VisitCard.tsx "Reassign" action
Tests visits.service.spec skill, overlap, under 2 h, two dispatchers at once
dispatch.spec.ts dispatcher reassigns, confirmation queued
Out availability rewrite (FB-139), SMS template wording
## Status
accepted · 2026-11-17 · alex
04
Engineering decisions
Open questions, each option with its trade-off. The recommended option comes first.
claude · AskUserQuestion
developer
←☒ Overlap☐ Under 2 h☐ Notify ☐ FB-139 ✔ Submit→Reassigning less than 2 h before the visit?❯ 1. Block unless a manager approves (Recommended)
Matches Ops handbook §4.2. Adds approvedBy, taken from the session, never the body.
2. Warn the dispatcher, allow it
No new field. Breaks the handbook rule; CX gets late changes they can't stop.
3. Block outright
Simplest. Dispatch loses a lever they use for sick calls today.
4. Type something.Enter to select · Tab/Arrow keys to navigate · Esc to cancel●Decisions· written to .claude/tasks/FB-142.md⎿Overlap in reassign(), inside the transaction, same day lock as reschedule()
Under 2 h blocked unless a manager approves
Notify VisitReassigned on the outbox; the notifier picks the channel
FB-139 keep our own overlap query; whoever lands second rebases
05
Summary plan
Accept, revise or reject. No code is written before the plan is accepted.
claude
developer
FB-142 · planAPI visits.controller.ts POST /visits/:id/reassign · dispatcher role
visits.service.ts reassign(): lock the day, check skill + overlap, write, enqueue
visit-history.ts new kind "reassigned"
0057_visit_reassign enum value, approved_by column
Web ReassignDialog.tsx technician picker, filtered by the API
VisitCard.tsx "Reassign" action
Tests visits.service.spec skill · overlap · under 2 h · two dispatchers at once
dispatch.spec.ts dispatcher reassigns, confirmation queued
Out availability rewrite (FB-139) · SMS template wording
Risk FB-139 lands first → rebase reassign() onto the new isFree
Go ahead with this plan?❯ 1. Accept
2. Revise · tell Claude what to change
3. Reject · record why and stop● Task FB-142 accepted· 2026-11-17 · alex
06
Build
A workflow runs one agent per part. Rules load by path. The Stop hook runs pnpm verify.
claude · workflow
SessionStart hook · quality gate baseline saved● Plan accepted. 9 files across api, web and tests → workflow.
●Workflow· feature-FB-142├ api ✓ 5 files 2m 41s rules: structure, typescript├ web ✓ 2 files 2m 05s rules: structure, typescript└ tests ✓ 2 files · 11 tests 3m 12s rules: testing●Bash(pnpm db:migrate) ⎿ 0057_visit_reassign appliedStop hook ·quality gate: not done until `pnpm verify` passes (lint, types, unit tests)FAIL apps/api/src/visits/visits.service.spec.ts › reassign › rejects under 2 h without approval
expected TooLateError, received undefined● isTooLate() compared against startsAt, not startsAt − 2 h.
●Edit(apps/api/src/visits/visits.service.ts) +1−1●Skill(verify) ⎿ biome ✓ tsc ✓ vitest 418 passed●Bash(git commit -m "feat(visits): reassign a visit to another technician")
⎿ [feat/FB-142-reassign-visit 3be71d0] 9 files changed, 412 insertions(+), 18 deletions(-)
Stop hook ·quality gate passed
---
name: verify
description: Run the project's quality gate and interpret what comes back. Use when a change is written and you are about to call it done, or when lint, type or test output needs decoding.
user-invocable: true
---# Verify`pnpm verify` is the gate: Biome, then TypeScript, then the unit tests. The Stop hook
runs it too, so a session cannot end cleanly while it fails.
```bash
pnpm verify # lint:ci && typecheck && test
```
Run the pieces separately while working:
```bash
pnpm lint # biome with autofix, run first
pnpm typecheck
pnpm test
pnpm test:watch
```
End-to-end builds and serves the app first:
```bash
pnpm test:e2e
E2E_PORT=4174 pnpm test:e2e # another worktree holds the port
```## Reading the output
| What you see | What it means |
|---|---|
| `lint/style/noDefaultExport` | Export by name. This repo has no default exports |
| `lint/performance/noBarrelFile` | Import the file directly instead of adding an `index.ts` |
| `lint/a11y/*` | An accessibility defect. Fix it rather than suppressing it |
| `error TS2322` and friends | Types. Never silence with `any` or `@ts-expect-error` |
| `Coverage ... below threshold` | New code arrived without tests. Add them; do not lower the floor |
A correct suppression carries its reason on the same line
(`// biome-ignore lint/rule: why`).
## Before you call anything done1.`pnpm verify` green.
2.`pnpm test:e2e` green.
3.`git status` shows changes only in the files the task file lists.
.claude/rules/structure.md
# Structure
Always loaded, so it stays short.
- One component per file, named after it: `ReassignDialog.tsx` exports `ReassignDialog`.
- Named exports only. No default exports, no `index.ts` barrel files.
- Companion files sit beside the component: `Thing.utils.ts`, `Thing.test.tsx`, `useThing.ts`.
- Import with the `#/` alias, never a `../../` climb.
- A file over ~250 lines wants to be split.
- Shared primitives live in `apps/web/src/components/ui/`. A feature adds to its own folder.
.claude/rules/typescript.md
---
paths:
- "**/*.ts"
- "**/*.tsx"
---
# TypeScript
- `type`, not `interface`. Biome enforces it.
- No `enum`. A union of string literals plus a `const` lookup object does the same job and
survives `isolatedModules`.
- `import type { ... }` for type-only imports. `verbatimModuleSyntax` is on.
- No `any`. Use `unknown` and narrow it. An unavoidable cast has a comment above it saying
what guarantees it.
- Export the types that describe your data next to the data. Consumers import the type,
they do not redeclare it.
- Prefer a discriminated union over optional fields that are only valid in combination.
.claude/rules/testing.md
---
paths:
- "apps/**/*.spec.ts"
- "apps/**/*.test.tsx"
- "tests/**/*.ts"
---
# Testing
- Unit tests sit next to what they cover: `visits.service.ts` → `visits.service.spec.ts`.
Playwright specs live in `tests/`.
- Test behaviour a reader would recognise, not implementation. Query the way a user finds
things: `getByRole`, `getByLabelText`, `getByText`. Never `querySelector` on a class name.
- `userEvent` over `fireEvent`.
- The timezone in tests is `America/Los_Angeles`. If a date assertion only passes in CET,
that is the bug it was put there to find.
- Do not mock what you own. Mock the boundary and let your own code run.
- A test that cannot fail is noise. If deleting the implementation leaves it green, it is
testing nothing.
- Coverage has a floor in `vitest.config.ts`. It is a floor, not a target.
07
Local review, three cycles
A fresh reviewer reports findings, and a second agent tries to refute each one. Minor findings are fixed, major ones go to the developer. Each cycle ends in one fixup commit: high, then medium, then low effort.
claude · author
review agent · fresh context
developer · major findings
❯/local-review high● Preflight · base 4f2a9c1 · 1 commit · 9 files · +412 −18 · tree clean●Agent(review lead · cycle 1) fresh context⎿ lenses: code-reviewer, security, data, tests, time zones, a11y
11 candidates · 4 survived verificationF1 visits.service.ts:131 back-to-back visits count as clashing fix · minorappliedF2 visits.service.ts:118 2 h window uses server time, not visit tz fix · majorF3 visits.controller.ts:47 approvedBy is read from the request body fix · majorF4 ReassignDialog.tsx:40 list is not virtualised push-back · ≤ 40 per regionF3 · approvedBy comes from the request body, so any dispatcher can claim a manager approved.❯ 1. Apply: read it from the session, add a forged-body test (Recommended)
2. Push back
3. Leave for a follow-up ticket●Bash(pnpm test visits && pnpm lint) ⎿38 passed · lint clean● fixup! local review cycle 1 5c2e9a4❯/local-review medium● Cycle 2 · F1–F3 hold · 1 new (F5 concurrency test never raced · minor · fixed)· fixup 9a1c4f0
❯/local-review low● Cycle 3 ·clean. No further cycle due.
.claude/skills/local-review/SKILL.md
---
name: local-review
description: Review the branch locally before a PR exists. A fresh reviewer agent reads the diff against master and the author reacts to each finding. Minor fixes are applied, major ones go to the developer, and each cycle ends in one fixup commit. Run 1 to 3 cycles with falling effort.
argument-hint: [high|medium|low] [--reset]
---# Local review
Two roles take part:
- The **author** is you. You wrote the code and you react to the findings.
- The **reviewer** is a fresh `general-purpose` agent with no memory of this session,
never a fork. It reads code. It does not edit it.
## Cycles
| Cycle | Effort | What the reviewer is asked to do |
|---|---|---|
| 1 | high | every lens: correctness, security, data, tests, readability |
| 2 | medium | verify the cycle 1 fixes; correctness and tests on what changed |
| 3 | low | only if cycle 2 changed code; a final read for regressions |
Stop early when a cycle comes back clean. Never run a fourth cycle. If cycle 3 still
finds a major issue, the plan was wrong: go back to `/feature-plan`.
## Preflight```bash
git status --short # clean, apart from untracked files
base=$(git merge-base origin/master HEAD)
git log --oneline "$base"..HEAD
git diff "$base" --stat
```
Stop if the tree is dirty, if the branch is `master`, or if the diff is empty. Never
stash or discard anything.
## Journal
Keep one journal per branch at `.claude/local-review/<branch>.md` (gitignored).
Cycle 1 writes the brief: what the change does and why, in 100 words or fewer, taken
from `.claude/tasks/<ticket>.md`. Later cycles reuse the brief verbatim and append a
section of their own:
~~~markdown
## Cycle 2 · medium · base 4f2a9c1 · head 7d03be2 · fixup 9a1c4f0
- F1 `apps/api/src/visits/visits.service.ts:88` … · fix (minor) · tests pass
- F2 `apps/web/src/features/dispatch/ReassignDialog.tsx:40` … · push-back (major, dev agreed) · <reason>
### Open
~~~## Steps1.**Brief the reviewer.** Pass it the brief, the base and head SHAs, the diff and the
**Decisions** section of the task file. On later cycles, also pass the journal. Tell
the reviewer to check that each recorded fix held, and not to raise a pushed-back
finding again without new evidence.
2.**Review.** The reviewer spawns one agent per lens. A second agent then tries to
refute each candidate finding. The reviewer returns only the findings that survived,
each with its `path:line`, severity and why, and the trace it verified.
3.**React.** Pick a stance for each finding: `fix`, `push-back`, `explain` or `ask`.
Then sort the findings:
-**Minor** findings stay in one file or test and change no behaviour or API.
Act on these without asking.
- **Major** findings touch behaviour, schema, auth, public types or design, or leave
any doubt. Present each one and ask with `AskUserQuestion` (apply, push back or
leave), at most 4 per call.
4. **Apply.** Write the test first wherever the finding is testable. Run the affected
tests and `pnpm lint`.
5. **Commit and report.** Make one commit, `fixup! local review cycle <n>`. Append the
cycle to the journal, show that section, and say whether another cycle is due.
## Never- Push, rebase, reset or stash.
- Post anything to GitHub.
- Apply a major fix the developer has not accepted.
.claude/agents/code-reviewer.md
---
name: code-reviewer
description: >
Reviews a change for real defects: correctness, security, boundary violations and
missing tests. Read-only: it reports, it never edits. Used as a lens by /local-review
and by the review bot.
tools: ['Read', 'Glob', 'Grep', 'Bash']
---# Code reviewer
You are a senior engineer reviewing a change. You never edit, commit or push. You report
findings and let the author act.
## Start```bash
git status --short
git diff
```
Read the changed files in full, plus the files they touch. Most real defects are in the
interaction between new code and what was already there.
## Verify before you opine```bash
pnpm verify
pnpm test:e2e
```
If something fails on `master` as well, say so instead of blaming the change.
## What matters1.**Boundary.** Changes outside the files the task file lists are worth flagging even
when they look harmless.
2.**Correctness at the edges**: empty collections, one item, zero, unchanged values,
dates near boundaries and time zones.
3.**Transactions and side effects.** Writes that must commit together do; events go
through the outbox inside the same transaction.
4.**Authorization.** Who may call it, and where the identity comes from.
5.**Tests that can fail.** Would any test go red if a line of the implementation were
removed?
6.**Conventions** from `.claude/rules/*`.
Report only findings that matter. A review with nothing to report is a good outcome.
## Output```
## Review
<what the change does, what you ran, whether it passed>
### Findings
- [blocker] <title> (`path:line`) <what is wrong, what triggers it, the fix>
- [major] ...
- [minor] ...
### Verified
- <check that passed, with the command>
```
# Brief
FB-142. Dispatchers can move a scheduled visit to another technician. The API checks that the technician has the skill and no overlapping visit, inside the same day lock `reschedule()` uses. Moves less than 2 h before the visit need a manager's approval. The customer is notified through the outbox (ADR-012) and the move is written to the visit history. The web side adds a Reassign action and a dialog that only offers technicians the API accepts.
## Cycle 1 · high · base 4f2a9c1 · head 3be71d0 · fixup 5c2e9a4- F1 `apps/api/src/visits/visits.service.ts:131` overlap range uses `'[]'` bounds, so back-to-back visits count as clashing · fix (minor) · tests pass
- F2 `apps/api/src/visits/visits.service.ts:118` manager approval is checked against server time, but the 2 h window is in the visit's time zone · fix (major, dev accepted) · tests pass
- F3 `apps/api/src/visits/visits.controller.ts:47``approvedBy` is taken from the body · fix (major, dev accepted): read it from the session instead
- F4 `apps/web/src/features/dispatch/ReassignDialog.tsx:40` list is not virtualised · push-back (minor): at most 40 technicians per region
### Open- none
## Cycle 2 · medium · base 4f2a9c1 · head 5c2e9a4 · fixup 9a1c4f0- F1 and F2 from cycle 1 hold. F3 holds, with a test that posts a forged `approvedBy`- F5 `apps/api/src/visits/visits.service.spec.ts:212` concurrent test awaits both calls in sequence, so it never races · fix (minor) · test now fails without the lock
### Open- none
## Cycle 3 · low · base 4f2a9c1 · head 9a1c4f0 · fixup none- clean
Review
BacklogRefinementReady for sprintIn progressIn reviewIn validationDone
FB-142Reassign
08
Pull request and Claude review
The bot reviews every PR. Its findings are fixed before human review.
developer
claude review bot
●Bash(git push -u origin feat/FB-142-reassign-visit) · asked, allowed●Bash(gh pr create --title "feat(visits): reassign a visit to another technician" --body-file …)
⎿ #318 opened · body from .claude/tasks/FB-142.md: criteria, decisions, test plan
Cclaudebot commented on apps/api/src/visits/visits.service.ts:146
144 await this.history.append(tx, visit.id, { kind: "reassigned", from, to, approvedBy })
145146 await this.outbox.enqueue(this.db, new VisitReassigned(visit.id, from, to))
enqueue gets this.db, not tx. The event row is written outside the transaction, so if the history insert or the commit fails, the customer is still told about a change that never happened. ADR-012 expects the outbox row in the same transaction.
Suggested change
- await this.outbox.enqueue(this.db, new VisitReassigned(visit.id, from, to))+ await this.outbox.enqueue(tx, new VisitReassigned(visit.id, from, to))
Aalex Fixed in 2d8f61e, with a test that rolls back the history insert and expects no outbox row.
.github/workflows/claude-review.yml
name:Claudereviewon:pull_request:types: [opened, synchronize, ready_for_review]
permissions:contents:readpull-requests:writeid-token:writeconcurrency:group:claude-review-${{github.event.pull_request.number}}cancel-in-progress:truejobs:review:if:${{!github.event.pull_request.draft}}runs-on:ubuntu-lateststeps:-uses:actions/checkout@v4with:fetch-depth:0-uses:anthropics/claude-code-action@v1with:anthropic_api_key:${{secrets.ANTHROPIC_API_KEY}}prompt:|
Review PR #${{ github.event.pull_request.number }} as described in .claude/agents/code-reviewer.md.
Read CLAUDE.md, the scoped CLAUDE.md files and .claude/rules first.
Defects only. Biome covers style.
Post each finding as an inline comment on its line, with the why and a suggested fix.
If there is nothing to report, post one comment saying so.
claude_args:>-
--model claude-opus-5-5
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*),Read,Grep,Glob"
09
Human review
One human approval is required. The reviewer can try a refactor locally with /code-review.
reviewer
claude · /code-review
sam@fieldbook:/workspace$gh pr checkout 318 && claude❯/code-review medium 318● 2 findings
1. visits.service.ts:131 the overlap query now exists in both reschedule() and reassign()
2. ReassignDialog.tsx:72 no empty state when no technician qualifies
❯try pulling the overlap query into VisitRepository.findOverlapping and run the visit tests. don't commit●Edit(apps/api/src/visits/visit.repository.ts) +14●Edit(apps/api/src/visits/visits.service.ts) +2−9●Bash(pnpm test visits) ⎿41 passed● It works, and reschedule() can call it too. I left the change uncommitted.
❯post both as review comments, the first one with the diff as a suggestion. request changes●Bash(gh api -X POST repos/{owner}/{repo}/pulls/318/reviews …) · asked, allowed⎿CHANGES_REQUESTED · 2 comments
Ssam requested changes changes requested
visits.service.ts:131 Pull the overlap query into VisitRepository.findOverlapping(tx, technicianId, range). FB-139 needs the same check, and so does reschedule(). I tried it locally and the visit tests pass. Suggestion attached.
ReassignDialog.tsx:72 What does the dispatcher see when nobody qualifies?
10
Respond to the review
/check-pr-review 318: fix, accept or leave each comment. Replies are posted only after the developer confirms.
developer
claude · /check-pr-review
❯/check-pr-review 318●Bash(gh pr view 318 --json number,title,headRefName,reviewDecision,reviews)
⎿ #318 feat(visits): reassign a visit to another technician ·CHANGES_REQUESTED● 2 open comments · 1 skipped (claude, already answered)←☐ C1 overlap☐ C2 empty state ✔ Submit →C1 · sam · visits.service.ts:131Pull the overlap query into VisitRepository.findOverlapping. FB-139 needs it too.❯ 1. Fix
2. Accept · agree, no change needed
3. Leave · disagree, draft a reply with the reason
4. Type something.C1 Fix C2 Fix
How should C1 be fixed?❯ 1. Reviewer's suggestion: VisitRepository.findOverlapping(tx, technicianId, range) (Recommended)
reschedule() moves onto it in the same commit. FB-139 can call it as is.
2. A shared query in visits/queries/overlap.ts
Same reuse, but outside the repository pattern the module follows.
3. Leave it to FB-139, add a linked TODO
Smallest diff. Keeps the duplicate until FB-139 lands.
4. Type something.●Edit ×3 ·Bash(pnpm test visits dispatch && pnpm lint) ⎿44 passed · lint clean● fix: address review on #318 e41b9c7● Draft replies
C1 Done in e41b9c7. reschedule() uses it too.
C2 Added an empty state that names the skill and slot, in e41b9c7.
❯post them●Bash(gh api … /replies) ×2 · asked, allowed⎿posted
.claude/skills/check-pr-review/SKILL.md
---
name: check-pr-review
description: Pull the open review comments on a PR, propose fixes for each, and let the developer decide comment by comment. Use when a reviewer, human or bot, has left comments.
argument-hint: <pr-number>
allowed-tools: Bash(gh pr view:*), Bash(gh api:*), Bash(pnpm:*), Read, Grep, Glob, Edit, AskUserQuestion
---
# Check PR review
## 1. Pull
```bash
gh pr view $ARGUMENTS --json number,title,headRefName,reviewDecision,reviews
gh api repos/{owner}/{repo}/pulls/$ARGUMENTS/comments --paginate \
--jq '.[] | select(.in_reply_to_id == null) | {id, user: .user.login, path, line, body}'
```
The current branch must be the PR's head branch. Stop if it is not.
Skip threads that are already resolved or already answered by the PR author.
## 2. Understand
For each comment, read the code at its `path:line` and work out what the reviewer is
asking for. A comment can be a defect, a request, a suggestion block or a question.
When it reports a defect, confirm the defect is real before proposing anything. If it is
not, say so.
## 3. Decide, per comment
Ask with `AskUserQuestion`, one question per comment and at most 4 per call. Show the
reviewer, the `path:line` and a one-line summary. Offer three options:
- **Fix**: change the code.
- **Accept**: agree, with no change needed, because it is already handled or belongs in a follow-up ticket.
- **Leave**: disagree. Draft a reply that gives the reason.
## 4. For every Fix
Ask a second question with the concrete fixes. Offer the reviewer's own suggestion first
if they gave one, then up to two alternatives, each with its trade-off. The developer can
type their own fix instead.
Apply the chosen fixes. Run the affected tests and `pnpm lint`, then commit once:
`fix: address review on #<pr>`.
## 5. Replies
Draft one reply per comment, either "fixed in `<sha>`" or why the code stays as it is.
Show all the drafts. Post them with `gh api …/replies` only after the developer says so.
Never resolve threads, approve, or request changes.
e41b9c7 · fix: address review on #318
--- a/apps/api/src/visits/visits.service.ts+++ b/apps/api/src/visits/visits.service.ts@@ -124,15 +124,8 @@ export class VisitsService {
await this.lockDay(tx, to, visit.startsAt)
- const clash = await tx.query(- `SELECT id FROM visits- WHERE technician_id = $1- AND status <> 'cancelled'- AND tstzrange(starts_at, ends_at) && tstzrange($2, $3)- LIMIT 1`,- [to, visit.startsAt, visit.endsAt],- )- if (clash.rowCount) throw new TechnicianBusyError(to, clash.rows[0].id)+ const clash = await this.visits.findOverlapping(tx, to, visit.range)+ if (clash) throw new TechnicianBusyError(to, clash.id)--- a/apps/api/src/visits/visit.repository.ts+++ b/apps/api/src/visits/visit.repository.ts@@ -58,0 +58,14 @@ export class VisitRepository {
+ // caller must hold the day lock+ async findOverlapping(tx: Tx, technicianId: string, range: TimeRange): Promise<VisitRow | undefined> {+ const { rows } = await tx.query<VisitRow>(+ `SELECT * FROM visits+ WHERE technician_id = $1+ AND status <> 'cancelled'+ AND tstzrange(starts_at, ends_at) && tstzrange($2, $3)+ LIMIT 1`,+ [technicianId, range.start, range.end],+ )+ return rows[0]+ }--- a/apps/web/src/features/dispatch/ReassignDialog.tsx+++ b/apps/web/src/features/dispatch/ReassignDialog.tsx@@ -70,6 +70,12 @@ export function ReassignDialog({ visit, onClose }: Props) {
+ if (candidates.length === 0) {+ return (+ <EmptyState title="No technician can take this visit"+ hint={`Nobody with ${visit.skill} is free ${formatSlot(visit.range)}.`} />+ )+ }
11
CI
lint, test, security, review and one approval. The master ruleset requires all five.
AC1 · Dispatcher reassigns a visit has not run yet.
➤
QA harness in CI · click a criterion to inspect it
Ship
BacklogRefinementReady for sprintIn progressIn reviewIn validationDone
FB-142Reassign
13
Release
A release is created by hand from a commit range on master. Production deploys after a second person approves.
release owner
github actions
approver
$gh workflow run release.yml -f from=4f2a9c1 -f to=8c1f2e4 -f version=v2.14.0$gh run watch✓ create range 4f2a9c1...8c1f2e4 is on master · 8 commits · v2.14.0 tagged at 8c1f2e4
◷ production waiting for review · environment production✓ production approved by jordan · rolled out 8c1f2e4 · 6m 40s
v2.14.0
4f2a9c1...8c1f2e4production
Features
feat(visits): reassign a visit to another technician (#318) 8c1f2e4
feat(dispatch): filter the board by region (#311) a71c02b
feat(invoices): show the VAT number in the PDF footer (#309) 1e9b3d7
Fixes
fix(availability): weekly view starts on Monday in every locale (#315) c4d8e21
fix(api): 404 instead of 500 for a visit in another tenant (#312) 6b0f9aa
fix(web): keep filters when returning from a visit (#310) 2f7a1c3