Disciplined end-to-end loop for agent-led implementation and testing: isolate work in a git worktree, read before editing, make the minimal correct change, validate empirically (typecheck, lint, format, targeted tests, build), reuse or start live servers and verify the UI in a real browser, run review skills and resolve Bugbot/Greptile/CI findings, then ship small well-documented PRs without pushing or touching prod/growth surfaces unasked. Use when taking a feature or fix from implementation through validation, review, and follow-up; when hardening, reviewing, consolidating, or splitting PRs; or whenever the user wants work driven and verified rather than just written.
How an agent should take work from implementation to validation to review to follow-up. The loop is: isolate -> understand -> implement -> clean -> validate -> verify live -> review -> triage CI -> ship -> follow up. Skip phases only for genuinely trivial one-liners.
This skill is process, not domain. For what tools to use per task, defer to wiki/meta/capability-routing-map.md and SKILL-RESOLVER.md. For how to write the code, defer to the relevant style/* guide.
At the end of a meaningful phase, select the next context shape deliberately. The commands differ by harness; the decision contract does not:
| Route | Select when | Required handoff state |
|---|---|---|
| Continue | The next step is bounded and the current context still has enough useful attention. | Keep working; do not create ceremony. |
Fresh session (clear where supported) | The next task is independent and current exploration is disposable. | First write any durable decision, artifact, or unresolved owner that must survive. |
| Handoff | The context matters and the recipient, harness, directory, project, or human changes. | Reference existing specs, commits, diffs, tests, and decisions; summarize only uncodified state. |
| Delegate | A bounded AFK branch can run independently while the parent retains synthesis and final proof. | Give scope, evidence inputs, output contract, stop condition, and authority; use only when delegation is authorized. |
| Compact | The same owner must continue and most current context remains relevant, but the session needs a smaller working set. | Preserve exact goals, decisions, frontier, changed artifacts, commands, proof, and blockers; omit dead exploration. |
Context preservation is not durable learning. Before discarding or compacting a session, write lasting decisions and procedures to their canonical owners. A handoff or summary may point to those owners but must not become a competing copy. [Source: X/@mattpocockuk 2079879414297330146 visual decision tree; X replies 2072339955020660754 and 2072340652797571568, reviewed 2026-08-12]
git worktree add -b <type>/<topic> ../wt/<topic> origin/dev.head -n 10 ~/.cursor/projects/*/terminals/*.txt) and check ports to avoid duplicating a server already running.SetActiveBranch after creating/committing on a new branch.explore subagents instead of serial greps; for needle lookups use Grep/Glob directly.Run a separate behavior-preserving cleanup pass before verification. Re-read the diff in context and remove duplication, dead branches, debug scaffolding, needless abstractions, verbose names, and comments that only restate the code. Prefer the repository's existing helper and local idiom over a new abstraction.
Cleanup does not mean "make the checks green." Do not mix it with feature changes, formatter churn, test repair, or broad refactoring. If simplifying the diff would change behavior or expand scope, leave it alone and record the follow-up. Verification starts only after the cleanup diff is stable.
Run the most targeted check first, then broaden:
typecheck (fast) -> lint (changed files) -> format --check
-> targeted unit/inline tests -> module tests -> build / full suiteReadLints and the project's typecheck/lint on the files you touched, not the whole repo.exactOptionalPropertyTypes, optional members are foo?: T (never | undefined); spread conditional keys (...(x ? { x } : {})).block_until_ms: 0 for long-runners) and do one smoke read of its output to confirm it came up.wiki/meta/capability-routing-map.md): browser-harness / agent-browser for agent-driven visual checks, Playwright for deterministic CI gates, Chrome DevTools MCP for computed styles. Screenshot the result and embed it for the user.cleanup-terminals-browsers). Never kill the IDE, agent runtime, or shared MCP servers.code-reviewer for bugs/silent failures, style-reviewer for STYLE.md, gstack-review for production-grade depth, gstack-design-review / web-design-guidelines for UI usability and accessibility.doctor-enforcement, react-doctor, project scripts/doctor.ts).When a check is red, find out why before claiming you can fix it:
--force-with-lease, never --force to protected branches. Do not use git checkout or git restore; for writes on another branch, create an isolated worktree instead of switching the shared checkout.- [ ] Worked in a worktree; reused/owned every server and browser; cleaned up
- [ ] Read the code + mapped blast radius before editing
- [ ] Minimal diff; matched surrounding style; added invariant tests
- [ ] typecheck + lint(changed) + format + targeted tests all green locally
- [ ] UI verified in a real browser (screenshot shared) when UI changed
- [ ] Review skills run; Bugbot/Greptile findings fixed or classified
- [ ] CI reds triaged: mine fixed, systemic ones reported (not absorbed)
- [ ] PR < 500 lines, one concern, conventional commit, body documents why
- [ ] No push without approval; no prod/growth/ad changes made unasked
- [ ] Open questions from the thread resolved or flagged with an owner