Gated Module Implementation
Overview
- (1) Plan + (2) Audit: Write the implementation plan, run three rounds of plan audit, fix gaps.
- (3) Human — Plan only: Only one human gate: approve the plan before any task runs. No human approval between code review rounds (those are automatic).
- (4) Execute in order by batch: Tasks (e.g. 1–10) run in order. Behavior depends on Execution mode (below).
- (5) Automatic 3-round review: After all tasks and tests pass, run exactly 3 rounds of code review automatically: round 1 → fix Critical/Important → round 2 → fix → round 3. No human confirmation between rounds.
Unit tests: full coverage. E2E: pass. Test report: generated. No skipped tests.
Execution mode
| Mode |
When to use |
Phase 4 behavior |
| Gated (default) |
User does not ask for auto-run. |
After each batch: report → wait for human confirmation ("continue" / "go") → next batch. |
| Auto-loop |
User says "auto-loop", "frad-dotclaude mode", "audit then implement and run everything automatically", or equivalent. |
After plan approval: run all batches in sequence with no human between batches. After each batch: report and update task state, then immediately proceed to next batch until all tasks done → then Phase 5. |
Announce at start: "I'm using the gated-module-implementation skill for this module." If Auto-loop: also say "Auto-loop mode: I will run all execution batches continuously after plan approval."
Phase 1: Plan (Required Before Any Code)
Clarify scope and dependencies
- Identify the module boundary, upstream/downstream services, and shared contracts (API, DB, events).
- Document in a short "Context & Dependencies" section (can live in the plan file or a linked doc).
Write the implementation plan
- REQUIRED SUB-SKILL: Use writing-plans.
- Save the plan to the correct project
plan/ path (see writing-plans for the table).
- Plan must include explicit tasks for: unit tests (full coverage), E2E tests (fully runnable), and test report generation. No "skip tests" or "TODO tests."
Deliverable
- One plan file at
<project>/plan/YYYY-MM-DD-<feature-name>.md with header, goal, architecture, and bite-sized tasks including test steps.
Phase 2: Three Rounds of Audit
Run three audit rounds on the plan (and any linked context). Do not proceed to execution until all three are done and issues are addressed.
Round 1 — Completeness & Scope
Output: Short checklist result; list any gaps. Fix the plan if gaps found.
Round 2 — Dependencies & Interfaces
Output: Short checklist result; list any conflicts or missing interface specs. Update plan if needed.
Round 3 — Test Strategy & Rollout
Output: Short checklist result; list any missing test or report steps. Update plan until satisfied.
After Round 3, present a one-paragraph Audit Summary (all three rounds) and say: "Plan ready for human review. Please confirm before execution."
Phase 3: Human Review — Plan Approval Only (Once)
Only one human review is required: approve the plan before any task execution. No human approval is needed before or between code review rounds (those are automatic). In Auto-loop mode, there is no human confirmation between Phase 4 batches — only this single plan approval.
Single checkpoint — Approve plan (before first task)
- Present: plan path, goal, audit summary, and any open risks.
- Do not start Phase 4 until the human explicitly confirms (e.g. "approved" / "go ahead" / "execute").
- If the human requests plan changes, update the plan and optionally re-run the relevant audit round(s), then ask for confirmation again.
Between execution batches (Gated mode only)
- Gated mode: After each batch (e.g. tasks 1–3 done): report what was done, show verification, wait for human confirmation before starting the next batch (e.g. 4–6). Tasks run in order; between batches you need "continue" / "go".
- Auto-loop mode: Do not wait for human between batches. After each batch: report and update task state, then proceed immediately to the next batch until all tasks are done.
Phase 4: Execute the Plan (Tasks in Order, Batch by Batch)
REQUIRED SUB-SKILL: Use executing-plans.
Execute all tasks in order (e.g. Task 1 → 2 → … → 10). Work in batches (e.g. first 3, then next 3, then rest). Behavior by mode:
- Gated: After each batch: report → wait for human confirmation → next batch. Continue until all tasks are done.
- Auto-loop: After plan approval: run batch 1 → report and update task state → immediately batch 2 → report → … → last batch. Do not stop for human between batches. Only after all tasks are done (and tests pass, report generated) proceed to Phase 5.
Task state discipline (mandatory — do not forget):
- Before starting a task: Mark it
in_progress (e.g. TodoWrite or plan checklist).
- Immediately after completing a task: Mark it
completed.
- Before each batch report: Verify every task in that batch is marked
completed; if any is still in_progress or unchecked, update it first.
- Rationale: Forgetting to update task state loses track of progress and makes batch reporting inaccurate; always update state when starting and finishing a task.
- Per-batch self-check before "Ready for feedback": All tasks in this batch are marked
completed; no task left in in_progress.
Testing requirements (non-negotiable):
- Unit tests: Achieve full coverage for new/changed code; do not skip or disable tests.
- E2E tests: All E2E tests must run and pass; document the exact run command and result.
- Test report: Generate and attach or link the test report (e.g. coverage HTML, E2E summary). If the project has a standard place (e.g.
coverage/, test-results/), put it there and mention the path.
If execution is blocked (e.g. test failure, missing dep), stop and ask; do not skip tests to "unblock."
Phase 5: Automatic 3-Round Code Review (No Human Between Rounds)
Multi-round review means run exactly 3 review rounds automatically: round 1 → fix Critical/Important → round 2 → fix → round 3. No human confirmation between rounds; all three rounds run automatically without inserting a human gate in the middle.
- After all plan tasks are complete and tests pass with report generated:
- Round 1: Dispatch the code-reviewer (plan + scope, correct BASE_SHA/HEAD_SHA). Fix all Critical and Important issues; re-run unit and E2E tests; regenerate test report if needed.
- Round 2: Dispatch the code-reviewer again (BASE_SHA = previous HEAD_SHA, HEAD_SHA = current HEAD). Fix all Critical and Important issues; re-run tests and update report if needed.
- Round 3: Dispatch the code-reviewer again (BASE_SHA = previous HEAD_SHA, HEAD_SHA = current HEAD). After round 3, consider the module done (fix any remaining Critical/Important from the report as needed).
- Do not stop to ask human between rounds — run all three rounds automatically.
Workflow Summary
| Phase |
Action |
Gate (Gated) |
Gate (Auto-loop) |
| 1 |
Clarify deps + write plan (writing-plans) |
Plan saved |
Plan saved |
| 2 |
Audit Round 1–3 (plan audit) |
Checklist pass |
Checklist pass |
| 3 |
Human: approve plan once |
Explicit approval to execute |
Explicit approval to execute |
| 4 |
Execute batch 1; update task state each start/complete |
Report; human confirms |
Report; no stop |
| 4 |
Execute batch 2, … remaining |
Report; human confirms each |
Continue to next batch |
| 4 |
All tasks done; unit + E2E pass; report generated |
— |
No human between batches |
| 5 |
Automatic code review: round 1 → fix → round 2 → fix → round 3 |
3 rounds, no human |
3 rounds, no human |
Red Lines
- Do not start Phase 4 without human approval of the plan (once).
- Gated mode only: Do not start the next execution batch without human confirmation after the previous batch. Auto-loop mode: After plan approval, you may run all batches continuously without human between batches.
- Do not skip or disable unit or E2E tests; no "skip" in test config for this module.
- Do not forget to mark tasks
in_progress when starting and completed when finishing; verify batch task states before each report.
- Do not stop to ask human between code review rounds — run all 3 rounds automatically.
- Do not consider the module complete without a generated test report and all 3 code review rounds completed.
References
1---2name: gated-module-implementation3description: Plan-first, one-time human plan approval; batched execution in either Gated (human confirms between batches) or Auto-loop (continuous run after plan approval); strict task-state updates; automatic 3-round code review. Use for "audit then implement" or "plan first, then execute". Say "auto-loop" or "frad-dotclaude" for Auto-loop mode.4---56# Gated Module Implementation78## Overview910- **(1) Plan + (2) Audit:** Write the implementation plan, run three rounds of plan audit, fix gaps.11- **(3) Human — Plan only:** **Only one** human gate: approve the plan before any task runs. No human approval between code review rounds (those are automatic).12- **(4) Execute in order by batch:** Tasks (e.g. 1–10) run **in order**. Behavior depends on **Execution mode** (below).13- **(5) Automatic 3-round review:** After all tasks and tests pass, run **exactly 3 rounds** of code review automatically: round 1 → fix Critical/Important → round 2 → fix → round 3. No human confirmation between rounds.1415Unit tests: full coverage. E2E: pass. Test report: generated. No skipped tests.1617### Execution mode1819| Mode | When to use | Phase 4 behavior |20|------|-------------|------------------|21| **Gated** (default) | User does not ask for auto-run. | After each batch: report → **wait for human confirmation** ("continue" / "go") → next batch. |22| **Auto-loop** | User says "auto-loop", "frad-dotclaude mode", "audit then implement and run everything automatically", or equivalent. | After plan approval: run **all batches in sequence** with no human between batches. After each batch: report and update task state, then **immediately** proceed to next batch until all tasks done → then Phase 5. |2324**Announce at start:** "I'm using the gated-module-implementation skill for this module." If Auto-loop: also say "Auto-loop mode: I will run all execution batches continuously after plan approval."2526---2728## Phase 1: Plan (Required Before Any Code)29301. **Clarify scope and dependencies**31 - Identify the module boundary, upstream/downstream services, and shared contracts (API, DB, events).32 - Document in a short "Context & Dependencies" section (can live in the plan file or a linked doc).33342. **Write the implementation plan**35 - **REQUIRED SUB-SKILL:** Use [writing-plans](../writing-plans/SKILL.md).36 - Save the plan to the **correct project** `plan/` path (see writing-plans for the table).37 - Plan must include explicit tasks for: unit tests (full coverage), E2E tests (fully runnable), and test report generation. No "skip tests" or "TODO tests."38393. **Deliverable**40 - One plan file at `<project>/plan/YYYY-MM-DD-<feature-name>.md` with header, goal, architecture, and bite-sized tasks including test steps.4142---4344## Phase 2: Three Rounds of Audit4546Run **three** audit rounds on the **plan** (and any linked context). Do not proceed to execution until all three are done and issues are addressed.4748### Round 1 — Completeness & Scope4950- [ ] Goal and acceptance criteria are clear and testable.51- [ ] All touched files (create/modify/test) are listed with exact paths.52- [ ] Dependencies on other modules/APIs/DB are documented; no hidden coupling.53- [ ] Edge cases and error paths are covered in tasks or tests.5455**Output:** Short checklist result; list any gaps. Fix the plan if gaps found.5657### Round 2 — Dependencies & Interfaces5859- [ ] API contracts (request/response, status codes) are specified where the module touches boundaries.60- [ ] DB schema changes (if any) are stated; migrations are in the task list.61- [ ] Integration points (policy-service, gateway, SaaS, data-warehouse) respect project boundaries (see `.cursor/rules/project.mdc`).6263**Output:** Short checklist result; list any conflicts or missing interface specs. Update plan if needed.6465### Round 3 — Test Strategy & Rollout6667- [ ] Unit test tasks exist for all new/edited behavior; plan states "full coverage" (or equivalent) and no skipped tests.68- [ ] E2E test tasks exist and are runnable (commands and expected pass condition stated).69- [ ] A task generates a test report (e.g. coverage report, E2E summary); artifact path or command documented.70- [ ] Rollback or feature-flag approach is considered if relevant.7172**Output:** Short checklist result; list any missing test or report steps. Update plan until satisfied.7374After Round 3, present a one-paragraph **Audit Summary** (all three rounds) and say: **"Plan ready for human review. Please confirm before execution."**7576---7778## Phase 3: Human Review — Plan Approval Only (Once)7980**Only one human review is required: approve the plan before any task execution.** No human approval is needed before or between code review rounds (those are automatic). In **Auto-loop** mode, there is **no** human confirmation between Phase 4 batches — only this single plan approval.8182### Single checkpoint — Approve plan (before first task)8384- Present: plan path, goal, audit summary, and any open risks.85- **Do not start Phase 4 until the human explicitly confirms** (e.g. "approved" / "go ahead" / "execute").86- If the human requests plan changes, update the plan and optionally re-run the relevant audit round(s), then ask for confirmation again.8788### Between execution batches (Gated mode only)8990- **Gated mode:** After each batch (e.g. tasks 1–3 done): report what was done, show verification, **wait for human confirmation** before starting the next batch (e.g. 4–6). Tasks run in order; between batches you need "continue" / "go".91- **Auto-loop mode:** Do **not** wait for human between batches. After each batch: report and update task state, then proceed immediately to the next batch until all tasks are done.9293---9495## Phase 4: Execute the Plan (Tasks in Order, Batch by Batch)96971. **REQUIRED SUB-SKILL:** Use [executing-plans](../executing-plans/SKILL.md).982. Execute **all tasks in order** (e.g. Task 1 → 2 → … → 10). Work in batches (e.g. first 3, then next 3, then rest). Behavior by mode:99 - **Gated:** After each batch: report → **wait for human confirmation** → next batch. Continue until all tasks are done.100 - **Auto-loop:** After plan approval: run batch 1 → report and update task state → **immediately** batch 2 → report → … → last batch. Do **not** stop for human between batches. Only after **all** tasks are done (and tests pass, report generated) proceed to Phase 5.1011023. **Task state discipline (mandatory — do not forget):**103 - **Before starting a task:** Mark it `in_progress` (e.g. TodoWrite or plan checklist).104 - **Immediately after completing a task:** Mark it `completed`.105 - **Before each batch report:** Verify every task in that batch is marked `completed`; if any is still `in_progress` or unchecked, update it first.106 - *Rationale:* Forgetting to update task state loses track of progress and makes batch reporting inaccurate; always update state when starting and finishing a task.107 - **Per-batch self-check before "Ready for feedback":** All tasks in this batch are marked `completed`; no task left in `in_progress`.1081094. **Testing requirements (non-negotiable):**110 - **Unit tests:** Achieve full coverage for new/changed code; do not skip or disable tests.111 - **E2E tests:** All E2E tests must run and pass; document the exact run command and result.112 - **Test report:** Generate and attach or link the test report (e.g. coverage HTML, E2E summary). If the project has a standard place (e.g. `coverage/`, `test-results/`), put it there and mention the path.1131145. If execution is blocked (e.g. test failure, missing dep), stop and ask; do not skip tests to "unblock."115116---117118## Phase 5: Automatic 3-Round Code Review (No Human Between Rounds)119120**Multi-round review** means run exactly **3** review rounds automatically: round 1 → fix Critical/Important → round 2 → fix → round 3. No human confirmation between rounds; all three rounds run automatically without inserting a human gate in the middle.1211221. After **all** plan tasks are complete and tests pass with report generated:123 - **REQUIRED SUB-SKILL:** Use [requesting-code-review](../requesting-code-review/SKILL.md).1242. **Round 1:** Dispatch the code-reviewer (plan + scope, correct BASE_SHA/HEAD_SHA). Fix all Critical and Important issues; re-run unit and E2E tests; regenerate test report if needed.1253. **Round 2:** Dispatch the code-reviewer again (BASE_SHA = previous HEAD_SHA, HEAD_SHA = current HEAD). Fix all Critical and Important issues; re-run tests and update report if needed.1264. **Round 3:** Dispatch the code-reviewer again (BASE_SHA = previous HEAD_SHA, HEAD_SHA = current HEAD). After round 3, consider the module done (fix any remaining Critical/Important from the report as needed).1275. Do not stop to ask human between rounds — run all three rounds automatically.128129---130131## Workflow Summary132133| Phase | Action | Gate (Gated) | Gate (Auto-loop) |134|-------|--------|--------------|-------------------|135| 1 | Clarify deps + write plan (writing-plans) | Plan saved | Plan saved |136| 2 | Audit Round 1–3 (plan audit) | Checklist pass | Checklist pass |137| 3 | **Human: approve plan once** | Explicit approval to execute | Explicit approval to execute |138| 4 | Execute batch 1; **update task state** each start/complete | Report; human confirms | Report; no stop |139| 4 | Execute batch 2, … remaining | Report; human confirms each | Continue to next batch |140| 4 | All tasks done; unit + E2E pass; report generated | — | No human between batches |141| 5 | **Automatic** code review: round 1 → fix → round 2 → fix → round 3 | 3 rounds, no human | 3 rounds, no human |142143---144145## Red Lines146147- **Do not** start Phase 4 without human approval of the plan (once).148- **Gated mode only:** Do **not** start the next execution batch without human confirmation after the previous batch. **Auto-loop mode:** After plan approval, you may run all batches continuously without human between batches.149- **Do not** skip or disable unit or E2E tests; no "skip" in test config for this module.150- **Do not** forget to mark tasks `in_progress` when starting and `completed` when finishing; verify batch task states before each report.151- **Do not** stop to ask human between code review rounds — run all 3 rounds automatically.152- **Do not** consider the module complete without a generated test report and **all 3** code review rounds completed.153154---155156## References157158- Plan path rules and task format: [writing-plans](../writing-plans/SKILL.md)159- Execution batching and checkpoints: [executing-plans](../executing-plans/SKILL.md)160- Code review dispatch and template: [requesting-code-review](../requesting-code-review/SKILL.md)161- Project boundaries (four engines): `.cursor/rules/project.mdc`