بنقرة واحدة
flow-patch
Small bounded changes with micro-spec, inline TDD, and per-task review. Invoke with /flow-patch.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Small bounded changes with micro-spec, inline TDD, and per-task review. Invoke with /flow-patch.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Shared prompts and references for flow-* skills. Not invoked directly.
Execute an approved plan with subagents, TDD, and two-stage review. Invoke with /flow-execute to resume or when plan exists without an active spec session.
Router for the flow development workflow. Invoke with /flow to triage and suggest the right /flow-* command.
Create an approved spec and self-reviewed implementation plan. Invoke with /flow-spec before multi-step work.
Explore ideas and design before committing to a spec. Invoke with /flow-brainstorm when requirements are still fuzzy.
Final verification gate before claiming work complete. Invoke with /flow-verify.
| name | flow-patch |
| description | Small bounded changes with micro-spec, inline TDD, and per-task review. Invoke with /flow-patch. |
| disable-model-invocation | true |
| metadata | {"flow":{"command":"/flow-patch"}} |
Triggered by: /flow-patch
For single bounded changes — too small for a full spec doc. Implement inline in this session so the user sees work in real time. Review after each task via subagents.
Use /flow-patch | Redirect to /flow-spec |
|---|---|
| ≤3 files, one concern | >3 files or multiple concerns |
| Clear success criteria | Needs design exploration |
| Bug fix with known cause | Architectural change |
Read and follow flow-shared/references/session-gate.md then flow-shared/references/branch-gate.md (resolve via path resolver in flow/SKILL.md). Session gate before any STATE write; branch and workspace confirmation before implementation.
Patch on main/master: use branch-gate On main menu (branch here vs worktree) — never commit patch work on main without explicit approval.
Patch on a feature branch: default continue on current branch when phase: done or no STATE; use branch-gate Continuing on current feature branch (patch) — not the execute-style switch/worktree 1/2 menu. User may opt into worktree or new branch explicitly.
Branch and workspace confirmation is a blocking user gate — same weight as micro-spec approval. Micro-spec approval does not satisfy branch or workspace confirmation.
If docs/flow/STATE.md or the user points to a brainstorm brief at docs/flow/brainstorms/..., read it first and carry forward agreed decisions into the micro-spec.
Brainstorm handoff: If you continued from brainstorm §7 (user picked patch, or spec→patch override), you are already in patch workflow — do not tell the user to invoke /flow-patch. If the brief's scope exceeds patch criteria, read flow-spec/SKILL.md via path resolver and follow spec — do not tell the user to invoke /flow-spec.
Write inline before any code. Break work into one or more tasks with bite-sized steps:
## Micro-spec
**Problem:** [what's wrong or needed]
**Success criteria:** [how we know it's done]
**Files:** [expected touch list]
**Out of scope:** [what we will NOT do]
**Testing:** [RED-GREEN for behavior changes | no new tests + manual checks for presentation-only — see `tdd-red-green.md`]
### Task 1: [name]
- [ ] Step 1: Write failing test …
- [ ] Step 2: Verify RED …
- [ ] Step 3: Implement …
- [ ] Step 4: Verify GREEN …
- [ ] Step 5: Commit
Single-task patches are fine. Multi-step work gets one review cycle per task, not per checkbox.
Micro-spec failures (never write these): TBD/TODO, "add tests", "handle edge cases", steps without code or commands, vague success criteria.
Micro-spec self-review — fix inline until all blocking checks pass. Do not proceed to §2 while blocked.
Calibration: Contradictions and unmapped success criteria are blocking. Wording polish is advisory.
Run micro-spec self-review internally (§1). Do not proceed to §2 while blocked. Then present the micro-spec and send only this gate — do not combine with workspace setup or Task 1:
Micro-spec ready.
1. Approve micro-spec — proceed to workspace setup
2. Request changes — tell me what to revise
3. Stop — no implementation
Do not expose internal self-review checklist names (criteria mapping counts, structure trees, Status/Blocked) in the gate message — the user reviews the micro-spec content, not the agent's audit worksheet. Do not ask the user to find contradictions you should have caught in self-review.
Stop until the user picks 1, approves the micro-spec explicitly, or requests changes (2). Option 3 ends the patch. If they request changes, update micro-spec and re-run self-review.
"Yes" / "approve" / "proceed" / "1" after this gate counts as micro-spec approval only — not branch or workspace confirmation. If the user bundles other permissions in the same message (e.g. "yes, reset STATE.md"), handle each permission separately; micro-spec approval still does not skip §3.
After micro-spec approval (§3): send the patch workspace gate from branch-gate.md (Workspace ready + options 1–3) in a separate message — do not reuse the micro-spec gate template or freeform confirm phrases.
Follow flow-shared/references/session-gate.md then flow-shared/references/branch-gate.md (resolve via path resolver in flow/SKILL.md).
Order:
phase, not done), stop before any STATE write; send session gate only.main/master: send branch-gate On main menu (1 branch here / 2 worktree). Stop until user picks 1 or 2.phase: done or no STATE: send branch-gate Continuing on current feature branch (patch) numbered menu only — do not send unrelated switch/worktree 1/2 menu or freeform "reply continue/yes/work here". Stop until user picks 1, 2, or 3 (or names a branch with 3).worktree-setup.md, or resume; do not invent a new branch without user approval.Do not in the same turn: create/switch branches, create worktrees, update STATE, or start implementation (Task 1, code edits, TDD steps).
Forbidden rationalizations: "User said yes", "micro-spec approved", "unrelated topic needs new branch", "work here" means switch branch here", "feature branch off main is obvious", "STATE reset permission covers workspace" — none of these satisfy this gate.
After confirmation:
git switch -c; record workspace: in-place, branch: = current branch in docs/flow/STATE.mdmain menu pick 1, or patch workspace pick 3, or user named a new branch: create or switch in current workspace; workspace: in-placemain menu pick 2, patch workspace pick 2, or session gate option 2: follow flow-shared/references/worktree-setup.mdUpdate phase: patch in docs/flow/STATE.md, then proceed to step 4.
After branch/workspace confirmation — before Task 1 or TDD:
docs/flow/patches/YYYY-MM-DD-<topic>.md
Use the same markdown structure as the inline micro-spec (Problem, Success criteria, Files, Out of scope, Testing, tasks).
Record patch: path in docs/flow/STATE.md.
Read and follow flow-shared/references/artifact-commit-gate.md (resolve via path resolver in flow/SKILL.md) — commit brainstorm (if any) and patch file on the confirmed feature branch. Include brainstorm: from STATE when present.
If resuming with artifacts already committed on the branch, skip to step 5.
Implement in this session — do not dispatch an implementer subagent. User should see edits and test runs live.
Read flow-shared/references/tdd-red-green.md (resolve via path resolver in flow/SKILL.md).
NO TASK N+1 UNTIL TASK N SPEC ✅ AND CORRECTNESS ✅ APPROVED
Applies to every task including Task 2 onward on multi-task micro-specs (e.g. code-review follow-ups). Task 1 completing both reviews does not waive reviews on later tasks.
End-of-lane verify runs after all tasks pass this gate. Verify does not replace per-task spec or correctness review.
Continuous patch execution means continue this gate sequence without handoffs — not skip reviews, not batch commits then "catch up" reviews once.
One task at a time. One reviewer role at a time.
Task N gate (all steps required, in order):
[ ] 1. Inline TDD — micro-spec steps 1–4 (RED → verify RED → implement → verify GREEN)
[ ] 2. Self-review
[ ] 3. Spec compliance reviewer → ✅
[ ] 4. Correctness reviewer → ✅ Approved
[ ] 5. Commit (micro-spec step 5)
[ ] 6. Mark Task N complete in TodoWrite and `- [x]` for Task N in the patch file
Only then start Task N+1 step 1.
Stop until — before every Task N (including N ≥ 2): Re-read this gate checklist. Confirm which step you are on. If you cannot point to spec ✅ and correctness ✅ Approved for Task N−1, do not start Task N TDD or mark Task N in_progress.
| Rationalization | Response |
|---|---|
| "Same pattern as Task 1 — skip reviews on 2–5" | Every task gets full dual review; pattern reuse is not an exception |
| "Code-review follow-up / review-fix patch — verify covers it" | Verify is additional; per-task diff reviews are mandatory |
| "Tests pass / TodoWrite complete — good enough" | Tests and TodoWrite do not waive spec or correctness |
| "Spec ✅ — start next task; correctness can wait" | Forbidden — one role at a time; both reviews before Task N+1 |
| "User said keep going / finish the patch" | Continue gates, not skip them |
| "Task 5 is test-only — skip backfill on 2–4" | No task-size exception; backfill missing reviews before new work |
| "Combined branch review instead of per-task" | Branch review is verify menu option 2 — not a patch shortcut |
| "Review-fix from verify option 2 — parent review covers this patch" | Parent branch review does not carry forward; each task gets spec + correctness |
| "Implement all tasks, one commit at the end" | Forbidden — one commit per task after that task's reviews |
| "Diff-review subagent at end = per-task reviews" | End-of-patch subagent is not spec or correctness reviewer per task |
For each task:
Mark task in_progress in TodoWrite
Follow each micro-spec step exactly; run verifications as specified (Step 2 must show RED failure before Step 3)
Self-review before dispatching reviewers:
Record BASE_SHA (commit before task) and HEAD_SHA (current). SHAs are diff anchors only — for git diff BASE..HEAD; never git checkout a SHA (detached HEAD). Dispatch spec compliance reviewer — read flow-shared/prompts/spec-reviewer.md (resolve via path resolver in flow/SKILL.md); paste full task text + micro-spec context + both SHAs. Loop: fix inline → refresh HEAD_SHA → re-review until ✅
Forbidden: Approving from your own implementer report without an independent diff review. Passing tests do not replace spec review.
Do not start step 5 or the next task until spec review is ✅.
Refresh HEAD_SHA if fixes landed after spec review. Reuse BASE_SHA. Dispatch correctness reviewer (task mode) — read flow-shared/prompts/correctness-reviewer.md (resolve via path resolver in flow/SKILL.md). Reviewer returns Block / Fix / Suggest. Loop until ✅ Approved:
HEAD_SHA → return to spec compliance review on the updated diff → then rerun correctnessAny code change after spec compliance approval invalidates that approval. Do not rerun correctness alone after a Block/Fix cleanup, even when the cleanup was requested by the correctness reviewer and tests pass.
Do not commit, mark complete, or start the next task until reviewer returns ✅ Approved.
Commit per micro-spec task Step 5 — on the user-confirmed feature branch only. One commit per task (or as the micro-spec specifies). Refresh HEAD_SHA after commit.
Mark task completed in TodoWrite and - [x] for Task N in docs/flow/patches/… (only after step 6)
Forbidden: Starting Task N+1 TDD while Task N is still in spec or correctness review — even if tests pass or the user says keep going.
Forbidden: Marking a task complete in TodoWrite or - [x] in the patch file before spec ✅, correctness ✅ Approved, and commit — checklist must not get ahead of the gate.
Forbidden: Marking a task complete or starting the next task with uncommitted changes from that task — commit per micro-spec Step 5 first.
Forbidden: Batching inline work for tasks 2–5 then backfilling reviews once, or only reviewing Task 1.
Fixes after ❌: orchestrator implements fixes inline, then re-dispatches the reviewer — reviewers do not edit code.
Stop when blocked, ambiguous, or verify steps complete and user menu presented. Do not guess.
When all micro-spec tasks are complete, immediately continue into verify — do not hand off or wait for the user to invoke /flow-verify.
Pre-verify checkpoint (required): Count tasks N in the micro-spec. Confirm N task commits on the feature branch since the artifact commit (or as the micro-spec specifies). If work is bundled into fewer commits, or any task lacks spec ✅ and correctness ✅ evidence → backfill reviews and split commits per task before step 1 below.
flow-verify/SKILL.md and flow-shared/references/verify-gate.md (resolve via path resolver in flow/SKILL.md)docs/flow/STATE.md: phase: verify when starting (per verify-gate)/flow-debug if root cause is unclear, or reopen/create a reviewed patch task for same-topic fixes. The fix must run spec compliance and correctness review, then commit, before verify is rerun. Do not present the done menu while verify is failingverify-gate.mdBefore presenting the menu: on the feature branch, run git status. If there are uncommitted changes from any task → do not claim patch or verify complete. Commit per micro-spec task Step 5, then re-run verify steps 2–5.
Do not run verify option 2 (branch review) automatically — only when the user chooses it from the menu.
Forbidden: Stopping with a "Run /flow-verify" handoff when patch tasks succeeded.
Forbidden: Presenting ad hoc "next steps" or a custom merge/PR menu — use the exact verify user menu from verify-gate.md (numbered options 1–4). Manual QA notes may appear above the menu, not instead of it.
/flow-spec/flow-spec/flow-debug firstphase: done or no STATE — use patch continuing gate; stay on current branch unless user opts into isolation- [x] before reviews + commit — only mark complete after spec ✅, correctness ✅, and commitgit checkout <commit-sha> — detaches HEAD; commits miss the feature branch. Stay on the branch name; use SHAs only in git diff