Skill

implement_and_review

Implement a ticket using TDD and review in a converging loop. Use when you have an approved spec and implementation plan. Spawns TddEngineer for implementation, delegates to deep-review for adversarial analysis, and auto-fixes findings in an autonomous loop (max 5 rounds) before gating user approval.

From full-orchestration
Install
1
Run in your terminal
$
npx claudepluginhub shouenlee/ghcp-dev-plugin --plugin full-orchestration
Tool Access

This skill uses the workspace's default tool permissions.

Skill Content

Implement & Review

State file: .claude/swe-state/{ticket-id}.json

Unified stage: TDD implementation followed by a review-fix loop that converges before user approval. Same author→reviewer→fix loop structure as 2B↔2C, but with severity-based convergence (0 Critical + 0 Major + 0 Minor) instead of comment-based (0 OPEN).

Usage

/implement_and_review <ticket-id>

Phase 1: Validate

  1. Read state. Confirm stages.spec.completed is true.
  2. Verify these files exist (paths from state): spec, impl plan, context doc.
  3. Extract feature_branch and target_branch from state. Confirm current branch matches feature branch — warn and offer to switch if not.
  4. Extract step count and language from the impl plan.
  5. If /deep_review is unavailable: stop and show /plugin install deep-review@ghcp-dev-plugin.
  6. Report: ticket ID, step count, language, branches, strategy (TDD then review-fix loop, max 5 rounds).

Phase 2: Initial Implementation

Spawn TDD engineer to execute the approved implementation plan:

subagent_type: full-orchestration:TddEngineer
max_turns: 30
prompt: |
  State file: .claude/swe-state/{ticket-id}.json
  Read state to locate:
  - stages.spec.spec_file (technical spec)
  - stages.spec.impl_plan_file (implementation plan)
  - stages.spec.context_file (codebase context)
  - stages.implement.impl_summary_file (write summary here when done)

  Execute the implementation plan using strict TDD (red/green/refactor).
  Work on the current branch. Do NOT create or switch branches.
  Commit after each passing step.
  Run the full test suite when all steps are complete.
  Write the implementation summary to the impl_summary_file path from state.

Read the impl summary. Extract test result (PASS/FAIL).

On PASS: update state — stages.implement.completed = true, populate test_results. Set stages.review.phase = "reviewing". Proceed to Phase 3.

On FAIL: do NOT mark completed. Report failure details to the user. User chooses:

  • Retry (with direction) → capture user direction, respawn TddEngineer with the same prompt plus user direction appended. Repeat until PASS or user aborts.
  • Continue to review → mark stages.implement.completed = true with a note in test_results that suite did not fully pass. Proceed to Phase 3 — the review loop will catch remaining issues.
  • Abort → set status = "aborted", exit.

Phase 3: Review-Fix Loop (max 5 iterations)

Autonomous loop — no user interaction until convergence, cap, or Critical finding. Every iteration is a full-branch review (target_branch...feature_branch). Track iteration starting at 0.

Step 1 — Review: Verify changes exist: git diff {target_branch}...{feature_branch}. If empty, report error to user and go to Phase 4. Run /deep_review --base={target_branch} --head={feature_branch}. On failure, retry once. If second failure, go to Phase 4 with a warning.

Step 2 — Parse findings: Extract the <!-- structured-findings ... structured-findings --> block from deep_review output (see format reference below). Map priorities: critical → Critical, high → Major, medium → Minor, low → Suggestion. Write to review_iteration_file path from state as JSON (see format reference below). Preserve status from prior iterations — if a finding with the same file+line+summary was previously "fixed" or "dismissed", carry that status forward. New findings default to "open". Update counts from open findings only.

Step 3 — Check convergence: If counts.critical == 0 AND counts.major == 0 AND counts.minor == 0, the loop has converged. Go to Phase 4. Suggestions are non-blocking and never prevent convergence.

Step 4 — Handle Criticals: If any Critical findings exist, stop the auto-loop. Present all findings with Criticals highlighted at top. User chooses per-Critical: fix (with direction), dismiss (with rationale), or abort. On abort → Phase 4 (abort path). On dismiss → record in state findings.dismissed with {id, severity, summary, rationale}. Major + Minor findings are queued for auto-fix. If no Critical findings, proceed directly to Step 5.

