java/src/main/resources/targets/claude/skills/core/review/x-review-pr/SKILL.md
Tech Lead holistic review with {review_max_score}-point checklist covering Clean Code, SOLID, architecture, framework conventions, tests, TDD process, security, and cross-file consistency. Produces GO/NO-GO decision. Use for final review before merge.
npx skillsauth add edercnj/ia-dev-environment x-review-prInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Execute a senior-level holistic review with a {review_max_score}-point rubric. This is the standalone version of Phase 6 from x-story-implement. The Tech Lead reviews the consolidated PR diff for cross-file consistency and overall quality.
/x-review-pr — review current branch against main/x-review-pr NNN — review PR #NNN/x-review-pr STORY-ID — review by story ID/x-review) have already been runFive phases (Rule 25 REGRA-001, EPIC-0055). Each opens with TaskCreate + --mode pre gate, closes with TaskUpdate(completed) + POST/FINAL gate. P3 iterates sub-tasks per cycle. Mapping: P0 Context (Steps 0-3) · P1 Review (Step 4) · P2 Verdict (Steps 5,7) · P3 Remediation (Steps 6,8, iterative) · P4 Final approval.
Open (close with TaskUpdate(id: phase0TaskId, status: "completed") after Step 3):
TaskCreate(subject: "{STORY_ID} › Review-PR › Phase 0 - Context", activeForm: "Loading PR context")
Before executing the Tech Lead review, check if a report already exists and is still valid.
story-XXXX-YYYY)plans/epic-XXXX/reviews/ls plans/epic-XXXX/reviews/review-tech-lead-story-XXXX-YYYY.md 2>/dev/null
# Compare report mtime with latest commit date
stat -c %Y plans/epic-XXXX/reviews/review-tech-lead-story-XXXX-YYYY.md 2>/dev/null
git log -1 --format=%ct HEAD
mtime(report) >= commit_date: log Reusing existing tech lead review from {date} and skip to Step 5 (dashboard update)Idempotency Summary:
| Aspect | Behavior |
|--------|----------|
| Check | Compare mtime(report) vs mtime(latest commit) |
| Skip | Reuse existing report when mtime(report) >= commit_date |
| Override | Proceed with full review when code changed after report |
Determine what to review and set [BASE_BRANCH]:
gh pr view NNN --json title,body,baseRefName,headRefName,filesBASE_BRANCH=mainValidate diff exists:
git diff [BASE_BRANCH] --stat
git diff [BASE_BRANCH] --name-only
Read knowledge packs to calibrate the review:
knowledge/coding-standards/coding-conventions.md — {{LANGUAGE}} naming, injection, mapper conventionsknowledge/architecture/architecture-principles.md — layer boundaries, dependency directionrules/05-quality-gates.md — coverage thresholds, merge checklistknowledge/testing/testing-philosophy.md — TDD workflow, Double-Loop TDD, TPP orderingCheck for existing artifacts (extract epic ID XXXX and story sequence YYYY from story ID):
plans/epic-XXXX/reviews/review-*-story-XXXX-YYYY.md)plans/epic-XXXX/plans/plan-story-XXXX-YYYY.md)plans/epic-XXXX/plans/tests-story-XXXX-YYYY.md)Before executing the review, check if the Tech Lead review template exists:
test -f .claude/templates/_TEMPLATE-TECH-LEAD-REVIEW.md && echo "TL_TEMPLATE_AVAILABLE" || echo "TL_TEMPLATE_MISSING"
TL_TEMPLATE_AVAILABLE: Read template at .claude/templates/_TEMPLATE-TECH-LEAD-REVIEW.md for required output format. Follow ALL sections defined in the template. The report MUST include a standardized header with Story ID, Date, Author (Tech Lead), and Template Version (RULE-011 — Standardized artifact headers). Score MUST be in format XX/{review_max_score} with status GO/NO-GO (RULE-005 — Quality gates).TL_TEMPLATE_MISSING: log warning Template not found, using inline format and use the inline format as fallback (RULE-012 — Graceful template fallback). Dashboard and remediation updates are skipped when template is absent.Fallback (RULE-012 — Graceful template fallback): When template is not available (pre-EPIC-0024 projects), the current inline format is used as fallback. Skip dashboard and remediation updates since they depend on template-based artifacts.
Open a phase tracker; PRE gate ensures Phase 0 completed:
Skill(skill: "x-internal-phase-gate", model: "haiku", args: "--mode pre --skill x-review-pr --phase Phase-1-Review")
TaskCreate(subject: "{STORY_ID} › Review-PR › Phase 1 - Review", activeForm: "Running 45-point tech-lead review")
Close with TaskUpdate(id: phase1TaskId, status: "completed") + POST gate after Step 4 finishes (the rubric execution is the evidence):
Skill(skill: "x-internal-phase-gate", model: "haiku", args: "--mode post --skill x-review-pr --phase Phase-1-Review --expected-artifacts plans/epic-XXXX/reviews/review-tech-lead-story-XXXX-YYYY.md")
The Tech Lead review covers:
git diff [BASE_BRANCH] --name-onlygit diff [BASE_BRANCH]{{COMPILE_COMMAND}} + {{BUILD_COMMAND}}{{TEST_COMMAND}}
{{COVERAGE_COMMAND}}
testing.smoke_tests == true):
{{SMOKE_COMMAND}}
testing.smoke_tests == false: log "Smoke tests skipped (testing.smoke_tests=false)" and proceed| Section | Points | What it checks | | ------------------------ | ------ | ------------------------------------------------------------------- | | A. Code Hygiene | 8 | Unused imports/vars, dead code, warnings, method signatures, magic | | B. Naming | 4 | Intention-revealing, no disinformation, meaningful distinctions | | C. Functions | 5 | Single responsibility, size <= 25 lines, max 4 params, no flags | | D. Vertical Formatting | 4 | Blank lines between concepts, Newspaper Rule, class size <= 250 | | E. Design | 3 | Law of Demeter, CQS, DRY | | F. Error Handling | 3 | Rich exceptions, no null returns, no generic catch | | G. Architecture | 5 | SRP, DIP, architecture layer boundaries (per project rules), follows plan | | H. Framework & Infra | 4 | DI, externalized config, native-compatible, observability | | I. Tests & Execution | 6 | ALL tests pass, coverage >= 95%/90%, smoke tests pass, test quality | | J. Security & Production | 1 | Sensitive data protected, thread-safe | | K. TDD Process | 5 | Test-first commits, Double-Loop TDD, TPP progression, atomic cycles | {review_conditional_rubric}
| Condition | Decision | | -------------------------------------- | --------------- | | >= {review_go_threshold}/{review_max_score} + zero issues | GO | | < {review_go_threshold}/{review_max_score} OR any issue | NO-GO | | ANY test failure (unit, integration, or smoke) | NO-GO (automatic, overrides score) | | Coverage below 95% line OR 90% branch | NO-GO (automatic, overrides score — absolute gate per Rule 05 RULE-005-01; pre-existing deficits are NOT an excuse) |
Open a phase tracker (PRE gate: Phase 1 must have completed):
Skill(skill: "x-internal-phase-gate", model: "haiku", args: "--mode pre --skill x-review-pr --phase Phase-2-Verdict")
TaskCreate(subject: "{STORY_ID} › Review-PR › Phase 2 - Verdict", activeForm: "Compiling GO/NO-GO verdict")
Close with TaskUpdate(id: phase2TaskId, status: "completed") + POST gate after Step 7:
Skill(skill: "x-internal-phase-gate", model: "haiku", args: "--mode post --skill x-review-pr --phase Phase-2-Verdict --expected-artifacts plans/epic-XXXX/reviews/dashboard-story-XXXX-YYYY.md")
After saving the Tech Lead report, update the consolidated dashboard (RULE-006).
The dashboard is cumulative (RULE-006): created by /x-review (specialist scores), updated by /x-review-pr (Tech Lead Score).
Check if dashboard exists:
test -f plans/epic-XXXX/reviews/dashboard-story-XXXX-YYYY.md && echo "DASHBOARD_EXISTS" || echo "DASHBOARD_MISSING"
If dashboard exists (created by x-review):
plans/epic-XXXX/reviews/dashboard-story-XXXX-YYYY.md--/{review_max_score} | Status: Pending with actual score XX/{review_max_score} | Status: GO/NO-GOIf dashboard does not exist (x-review was not executed):
Dashboard not found, creating fresh dashboardtest -f .claude/templates/_TEMPLATE-CONSOLIDATED-REVIEW-DASHBOARD.md && echo "DASHBOARD_TEMPLATE_AVAILABLE" || echo "DASHBOARD_TEMPLATE_MISSING"
plans/epic-XXXX/reviews/dashboard-story-XXXX-YYYY.md with only the Tech Lead Score populated (specialist scores marked as -- / Pending)Runs only on NO-GO (or --no-auto-remediation bypass at Step 8.4). Each cycle chained via addBlockedBy, cap 3 per Rule 20:
TaskCreate(subject: "{STORY_ID} › Review-PR › Phase 3 - Remediation cycle 1", activeForm: "Running remediation cycle 1")
TaskUpdate(id: cycle1Id, status: "completed")
TaskCreate(subject: "{STORY_ID} › Review-PR › Phase 3 - Remediation cycle 2", activeForm: "Running remediation cycle 2") /* addBlockedBy: [cycle1Id] */
TaskUpdate(id: cycle2Id, status: "completed")
On convergence (GO) or exhaustion (REVIEW_REMEDIATION_EXHAUSTED / REVIEW_FIX_LOOP_EXCEEDED), proceed to Phase 4.
After updating the dashboard, update the remediation tracking file.
Check if remediation exists:
test -f plans/epic-XXXX/reviews/remediation-story-XXXX-YYYY.md && echo "REMEDIATION_EXISTS" || echo "REMEDIATION_MISSING"
If remediation exists (created by x-review):
plans/epic-XXXX/reviews/remediation-story-XXXX-YYYY.mdOpen -> FixedOpenOpenIf remediation does not exist (x-review was not executed):
Remediation not found, creating fresh remediation with Tech Lead findingstest -f .claude/templates/_TEMPLATE-REVIEW-REMEDIATION.md && echo "REMEDIATION_TEMPLATE_AVAILABLE" || echo "REMEDIATION_TEMPLATE_MISSING"
plans/epic-XXXX/reviews/remediation-story-XXXX-YYYY.md with only findings from the Tech Lead review (all as Open)Open a phase tracker (PRE gate: Phase 2 verdict must be resolved; Phase 3 may have run):
Skill(skill: "x-internal-phase-gate", model: "haiku", args: "--mode pre --skill x-review-pr --phase Phase-4-Approval")
TaskCreate(subject: "{STORY_ID} › Review-PR › Phase 4 - Approval", activeForm: "Finalizing approval and report")
Close with TaskUpdate(id: phase4TaskId, status: "completed") + FINAL gate (composes with Rule 24 mandatory-artifact scan):
Skill(skill: "x-internal-phase-gate", model: "haiku", args: "--mode final --skill x-review-pr --phase Phase-4-Approval --expected-artifacts plans/epic-XXXX/reviews/review-tech-lead-story-XXXX-YYYY.md,plans/epic-XXXX/reviews/dashboard-story-XXXX-YYYY.md,plans/epic-XXXX/reviews/remediation-story-XXXX-YYYY.md")
============================================================
TECH LEAD REVIEW — [STORY_ID]
============================================================
Decision: GO | NO-GO
Score: XX/{review_max_score} (GO >= {review_go_threshold})
Critical: N issues
Medium: N issues
Low: N issues
Test Execution Results (EPIC-0042):
Test Suite: PASS (XXX tests, X failures)
Coverage: XX% line, XX% branch
Smoke Tests: PASS/FAIL/SKIP (N tests)
------------------------------------------------------------
Report: plans/epic-XXXX/reviews/review-tech-lead-story-XXXX-YYYY.md
Dashboard: plans/epic-XXXX/reviews/dashboard-story-XXXX-YYYY.md (updated)
Remediation: plans/epic-XXXX/reviews/remediation-story-XXXX-YYYY.md (updated)
============================================================
Replace "Test Suite", "Coverage", and "Smoke Tests" placeholders with actual values from Step 4 execution (Steps 4.6, 4.7, 4.8). If smoke tests were skipped (testing.smoke_tests=false), show SKIP (0 tests).
When the review results in NO-GO, automatically dispatch remediation instead of waiting for manual input:
Classify NO-GO findings:
TEST_FAILURE: unit/integration/smoke test failures detected in Step 4.6-4.8COVERAGE_GAP: coverage below 95% line or 90% branch detected in Step 4.7CODE_QUALITY: rubric score below threshold (non-test issues)Auto-remediate by classification:
For TEST_FAILURE: Dispatch a general-purpose agent to fix failing tests:
Agent(
subagent_type: "general-purpose",
description: "Fix failing tests for NO-GO remediation",
prompt: "Read the failing test output from the review report at plans/epic-XXXX/reviews/review-tech-lead-story-XXXX-YYYY.md. Identify the root cause of each failing test. Fix the IMPLEMENTATION (NOT the test) to make tests pass. Run {{TEST_COMMAND}} to verify the fix. Commit via Skill(skill: 'x-git-commit', args: '--type fix --subject \"fix failing tests from tech lead review\"')."
)
For COVERAGE_GAP: Dispatch a general-purpose agent to add missing test coverage:
Agent(
subagent_type: "general-purpose",
description: "Add test coverage for NO-GO remediation",
prompt: "Read the coverage report. Identify uncovered lines/branches. Write tests for the uncovered code paths following TDD discipline (test first). Run {{TEST_COMMAND}} + {{COVERAGE_COMMAND}} to verify coverage meets 95% line / 90% branch. Commit via Skill(skill: 'x-git-commit', args: '--type test --subject \"add test coverage for uncovered branches\"')."
)
For CODE_QUALITY: Apply fixes inline following the remediation tracking file guidance.
Re-run review automatically (max 2 cycles total):
Opt-out: Pass --no-auto-remediation flag to force manual mode (skips auto-remediation agents; proceeds directly to Step 8.4 on NO-GO).
Reached when auto-remediation cycles are exhausted (2 retries without convergence) or when --no-auto-remediation is set and the review returns NO-GO.
Non-interactive path (--non-interactive present):
Skip AskUserQuestion. Print legacy HALT text and return NO-GO:
REVIEW NO-GO: Auto-remediation exhausted without convergence. Remaining issues recorded in report.
Run with --resume-review <pr> to re-enter the gate interactively.
Exit with NO-GO. No state file written.
Interactive path (default — --non-interactive absent):
Initialize gateAttempts = 0.
Gate loop:
WHILE gateAttempts < 3:
Present AskUserQuestion:
question: "Auto-remediation exhausted after 2 retry cycles. The Tech Lead review returned NO-GO. How would you like to proceed?"
options:
- { header: "Proceed", label: "Continue (Recommended)", description: "Re-dispatch auto-remediation (+2 loops). If the review converges to GO, the gate closes and the skill exits normally." }
- { header: "Fix PR", label: "Run x-pr-fix and retry", description: "Invokes x-pr-fix on the current PR; reapresents this menu on return." }
- { header: "Abort", label: "Cancel the operation", description: "Terminates the skill with REVIEW_REMEDIATION_EXHAUSTED. No further remediation is attempted." }
On PROCEED (slot 1):
gateAttempts++
Re-dispatch auto-remediation agents (same classification logic as Step 8 sub-steps 1-3, with 2 new retry cycles)
Re-execute Step 4 (full review)
IF review returns GO:
Exit gate with GO — skill completes normally
ELSE:
IF gateAttempts >= 3:
Emit REVIEW_FIX_LOOP_EXCEEDED and terminate (see below)
ELSE:
Continue loop (reapresent menu)
On FIX-PR (slot 2):
gateAttempts++
Write/update state file at plans/review/<pr>/state.json (opt-in persistence):
phase: "GATE_FIX_PR"
lastPhaseCompletedAt: <ISO-8601 UTC now>
lastGateDecision: "FIX_PR"
fixAttempts: [... previous ..., { at: <now>, delegateSkill: "x-pr-fix", prNumber: <PR>, outcome: "pending" }]
schemaVersion: "1.0"
Invoke x-pr-fix via Rule 13 Pattern 1 INLINE-SKILL:
Skill(skill: "x-pr-fix", args: "<PR>")
Update last fixAttempt.outcome to "applied" (or appropriate outcome)
Update state file: lastGateDecision = "FIX_PR", lastPhaseCompletedAt = <now>
IF gateAttempts >= 3:
Emit REVIEW_FIX_LOOP_EXCEEDED and terminate (see below)
ELSE:
Continue loop (reapresent menu)
On ABORT (slot 3):
Emit: "Review NO-GO final: operator aborted after ${gateAttempts} remediation attempt(s) on PR ${PR}"
Exit with code REVIEW_REMEDIATION_EXHAUSTED
Guard-rail — REVIEW_FIX_LOOP_EXCEEDED (3 consecutive PROCEED or FIX-PR without convergence):
When gateAttempts >= 3 without converging to GO, terminate the gate automatically:
REVIEW_FIX_LOOP_EXCEEDED: Loop de fix excedeu 3 tentativas no review do PR ${PR};
gate encerrado com ABORT automático.
Retomar via --resume-review ${PR} com --non-interactive ou intervenção manual.
No 4th option is offered. The gate terminates immediately. The menu was presented exactly 3 times (RULE-002 invariant: total option count remains 3 at all previous presentations).
Written only when the operator selects FIX-PR (slot 2) in Step 8.4. Enables resume via --resume-review <pr>.
Path: plans/review/<pr-number>/state.json
Schema (Rule 20 §State File Schema — version 1.0):
{
"phase": "GATE_FIX_PR",
"lastPhaseCompletedAt": "<ISO-8601 UTC>",
"lastGateDecision": "<PROCEED|FIX_PR|ABORT|null>",
"fixAttempts": [
{
"at": "<ISO-8601 UTC>",
"delegateSkill": "x-pr-fix",
"prNumber": 123,
"outcome": "applied"
}
],
"schemaVersion": "1.0"
}
| Field | Type | Required | Notes |
|-------|------|----------|-------|
| phase | String | Yes | Always "GATE_FIX_PR" for this skill |
| lastPhaseCompletedAt | String (ISO-8601 UTC) | Yes | Updated on each write |
| lastGateDecision | String | null | Yes | One of PROCEED, FIX_PR, ABORT, or null before first interaction |
| fixAttempts | Array | Yes | Always present; [] before first fix; max 3 items |
| schemaVersion | String | Yes | Literal "1.0" |
fixAttempts entry fields: at (ISO-8601 UTC), delegateSkill (always "x-pr-fix"), prNumber (PR number), outcome (applied | no_comments | compile_regression | aborted).
Lifecycle:
<path>.tmp, rename) when slot 2 (FIX-PR) is selected--non-interactive path--resume-review <pr> flag:
When present, reads the state file at plans/review/<pr>/state.json and restores gateAttempts from fixAttempts.size(). If the state file satisfies the schema (Rule 20), the gate loop resumes from the last decision point. If the state file is absent or invalid, the gate starts fresh (gateAttempts = 0) with a warning:
WARNING: State file not found at plans/review/<pr>/state.json. Starting gate from scratch.
If the state file fails schema validation, emit GATE_SCHEMA_INVALID with the path and the missing/malformed field name.
| Code | Condition | Message |
|------|-----------|---------|
| REVIEW_REMEDIATION_EXHAUSTED | Operator selected ABORT in Step 8.4 gate | "Review NO-GO final: operador abortou após ${N} tentativas de remediation no PR ${PR}" |
| REVIEW_FIX_LOOP_EXCEEDED | 3 consecutive PROCEED or FIX-PR attempts without converging to GO | "Loop de fix excedeu 3 tentativas no review do PR ${PR}; gate encerrado com ABORT automático. Retomar via --resume-review ${PR} com --non-interactive ou intervenção manual." |
| GATE_SCHEMA_INVALID | State file at plans/review/<pr>/state.json fails Rule 20 schema validation | "State file inválido para gate em {path}: {campo} ausente ou mal-formado" |
plans/epic-XXXX/reviews/review-tech-lead-story-XXXX-YYYY.md — Tech Lead review reportplans/epic-XXXX/reviews/dashboard-story-XXXX-YYYY.md — Updated consolidated dashboardplans/epic-XXXX/reviews/remediation-story-XXXX-YYYY.md — Updated remediation trackingplans/review/<pr-number>/state.json — Gate state (opt-in, written only on FIX-PR selection)| Scenario | Action |
|----------|--------|
| No diff exists between branches | Abort with message: "No changes detected between current branch and base. Nothing to review." |
| Template _TEMPLATE-TECH-LEAD-REVIEW.md missing | Log warning, use inline format as fallback (RULE-012 — Graceful template fallback). Skip dashboard and remediation updates. |
| Specialist review reports not found | Proceed with Tech Lead review only; note absence in report |
| Compilation or build failure | Record failure in report, deduct points from Framework & Infra section |
| Test suite failure (unit/integration) | Automatic NO-GO regardless of rubric score; record all failing tests in report |
| Coverage below threshold (< 95% line or < 90% branch) | Automatic NO-GO; record coverage gap as CRITICAL finding |
| Smoke test failure | Automatic NO-GO; record failing smoke tests as CRITICAL finding |
| NO-GO after 2 retry cycles | Route to Step 8.4 Exhausted-Retry Gate |
| NO-GO with --no-auto-remediation | Route directly to Step 8.4 Exhausted-Retry Gate |
| --non-interactive after retry exhausted | Skip gate; emit legacy HALT text; return NO-GO |
| State file missing on --resume-review | Start gate fresh; emit warning |
| State file schema invalid | Emit GATE_SCHEMA_INVALID; start gate fresh |
{review_conditional_criteria}
| Skill | Relationship | Context |
|-------|-------------|---------|
| x-story-implement | called-by | Produces the same artifact as Phase 6 |
| x-review | reads | Reads specialist review reports for cross-validation |
| x-review | complements | /x-review = breadth (7 specialists), /x-review-pr = depth (1 Tech Lead) |
/x-review, updated by /x-review-pr (RULE-006).claude/templates/ are copied verbatim by PlanTemplatesAssembler — not rendered by the enginetesting
Scaffolds a Helidon SE/MP service with routing, health, config, Dockerfile, and tests.
tools
Generates a Picocli @Command with subcommands, options, converters, and unit tests.
testing
Scaffolds a Micronaut service with @Controller, DI, health, Dockerfile, and tests.
testing
Scaffolds a Helidon SE/MP service with routing, health, config, Dockerfile, and tests.