Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If shared/ is missing, fetch files via WebFetch from https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Type: L3 Worker
Category: 4XX Execution
Task Reviewer
MANDATORY after every task execution. Reviews a single task in To Review and decides Done vs To Rework with immediate fixes or clear rework notes.
This skill is NOT optional. Every executed task MUST be reviewed immediately. No exceptions, no batching, no skipping.
Purpose & Scope
- Resolve task ID (per Input Resolution Chain); load full task and parent Story independently (Linear: get_issue; File: Read task file).
- Check architecture, correctness, configuration hygiene, docs, and tests.
- For test tasks, verify risk-based limits and priority (≤15) per planner template.
- Update only this task: accept (Done) or send back (To Rework) with explicit reasons and fix suggestions tied to best practices.
Inputs
| Input |
Required |
Source |
Description |
taskId |
Yes |
args, parent Story, kanban, user |
Task to review |
Resolution: Task Resolution Chain.
Status filter: To Review
Phase 0: Tools Config
MANDATORY READ: Load shared/references/environment_state_contract.md, shared/references/storage_mode_detection.md, and shared/references/input_resolution_pattern.md
Extract: task_provider = Task Management → Provider (linear | file).
Task Storage Mode
| Aspect |
Linear Mode |
File Mode |
| Load task |
get_issue(task_id) |
Read("docs/tasks/epics/.../tasks/T{NNN}-*.md") |
| Load Story |
get_issue(parent_id) |
Read("docs/tasks/epics/.../story.md") |
| Update status |
save_issue(id, state: "Done"/"To Rework") |
Edit the **Status:** line in file |
| Add comment |
create_comment({issueId, body}) |
Write comment to .../comments/{ISO-timestamp}.md |
| Create [BUG] task |
save_issue({title, parentId, team, labels, state}) |
Write("docs/tasks/.../T{NNN}-bug-{slug}.md") |
File Mode status values: Done, To Rework (only these two outcomes from review)
Mode Detection
Detect operating mode at startup:
Plan Mode Active:
- Steps 1-3: Resolve task and load context (read-only, OK in plan mode)
- Generate REVIEW PLAN (files, checks) → write to plan file
- Call ExitPlanMode → STOP. Do NOT execute review.
- Steps 4-9: After approval → execute full review
Normal Mode:
- Steps 1-9: Standard workflow without stopping
Plan Mode Support
MANDATORY READ: Load shared/references/plan_mode_pattern.md Workflow A (Preview-Only) for plan mode behavior.
MANDATORY READ: Load shared/references/mcp_tool_preferences.md and shared/references/mcp_integration_patterns.md
CRITICAL: In Plan Mode, plan file = REVIEW PLAN (what will be checked). NEVER write review findings or verdicts to plan file.
Review Plan format:
REVIEW PLAN for Task {ID}: {Title}
| Field | Value |
|-------|-------|
| Task | {ID}: {Title} |
| Status | {To Review} |
| Type | {impl/test/refactor} |
| Story | {Parent ID}: {Parent Title} |
Files to review:
- {file1} (deliverable)
- {file2} (affected component)
| # | Check | Will Verify |
|---|-------|-------------|
| 1 | Approach | Technical Approach alignment |
| 2 | Clean Code | No dead code, no backward compat shims |
| 3 | Config | No hardcoded creds/URLs |
| 4 | Errors | try/catch on external calls |
| 5 | Logging | ERROR/INFO/DEBUG levels |
| 6 | Comments | WHY not WHAT, docstrings |
| 7 | Naming | Project conventions |
| 8 | Docs | API/env/README updates |
| 9 | Tests | Updated/risk-based limits |
| 10 | AC | 4 criteria validation |
| 11 | Side-effects | Pre-existing bugs in touched files |
| 12 | Destructive ops | Safety guards from destructive_operation_safety.md (loaded in step 4) |
| 13 | Algorithm correctness | Loop invariants, collection keys, unbounded ops, shared state leaks |
| 14 | Event channels | Channel name consistency in diff |
| 15 | CI Checks | lint/typecheck pass per ci_tool_detection.md |
Expected output: Verdict (`Done | To Rework`) + Issues + Fix actions
Progress Tracking with TodoWrite
When operating in any mode, skill MUST create detailed todo checklist tracking ALL steps.
Rules:
- Create todos IMMEDIATELY before Step 1
- Each workflow step = separate todo item; multi-check steps get sub-items
- Mark
in_progress before starting step, completed after finishing
Todo Template (~11 items):
Step 1: Resolve taskId
- Resolve via args / Story context / kanban / AskUserQuestion (To Review filter)
Step 2: Load Task
- Load task by ID, detect type
Step 3: Read Context
- Load full task + parent Story + affected components
Step 3b: Goal Articulation Gate
- State what specific quality question this review must answer (<=25 tokens each)
Step 4: Review Checks
- Verify approach alignment with Story Technical Approach
- Check clean code: no dead code, no backward compat shims
- Cross-file DRY: Grep src/ for new function/class names (count mode). 3+ similar → CONCERN
- Check config hygiene, error handling, logging
- Check comments, naming, docs updates
- Verify tests updated/run (risk-based limits for test tasks)
Step 5: AC Validation
- Validate implementation against 4 AC criteria
Step 6: Side-Effect Bug Detection
- Scan for bugs outside task scope, create [BUG] tasks
Step 7: Decision
- Apply minor fixes or set To Rework with guidance
Step 8: Mechanical Verification
- Run lint/typecheck per ci_tool_detection.md (only if verdict=Done)
Step 9: Update & Commit
- Set task status, update kanban, post review comment
- If Done: leave branch changes uncommitted for downstream branch ownership rules
Workflow (concise)
Use hex-graph first when semantic diff, clone groups, references, or review blast radius matter. Use hex-line first for local code/config/script/test reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in Read/Grep/Glob/Bash and record the fallback in the review instead of blocking.
Resolve taskId: Run Task Resolution Chain per guide (status filter: [To Review]).
Load task: Load full task and parent Story independently. Detect type (label "tests" -> test task, else implementation/refactor).
Read context: Full task + parent Story; load affected components/docs; review diffs if available.
Hex MCP acceleration: Prefer analyze_changes(path=project_root, base_ref="HEAD~1") for semantic risk snapshot when graph is indexed; use changes(path="src/", compare_against="HEAD~1") for AST-level diff review of structural changes.
3b) Goal gate: MANDATORY READ: Load shared/references/goal_articulation_gate.md — Before reviewing, state: (1) REAL GOAL: what specific quality question must this review answer for THIS task? (2) DONE: what evidence proves quality is sufficient? (3) NOT THE GOAL: what would a surface-level rubber-stamp look like? (4) INVARIANTS: what non-obvious constraint exists (side-effects on other modules, implicit AC)?
Review checks:
Spec-first gate: Quick AC pre-check: scan task AC against implementation. If any AC is clearly unmet (BLOCKER-level) → immediate To Rework, skip remaining quality checks. Full AC validation still runs in Step 5.
MANDATORY READ: Load shared/references/clean_code_checklist.md, shared/references/destructive_operation_safety.md
- Goal validation (Recovery Paradox): If executor articulated a REAL GOAL (visible in task comments or implementation), validate it matches the Story's target deliverable. If executor framed the goal around a secondary subject (e.g., "implement the endpoint" instead of "enable user data export") → CONCERN:
GOAL-MISFRAME: executor goal targets secondary subject, may miss hidden constraints.
- Blueprint completion (advisory): If executor runtime data available (
.hex-skills/runtime-artifacts/runs/ for this task), load PHASE_3 blueprint and PHASE_6 blueprint_status from executor checkpoints. Flag as CONCERN if: completion_pct < 100 without justifications for skipped items, or added files exceed 50% of planned without justification. If runtime data unavailable, check metadata.blueprint_status from executor summary. Not a BLOCKER.
- Approach: diff aligned with Technical Approach in Story. If different → rationale documented in code comments.
- Clean code: Per checklist — verify all 4 categories. Replaced implementations fully removed. If refactoring changed API — callers updated, old signatures removed.
- Cross-file DRY: For each NEW function/class/handler created by task, Grep
src/ for similar names/patterns (count mode). If 3+ files contain similar logic → add CONCERN: MNT-DRY-CROSS: {pattern} appears in {count} files — consider extracting to shared module. This catches cross-story duplication that per-task review misses.
- Cross-file DRY preferred (hex-graph): If hex-graph indexed, use
audit_workspace(path=scan_path, verbosity="minimal", limit=5, clone_member_limit=3) and inspect returned clones. Raise limits only when the bounded preview is insufficient. Filter groups where any member is in task-modified files. Each match = CONCERN: MNT-DRY-CROSS. Fall back to Grep name search above if hex-graph unavailable.
- No hardcoded creds/URLs/magic numbers; config in env/config.
- Destructive operation guards: use code-level guards table from destructive_operation_safety.md (loaded above). CRITICAL/HIGH severity → BLOCKER: SEC-DESTR-{ID}. MEDIUM severity → CONCERN: SEC-DESTR-{ID}.
- Error handling: all external calls (API, DB, file I/O) wrapped in try/catch or equivalent. No swallowed exceptions. Layering respected; reuse existing components.
- Side-effect breadth: leaf service functions with 3+ side-effect categories → CONCERN:
ARCH-AI-SEB. Exception: orchestrator/coordinator functions (imports 3+ services AND delegates sequentially) are EXPECTED to have multiple side-effect categories — do NOT flag.
- Interface honesty: read-named functions (get_/find_/check_) with write side-effects → CONCERN:
ARCH-AI-AH
- Logging: errors at ERROR; auth/payment events at INFO; debug data at DEBUG. No sensitive data in logs.
- Comments: explain WHY not WHAT; no commented-out code; docstrings on public methods.
- Naming: follows project's existing convention (check 3+ similar files). No abbreviations except domain terms. No single-letter variables (except loops).
- Entity Leakage: ORM entities must NOT be returned directly from API endpoints. Use DTOs/response models. (BLOCKER for auth/payment, CONCERN for others)
- Method Signature: no boolean flag parameters in public methods (use enum/options object); no more than 5 parameters without DTO. (NIT)
- Algorithm correctness (loops, collections, boundaries): Does
break/continue/return inside loops handle ALL matching items, not just the first? Do dict/set comprehensions handle duplicate keys correctly (last-wins may lose data)? Any list(query.all()) or unbounded loop on user-controlled data without LIMIT? Any mutable shared state (connection pool GUCs, session globals) that leaks across requests? (BLOCKER if data loss/corruption, CONCERN otherwise)
- Event channel consistency (task-scoped): When task diff touches event-related code (NOTIFY/LISTEN/emit/subscribe/publish/on), verify: (1) channel name string in publisher matches channel name string in subscriber; (2) if channel name is a new string literal, Grep
src/ for matching listener/publisher counterpart. Mismatch → CONCERN: ARCH-EVENT-MISMATCH: publisher '{pub_name}' has no matching subscriber. Orphan → CONCERN: ARCH-EVENT-ORPHAN: subscriber '{sub_name}' has no matching publisher.
- Simplicity criterion (task-scoped): MANDATORY READ: Load
references/simplicity_criterion.md — Check MNT-KISS-SCOPE (effort-S task with 3+ new abstractions) and MNT-YAGNI-SCOPE (refactoring added new dependencies or created 2x more files than modified). Advisory CONCERNs only.
- Code efficiency (task-scoped): Spot-check 2-3 key functions from diff for unnecessary intermediates, verbose patterns where idioms exist, or boilerplate framework handles. If found → CONCERN:
MNT-EFF-SCOPE: {pattern} in {file}. Advisory only. (shared/references/code_efficiency_criterion.md)
- Frontend review (conditional): IF reviewed files include
.tsx/.vue/.svelte/.html/.css: MANDATORY READ: Load shared/references/frontend_design_guide.md. (a) WCAG 2.1 AA: contrast ratios, keyboard nav, ARIA labels, focus management → BLOCKER: A11Y-{ID}. (b) Composition: single-purpose sections, no dashboard card mosaics → CONCERN: UI-COMP-{ID}. (c) Typography restraint: max 2 typefaces, 1 accent → CONCERN: UI-TYPE. (d) Copy quality: product language, no placeholder text → NIT: UI-COPY. (e) Motion justification: each animation serves hierarchy/atmosphere → NIT: UI-MOTION. (f) Design system adherence: if project has design_guidelines.md, verify tokens match → CONCERN: UI-SYSTEM.
- Docs: if public API changed → API docs updated. If new env var → .env.example updated. If new concept → README/architecture doc updated.
- Tests updated/run: for impl/refactor ensure affected tests adjusted; for test tasks verify risk-based limits and priority (≤15) per planner template.
AC Validation (MANDATORY for implementation tasks):
MANDATORY READ: Load references/ac_validation_checklist.md. Verify implementation against 4 criteria:
- AC Completeness: All AC scenarios covered (happy path + errors + edge cases).
- AC Specificity: Exact requirements met (HTTP codes 200/401/403, timing <200ms, exact messages).
- Task Dependencies: Task N uses ONLY Tasks 1 to N-1 (no forward dependencies on N+1, N+2).
- Database Creation: Task creates ONLY tables in Story scope (no big-bang schema).
If ANY criterion fails → To Rework with specific guidance from checklist.
Side-Effect Bug Detection (MANDATORY):
While reviewing affected code, actively scan for bugs/issues NOT related to current task:
- Pre-existing bugs in touched files
- Broken patterns in adjacent code
- Security issues in related components
- Unsupported APIs, outdated dependencies
- Missing error handling in caller/callee functions
For each side-effect bug found:
- Create new task in same Story:
- IF
task_provider = linear: save_issue({title: "[BUG] {desc}", description, parentId: Story.id, team: teamId, labels: ["bug", "discovered-in-review"], state: "Backlog", priority})
- IF
task_provider = file: Write("docs/tasks/epics/.../tasks/T{NNN}-bug-{slug}.md") with **Status:** Backlog, **Labels:** bug, discovered-in-review, **Story:** US{NNN}, **Created:** {date}
- Title:
[BUG] {Short description}
- Description: Location, issue, suggested fix
- Label:
bug, discovered-in-review
- Priority: based on severity (security → 1 Urgent, logic → 2 High, style → 4 Low)
- Do NOT defer — create task immediately, reviewer catches what executor missed
Decision (for current task only):
- If only nits: apply minor fixes and set Done.
- If issues remain: set To Rework with comment explaining why (best-practice ref) and how to fix.
- Side-effect bugs do NOT block current task's Done status (they are separate tasks).
- If Done: leave branch changes uncommitted and hand off the accepted task state with review comment + summary artifact.
Mechanical Verification (if Done):
MANDATORY READ: Load shared/references/ci_tool_detection.md
IF verdict == Done:
- Detect lint/typecheck commands per discovery hierarchy in ci_tool_detection.md
- Run detected checks (timeouts per guide: 2min linters, 5min typecheck)
MANDATORY READ: Load
shared/references/output_normalization.md
- IF any FAIL → apply output normalization per §1 normalize → §2 deduplicate → §4 truncate to 50 lines → override verdict to To Rework with normalized output
- IF no tooling detected → SKIP with info message
Update: Set task status in Linear; update kanban: if Done → remove task from kanban (Done section tracks Stories only, not individual Tasks); if To Rework → move task to To Rework section; add review comment with findings/actions. If side-effect bugs created, mention them in comment.
Review Quality Score
Context: Quantitative review results make downstream decisions auditable and track review consistency.
Formula: Quality Score = 100 - (20 × BLOCKER_count) - (10 × CONCERN_count) - (3 × NIT_count)
Classify each finding from Steps 3-5:
| Category |
Weight |
Examples |
| BLOCKER |
-20 |
AC not met, security issue, missing error handling, wrong approach |
| CONCERN |
-10 |
Suboptimal pattern, missing docs, test gaps |
| NIT |
-3 |
Naming, style, minor cleanup |
Verdict mapping:
| Score |
Verdict |
Action |
| 90-100 |
Done |
Accept, apply nit fixes inline |
| 70-89 |
Done (with notes) |
Accept, document concerns for future |
| <70 |
To Rework |
Send back with fix guidance per finding |
Note: Side-effect bugs (Step 5) do NOT affect current task's quality score — they become separate [BUG] tasks.
Critical Rules
- One task at a time; side-effect bugs → separate [BUG] tasks (not scope creep).
- Quality gate: all in-scope issues resolved before Done, OR send back with clear fix guidance.
- Test-task violations (limits/priority ≤15) → To Rework.
- Keep task language (EN/RU) in edits/comments.
- Mechanical checks (lint/typecheck) run ONLY when verdict is Done; skip for To Rework.
Runtime Summary Artifact
MANDATORY READ: Load shared/references/coordinator_summary_contract.md, shared/references/worker_runtime_contract.md, shared/references/task_worker_runtime_contract.md
Shared contract:
- emit
summary_kind=task-status
- standalone mode omits
runId and summaryArtifactPath
- managed mode passes both
runId and exact summaryArtifactPath before the worker writes its validated review outcome
Monitor (2.1.98+): For lint/typecheck commands expected >30s, use Monitor. Fallback: Bash(run_in_background=true).
Definition of Done
Reference Files
- Environment state:
shared/references/environment_state_contract.md
- Storage mode operations:
shared/references/storage_mode_detection.md
- [MANDATORY] Problem-solving approach:
shared/references/problem_solving.md
- AC validation rules:
shared/references/ac_validation_rules.md
- AC Validation Checklist:
references/ac_validation_checklist.md (4 criteria: Completeness, Specificity, Dependencies, DB Creation)
- Clean code checklist:
shared/references/clean_code_checklist.md
- CI tool detection:
shared/references/ci_tool_detection.md
- Output normalization:
shared/references/output_normalization.md
- Kanban format:
docs/tasks/kanban_board.md
Version: 5.2.0
Last Updated: 2026-03-24
1---2name: ln-402-task-reviewer-43description: Reviews task implementation for quality, code standards, and test coverage. Use when task is in To Review. Sets task Done or To Rework.4license: MIT5---6
7> **Paths:** File paths (`shared/`, `references/`, `../ln-*`) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If `shared/` is missing, fetch files via WebFetch from `https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}`.
8
9**Type:** L3 Worker
10**Category:** 4XX Execution
11
12# Task Reviewer
13
14**MANDATORY after every task execution.** Reviews a single task in To Review and decides Done vs To Rework with immediate fixes or clear rework notes.
15
16> **This skill is NOT optional.** Every executed task MUST be reviewed immediately. No exceptions, no batching, no skipping.
17
18## Purpose & Scope
19- Resolve task ID (per Input Resolution Chain); load full task and parent Story independently (Linear: get_issue; File: Read task file).
20- Check architecture, correctness, configuration hygiene, docs, and tests.
21- For test tasks, verify risk-based limits and priority (≤15) per planner template.
22- Update only this task: accept (Done) or send back (To Rework) with explicit reasons and fix suggestions tied to best practices.
23
24## Inputs
25
26| Input | Required | Source | Description |
27|-------|----------|--------|-------------|
28| `taskId` | Yes | args, parent Story, kanban, user | Task to review |
29
30**Resolution:** Task Resolution Chain.
31**Status filter:** To Review
32
33## Phase 0: Tools Config
34
35**MANDATORY READ:** Load `shared/references/environment_state_contract.md`, `shared/references/storage_mode_detection.md`, and `shared/references/input_resolution_pattern.md`
36
37Extract: `task_provider` = Task Management → Provider (`linear` | `file`).
38
39## Task Storage Mode
40
41| Aspect | Linear Mode | File Mode |
42|--------|-------------|-----------|
43| **Load task** | `get_issue(task_id)` | `Read("docs/tasks/epics/.../tasks/T{NNN}-*.md")` |
44| **Load Story** | `get_issue(parent_id)` | `Read("docs/tasks/epics/.../story.md")` |
45| **Update status** | `save_issue(id, state: "Done"/"To Rework")` | `Edit` the `**Status:**` line in file |
46| **Add comment** | `create_comment({issueId, body})` | `Write` comment to `.../comments/{ISO-timestamp}.md` |
47| **Create [BUG] task** | `save_issue({title, parentId, team, labels, state})` | `Write("docs/tasks/.../T{NNN}-bug-{slug}.md")` |
48
49**File Mode status values:** Done, To Rework (only these two outcomes from review)
50
51## Mode Detection
52
53Detect operating mode at startup:
54
55**Plan Mode Active:**
56- Steps 1-3: Resolve task and load context (read-only, OK in plan mode)
57- Generate REVIEW PLAN (files, checks) → write to plan file
58- Call ExitPlanMode → STOP. Do NOT execute review.
59- Steps 4-9: After approval → execute full review
60
61**Normal Mode:**
62- Steps 1-9: Standard workflow without stopping
63
64## Plan Mode Support
65
66**MANDATORY READ:** Load `shared/references/plan_mode_pattern.md` Workflow A (Preview-Only) for plan mode behavior.
67**MANDATORY READ:** Load `shared/references/mcp_tool_preferences.md` and `shared/references/mcp_integration_patterns.md`
68
69**CRITICAL: In Plan Mode, plan file = REVIEW PLAN (what will be checked). NEVER write review findings or verdicts to plan file.**
70
71**Review Plan format:**
72
73```
74REVIEW PLAN for Task {ID}: {Title}
75
76| Field | Value |
77|-------|-------|
78| Task | {ID}: {Title} |
79| Status | {To Review} |
80| Type | {impl/test/refactor} |
81| Story | {Parent ID}: {Parent Title} |
82
83Files to review:
84- {file1} (deliverable)
85- {file2} (affected component)
86
87| # | Check | Will Verify |
88|---|-------|-------------|
89| 1 | Approach | Technical Approach alignment |
90| 2 | Clean Code | No dead code, no backward compat shims |
91| 3 | Config | No hardcoded creds/URLs |
92| 4 | Errors | try/catch on external calls |
93| 5 | Logging | ERROR/INFO/DEBUG levels |
94| 6 | Comments | WHY not WHAT, docstrings |
95| 7 | Naming | Project conventions |
96| 8 | Docs | API/env/README updates |
97| 9 | Tests | Updated/risk-based limits |
98| 10 | AC | 4 criteria validation |
99| 11 | Side-effects | Pre-existing bugs in touched files |
100| 12 | Destructive ops | Safety guards from destructive_operation_safety.md (loaded in step 4) |
101| 13 | Algorithm correctness | Loop invariants, collection keys, unbounded ops, shared state leaks |
102| 14 | Event channels | Channel name consistency in diff |
103| 15 | CI Checks | lint/typecheck pass per ci_tool_detection.md |
104
105Expected output: Verdict (`Done | To Rework`) + Issues + Fix actions
106```
107
108## Progress Tracking with TodoWrite
109
110When operating in any mode, skill MUST create detailed todo checklist tracking ALL steps.
111
112**Rules:**
1131. Create todos IMMEDIATELY before Step 1
1142. Each workflow step = separate todo item; multi-check steps get sub-items
1153. Mark `in_progress` before starting step, `completed` after finishing
116
117**Todo Template (~11 items):**
118
119```
120Step 1: Resolve taskId
121 - Resolve via args / Story context / kanban / AskUserQuestion (To Review filter)
122
123Step 2: Load Task
124 - Load task by ID, detect type
125
126Step 3: Read Context
127 - Load full task + parent Story + affected components
128
129Step 3b: Goal Articulation Gate
130 - State what specific quality question this review must answer (<=25 tokens each)
131
132Step 4: Review Checks
133 - Verify approach alignment with Story Technical Approach
134 - Check clean code: no dead code, no backward compat shims
135 - Cross-file DRY: Grep src/ for new function/class names (count mode). 3+ similar → CONCERN
136 - Check config hygiene, error handling, logging
137 - Check comments, naming, docs updates
138 - Verify tests updated/run (risk-based limits for test tasks)
139
140Step 5: AC Validation
141 - Validate implementation against 4 AC criteria
142
143Step 6: Side-Effect Bug Detection
144 - Scan for bugs outside task scope, create [BUG] tasks
145
146Step 7: Decision
147 - Apply minor fixes or set To Rework with guidance
148
149Step 8: Mechanical Verification
150 - Run lint/typecheck per ci_tool_detection.md (only if verdict=Done)
151
152Step 9: Update & Commit
153 - Set task status, update kanban, post review comment
154 - If Done: leave branch changes uncommitted for downstream branch ownership rules
155```
156
157## Workflow (concise)
158Use `hex-graph` first when semantic diff, clone groups, references, or review blast radius matter. Use `hex-line` first for local code/config/script/test reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in `Read/Grep/Glob/Bash` and record the fallback in the review instead of blocking.
159
1601) **Resolve taskId:** Run Task Resolution Chain per guide (status filter: [To Review]).
1612) **Load task:** Load full task and parent Story independently. Detect type (label "tests" -> test task, else implementation/refactor).
1623) **Read context:** Full task + parent Story; load affected components/docs; review diffs if available.
163 **Hex MCP acceleration:** Prefer `analyze_changes(path=project_root, base_ref="HEAD~1")` for semantic risk snapshot when graph is indexed; use `changes(path="src/", compare_against="HEAD~1")` for AST-level diff review of structural changes.
1643b) **Goal gate:** **MANDATORY READ:** Load `shared/references/goal_articulation_gate.md` — Before reviewing, state: (1) REAL GOAL: what specific quality question must this review answer for THIS task? (2) DONE: what evidence proves quality is sufficient? (3) NOT THE GOAL: what would a surface-level rubber-stamp look like? (4) INVARIANTS: what non-obvious constraint exists (side-effects on other modules, implicit AC)?
1654) **Review checks:**
166 > **Spec-first gate:** Quick AC pre-check: scan task AC against implementation. If any AC is clearly unmet (BLOCKER-level) → immediate To Rework, skip remaining quality checks. Full AC validation still runs in Step 5.
167 **MANDATORY READ:** Load `shared/references/clean_code_checklist.md`, `shared/references/destructive_operation_safety.md`
168 - **Goal validation (Recovery Paradox):** If executor articulated a REAL GOAL (visible in task comments or implementation), validate it matches the Story's target deliverable. If executor framed the goal around a secondary subject (e.g., "implement the endpoint" instead of "enable user data export") → CONCERN: `GOAL-MISFRAME: executor goal targets secondary subject, may miss hidden constraints.`
169 - **Blueprint completion (advisory):** If executor runtime data available (`.hex-skills/runtime-artifacts/runs/` for this task), load PHASE_3 blueprint and PHASE_6 `blueprint_status` from executor checkpoints. Flag as CONCERN if: `completion_pct < 100` without justifications for skipped items, or added files exceed 50% of planned without justification. If runtime data unavailable, check `metadata.blueprint_status` from executor summary. Not a BLOCKER.
170 - Approach: diff aligned with Technical Approach in Story. If different → rationale documented in code comments.
171 - **Clean code:** Per checklist — verify all 4 categories. Replaced implementations fully removed. If refactoring changed API — callers updated, old signatures removed. <!-- Defense-in-depth: also checked by ln-511 MNT-DC- -->
172 - **Cross-file DRY:** For each NEW function/class/handler created by task, Grep `src/` for similar names/patterns (count mode). If 3+ files contain similar logic → add CONCERN: `MNT-DRY-CROSS: {pattern} appears in {count} files — consider extracting to shared module.` This catches cross-story duplication that per-task review misses. <!-- Defense-in-depth: also checked by ln-511 MNT-DRY- -->
173 - **Cross-file DRY preferred (hex-graph):** If hex-graph indexed, use `audit_workspace(path=scan_path, verbosity="minimal", limit=5, clone_member_limit=3)` and inspect returned `clones`. Raise limits only when the bounded preview is insufficient. Filter groups where any member is in task-modified files. Each match = CONCERN: `MNT-DRY-CROSS`. Fall back to Grep name search above if hex-graph unavailable.
174 - No hardcoded creds/URLs/magic numbers; config in env/config.
175 - Destructive operation guards: use code-level guards table from destructive_operation_safety.md (loaded above). CRITICAL/HIGH severity → BLOCKER: SEC-DESTR-{ID}. MEDIUM severity → CONCERN: SEC-DESTR-{ID}.
176 - Error handling: all external calls (API, DB, file I/O) wrapped in try/catch or equivalent. No swallowed exceptions. Layering respected; reuse existing components. <!-- Defense-in-depth: layers also checked by ln-511 ARCH-LB- -->
177 - Side-effect breadth: **leaf** service functions with 3+ side-effect categories → CONCERN: `ARCH-AI-SEB`. Exception: orchestrator/coordinator functions (imports 3+ services AND delegates sequentially) are EXPECTED to have multiple side-effect categories — do NOT flag. <!-- Defense-in-depth: also ln-511, ln-624 Rule 10 -->
178 - Interface honesty: read-named functions (get_/find_/check_) with write side-effects → CONCERN: `ARCH-AI-AH` <!-- Defense-in-depth: also ln-511, ln-643 Rule 6 -->
179 - Logging: errors at ERROR; auth/payment events at INFO; debug data at DEBUG. No sensitive data in logs.
180 - Comments: explain WHY not WHAT; no commented-out code; docstrings on public methods.
181 - Naming: follows project's existing convention (check 3+ similar files). No abbreviations except domain terms. No single-letter variables (except loops).
182 - Entity Leakage: ORM entities must NOT be returned directly from API endpoints. Use DTOs/response models. (BLOCKER for auth/payment, CONCERN for others) <!-- Defense-in-depth: also checked by ln-511 ARCH-DTO- -->
183 - Method Signature: no boolean flag parameters in public methods (use enum/options object); no more than 5 parameters without DTO. (NIT) <!-- Defense-in-depth: also checked by ln-511 MNT-SIG- -->
184 - **Algorithm correctness (loops, collections, boundaries):** Does `break`/`continue`/`return` inside loops handle ALL matching items, not just the first? Do dict/set comprehensions handle duplicate keys correctly (last-wins may lose data)? Any `list(query.all())` or unbounded loop on user-controlled data without LIMIT? Any mutable shared state (connection pool GUCs, session globals) that leaks across requests? (BLOCKER if data loss/corruption, CONCERN otherwise) <!-- Prefix: ALGO- -->
185 - **Event channel consistency (task-scoped):** When task diff touches event-related code (NOTIFY/LISTEN/emit/subscribe/publish/on), verify: (1) channel name string in publisher matches channel name string in subscriber; (2) if channel name is a new string literal, Grep `src/` for matching listener/publisher counterpart. Mismatch → CONCERN: `ARCH-EVENT-MISMATCH: publisher '{pub_name}' has no matching subscriber`. Orphan → CONCERN: `ARCH-EVENT-ORPHAN: subscriber '{sub_name}' has no matching publisher`. <!-- Defense-in-depth: also checked by ln-652 Rule 6, ln-511 ARCH-EVENT- -->
186 - **Simplicity criterion (task-scoped):** **MANDATORY READ:** Load `references/simplicity_criterion.md` — Check MNT-KISS-SCOPE (effort-S task with 3+ new abstractions) and MNT-YAGNI-SCOPE (refactoring added new dependencies or created 2x more files than modified). Advisory CONCERNs only. <!-- Defense-in-depth: also checked by ln-511 KISS/YAGNI -->
187 - **Code efficiency (task-scoped):** Spot-check 2-3 key functions from diff for unnecessary intermediates, verbose patterns where idioms exist, or boilerplate framework handles. If found → CONCERN: `MNT-EFF-SCOPE: {pattern} in {file}`. Advisory only. (`shared/references/code_efficiency_criterion.md`) <!-- Defense-in-depth: executor self-checks via same reference -->
188 - **Frontend review (conditional):** IF reviewed files include `.tsx/.vue/.svelte/.html/.css`: **MANDATORY READ:** Load `shared/references/frontend_design_guide.md`. (a) WCAG 2.1 AA: contrast ratios, keyboard nav, ARIA labels, focus management → BLOCKER: `A11Y-{ID}`. (b) Composition: single-purpose sections, no dashboard card mosaics → CONCERN: `UI-COMP-{ID}`. (c) Typography restraint: max 2 typefaces, 1 accent → CONCERN: `UI-TYPE`. (d) Copy quality: product language, no placeholder text → NIT: `UI-COPY`. (e) Motion justification: each animation serves hierarchy/atmosphere → NIT: `UI-MOTION`. (f) Design system adherence: if project has design_guidelines.md, verify tokens match → CONCERN: `UI-SYSTEM`.
189 - Docs: if public API changed → API docs updated. If new env var → .env.example updated. If new concept → README/architecture doc updated.
190 - Tests updated/run: for impl/refactor ensure affected tests adjusted; for test tasks verify risk-based limits and priority (≤15) per planner template.
1915) **AC Validation (MANDATORY for implementation tasks):**
192 **MANDATORY READ:** Load `references/ac_validation_checklist.md`. Verify implementation against 4 criteria:
193 - **AC Completeness:** All AC scenarios covered (happy path + errors + edge cases).
194 - **AC Specificity:** Exact requirements met (HTTP codes 200/401/403, timing <200ms, exact messages).
195 - **Task Dependencies:** Task N uses ONLY Tasks 1 to N-1 (no forward dependencies on N+1, N+2).
196 - **Database Creation:** Task creates ONLY tables in Story scope (no big-bang schema).
197 If ANY criterion fails → To Rework with specific guidance from checklist.
1986) **Side-Effect Bug Detection (MANDATORY):**
199 While reviewing affected code, actively scan for bugs/issues NOT related to current task:
200 - Pre-existing bugs in touched files
201 - Broken patterns in adjacent code
202 - Security issues in related components
203 - Unsupported APIs, outdated dependencies
204 - Missing error handling in caller/callee functions
205
206 **For each side-effect bug found:**
207 - Create new task in same Story:
208 - IF `task_provider` = `linear`: `save_issue({title: "[BUG] {desc}", description, parentId: Story.id, team: teamId, labels: ["bug", "discovered-in-review"], state: "Backlog", priority})`
209 - IF `task_provider` = `file`: `Write("docs/tasks/epics/.../tasks/T{NNN}-bug-{slug}.md")` with `**Status:** Backlog`, `**Labels:** bug, discovered-in-review`, `**Story:** US{NNN}`, `**Created:** {date}`
210 - Title: `[BUG] {Short description}`
211 - Description: Location, issue, suggested fix
212 - Label: `bug`, `discovered-in-review`
213 - Priority: based on severity (security → 1 Urgent, logic → 2 High, style → 4 Low)
214 - **Do NOT defer** — create task immediately, reviewer catches what executor missed
215
2167) **Decision (for current task only):**
217 - If only nits: apply minor fixes and set Done.
218 - If issues remain: set To Rework with comment explaining why (best-practice ref) and how to fix.
219 - Side-effect bugs do NOT block current task's Done status (they are separate tasks).
220 - **If Done:** leave branch changes uncommitted and hand off the accepted task state with review comment + summary artifact.
2218) **Mechanical Verification (if Done):**
222 **MANDATORY READ:** Load `shared/references/ci_tool_detection.md`
223 IF verdict == Done:
224 - Detect lint/typecheck commands per discovery hierarchy in ci_tool_detection.md
225 - Run detected checks (timeouts per guide: 2min linters, 5min typecheck)
226 **MANDATORY READ:** Load `shared/references/output_normalization.md`
227 - IF any FAIL → apply output normalization per §1 normalize → §2 deduplicate → §4 truncate to 50 lines → override verdict to To Rework with normalized output
228 - IF no tooling detected → SKIP with info message
2299) **Update:** Set task status in Linear; update kanban: if Done → **remove task from kanban** (Done section tracks Stories only, not individual Tasks); if To Rework → move task to To Rework section; add review comment with findings/actions. If side-effect bugs created, mention them in comment.
230
231## Review Quality Score
232
233**Context:** Quantitative review results make downstream decisions auditable and track review consistency.
234
235**Formula:** `Quality Score = 100 - (20 × BLOCKER_count) - (10 × CONCERN_count) - (3 × NIT_count)`
236
237**Classify each finding from Steps 3-5:**
238
239| Category | Weight | Examples |
240|----------|--------|----------|
241| BLOCKER | -20 | AC not met, security issue, missing error handling, wrong approach |
242| CONCERN | -10 | Suboptimal pattern, missing docs, test gaps |
243| NIT | -3 | Naming, style, minor cleanup |
244
245**Verdict mapping:**
246
247| Score | Verdict | Action |
248|-------|---------|--------|
249| 90-100 | Done | Accept, apply nit fixes inline |
250| 70-89 | Done (with notes) | Accept, document concerns for future |
251| <70 | To Rework | Send back with fix guidance per finding |
252
253**Note:** Side-effect bugs (Step 5) do NOT affect current task's quality score — they become separate [BUG] tasks.
254
255## Critical Rules
256- One task at a time; side-effect bugs → separate [BUG] tasks (not scope creep).
257- Quality gate: all in-scope issues resolved before Done, OR send back with clear fix guidance.
258- Test-task violations (limits/priority ≤15) → To Rework.
259- Keep task language (EN/RU) in edits/comments.
260- Mechanical checks (lint/typecheck) run ONLY when verdict is Done; skip for To Rework.
261
262## Runtime Summary Artifact
263
264**MANDATORY READ:** Load `shared/references/coordinator_summary_contract.md`, `shared/references/worker_runtime_contract.md`, `shared/references/task_worker_runtime_contract.md`
265
266Shared contract:
267- emit `summary_kind=task-status`
268- standalone mode omits `runId` and `summaryArtifactPath`
269- managed mode passes both `runId` and exact `summaryArtifactPath` before the worker writes its validated review outcome
270
271**Monitor (2.1.98+):** For lint/typecheck commands expected >30s, use `Monitor`. Fallback: `Bash(run_in_background=true)`.
272
273## Definition of Done
274- [ ] Steps 1-9 completed: task resolved, context loaded, review checks passed, AC validated, side-effect bugs created, mechanical verification passed, decision applied.
275- [ ] If Done: task removed from kanban after review acceptance. If To Rework: task moved with fix guidance.
276- [ ] Review comment posted (findings + [BUG] list if any).
277- [ ] Runtime summary artifact written to the shared task-status location.
278
279## Reference Files
280- **Environment state:** `shared/references/environment_state_contract.md`
281- **Storage mode operations:** `shared/references/storage_mode_detection.md`
282- **[MANDATORY] Problem-solving approach:** `shared/references/problem_solving.md`
283- **AC validation rules:** `shared/references/ac_validation_rules.md`
284- AC Validation Checklist: `references/ac_validation_checklist.md` (4 criteria: Completeness, Specificity, Dependencies, DB Creation)
285- **Clean code checklist:** `shared/references/clean_code_checklist.md`
286- **CI tool detection:** `shared/references/ci_tool_detection.md`
287- **Output normalization:** `shared/references/output_normalization.md`
288- Kanban format: `docs/tasks/kanban_board.md`
289
290---
291**Version:** 5.2.0
292**Last Updated:** 2026-03-24