Step 5 — Fix: Build the findings list from review_iteration_file. Include only "open" findings with severity Critical, Major, or Minor, formatted as: - #{id} [{severity}] {file}:{line} — {summary}. Append any user direction for Critical fixes. Spawn TddEngineer:

subagent_type: full-orchestration:TddEngineer
max_turns: 20
prompt: |
  State file: .claude/swe-state/{ticket-id}.json
  Read state to locate:
  - stages.spec.spec_file
  - stages.spec.impl_plan_file
  - stages.spec.context_file
  - stages.implement.impl_summary_file
  - stages.review.review_iteration_file
  Findings to fix:
  {formatted findings list from above}
  For each: write/update test, apply fix, run tests.
  Commit: "review: fix {severity} — {description}"
  Run full suite when done.
  Write updated summary to impl_summary_file.

On TddEngineer failure: Minor findings → demote to Suggestion (non-blocking). Major findings → present to user: retry (with direction), dismiss (with rationale), or abort. Do not silently swallow failures.

Step 6 — Update state: Mark fixed findings in review_iteration_file. Update state: stages.review.iterations = iteration, update findings counts (total, fixed, auto_fixed, dismissed). Increment iteration. If iteration < 5, go back to Step 1. Otherwise set stages.review.phase = "capped" and warn: "Review did not fully converge after 5 rounds. {N} findings remain." Go to Phase 4.


Structured-Findings Format Reference

The deep_review output contains a YAML block in an HTML comment:

<!-- structured-findings
findings:
  - id: 1
    priority: critical | high | medium | low
    file: "path"
    line: N or null
    summary: "description"
    agents: [advocate, skeptic, architect]
structured-findings -->

The review_iteration_file is written as JSON:

{
  "iteration": 1,
  "findings": [
    {
      "id": 1,
      "severity": "Critical|Major|Minor|Suggestion",
      "file": "path",
      "line": 1,
      "summary": "description",
      "agents": ["advocate", "skeptic"],
      "status": "open|fixed|dismissed"
    }
  ],
  "counts": {
    "critical": 0, "major": 0, "minor": 0, "suggestion": 0
  }
}

Phase 4: User Approval Gate

Present review summary:

  • Total iterations completed
  • Phase reached (converged / capped)
  • Findings: resolved count, auto-fixed count, remaining count, dismissed (with rationale)
  • Follow-up items (suggestions)
  • Test status (from TddEngineer's last run)

Warn if Critical or Major findings remain unresolved.

Write summary to review_summary_file path from state.

User chooses:

  • Approve → proceed to Phase 5
  • Iterate → capture user direction, spawn TddEngineer with full context (see below), then re-enter Phase 3 loop. Before re-entering the loop, set iteration = min(iteration, 4) so there is always at least 1 review pass after a user-requested revision.
  • Abort → proceed to Phase 5 (abort path)

Iterate: Full-Context TDD Engineer

Capture user direction verbatim.

subagent_type: full-orchestration:TddEngineer
max_turns: 20
prompt: |
  State file: .claude/swe-state/{ticket-id}.json
  Iterating on implementation based on code review feedback.

  Read state to locate all inputs:
  - stages.spec.spec_file (original spec)
  - stages.spec.impl_plan_file (original plan)
  - stages.spec.context_file (codebase context)
  - stages.implement.impl_summary_file (previous impl summary)
  - stages.review.review_iteration_file (latest review feedback)

  User direction:
    {verbatim user instruction}

  Read the review feedback and impl summary to understand what
  needs to change. Use TDD. Keep all existing tests passing.
  Commit: "review: fix {severity} — {description}"
  Run full suite when done.
  Write updated summary to the impl_summary_file path from state.

After TddEngineer completes, return to Phase 3.


Phase 5: Update State

Deep-merge into state:

  • Approvestages.review.completed = true, stages.review.approved = true, stages.review.phase = "complete", populate findings counts (including auto_fixed and dismissed)
  • Abortstages.implement.completed = true (implementation did complete), stages.review.approved = false, status = "aborted"
Similar Skills
cache-components

Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.

138.5k
Stats
Parent Repo Stars0
Parent Repo Forks0
Last CommitMar 9, 2026