---
description: Complete task review and mark as done
agent: build
---

# Complete Task: $ARGUMENTS

## MANDATORY VALIDATION GATES (MUST PASS ALL)

### Gate 1: Task Files Exist

Check that @backlog/tasks/$ARGUMENTS/ contains:

- [ ] prd.md exists
- [ ] spec.md exists
- [ ] review.md exists

**If ANY missing:** STOP. Task setup incomplete.

### Gate 2: PRD Validation

Check @backlog/tasks/$ARGUMENTS/prd.md has:

- [ ] Goal section (1-2 sentences, measurable)
- [ ] Scope section (In-Scope and Out-of-Scope lists)
- [ ] Success Criteria section (checkboxes like `- [ ]`)

**If ANY missing:** STOP. PRD incomplete.

### Gate 3: Spec Validation

Check @backlog/tasks/$ARGUMENTS/spec.md has:

- [ ] Architecture section (describes the plan)
- [ ] Constraints section (lists rules to follow)
- [ ] Edge Cases section (lists corner cases)
- [ ] Testing section (describes how to verify)

**If ANY missing:** STOP. Spec incomplete.

### Gate 4: Review.md Validation

Check @backlog/tasks/$ARGUMENTS/review.md has:

- [ ] "What Changed" section (filled, not empty)
- [ ] "What Skipped" section (filled, not empty)
- [ ] "Inconsistencies" section (filled, even if "none")
- [ ] "Validation" section (filled, describes success criteria met)

**If ANY empty or placeholder text:** STOP. Review incomplete.

### Gate 5: Success Criteria Check

Look at PRD success criteria (checkboxes). Count:

- How many criteria exist total? [Count]
- How many are marked [x]? [Count]

**If less than 100% complete:** STOP with list of remaining criteria.

### Gate 6: Git Status Check

Verify git status is clean:

- [ ] All changes either committed OR staged with clear reason

**If uncommitted changes exist:** STOP. Commit or explain before completing.

## Completion Execution

**ONLY if ALL gates pass:**

1. Mark task as "Done" in backlog
2. Archive task files to history
3. Create git commit (if not already done) linking to task ID
4. Display completion summary

## Completion Summary

Display:

```
✅ TASK COMPLETED: $ARGUMENTS

PRD Goal: [From prd.md]
Success Criteria: [X/Y completed]
Files Changed: [List from review.md]
Git Commit: [Hash if created]

Status: DONE
```

---

**ANTI-HALLUCINATION: Task cannot be marked done until ALL validation gates pass**
