---
name: ai-eng/work
description: Execute a plan or task with systematic tracking, quality gates, and comprehensive validation.
agent: build
version: 2.0.0
inputs:
  - name: plan
    type: string
    required: false
    description: Plan file path or task ID
  - name: fromPlan
    type: string
    required: false
    description: Path to plan file to execute
outputs:
  - name: execution_report
    type: structured
    format: JSON
    description: Execution report with task results and quality gate outcomes
---

Default output: return only the result, blockers, and required evidence. Omit preambles, process narration, repeated context, confidence scores, and follow-up offers. Use at most five bullets unless a required artifact or schema needs more.

# Work Command

Execute a plan or task: $ARGUMENTS

> **Phase 4 of Spec-Driven Workflow**: Research → Specify → Plan → Work → Verify → Review

Load `skills/incremental-implementation/SKILL.md`, `skills/test-driven-development/SKILL.md`, and `skills/prompt-refinement/SKILL.md` (phase: work). If using `--ralph`, also load `skills/workflow/ralph-wiggum/SKILL.md`.

## Quick Start

```bash
/ai-eng/work "specs/auth/plan.md"
/ai-eng/work --from-plan=specs/auth/plan.md --continue
/ai-eng/work "FEAT-001" --dry-run
/ai-eng/work "implement feature" --ralph --ralph-show-progress
```

## Options

| Option | Description |
|--------|-------------|
| `--from-plan <path>` | Path to plan file to execute |
| `--continue` | Resume interrupted work |
| `--validate-only` | Run validation without implementation |
| `--dry-run` | Show what would be done without executing |
| `-v, --verbose` | Enable verbose output |
| `--ralph` | Enable Ralph Wiggum iteration mode |

## Process

### Phase 1: Setup
- Load plan from `specs/{feature}/plan.md`
- Load spec from `specs/{feature}/spec.md` if it exists
- Create feature branch: `git checkout -b feat/{feature-slug}`
- Initialize todo tracking from plan tasks

### Phase 2: Task Execution Loop
For each task in dependency order:
1. Mark task in progress
2. Implement changes following project conventions
3. Write/update tests (TDD: red → green → refactor)
4. Run quality gates: lint → typecheck → unit tests → build
5. Commit with descriptive message including task ID
6. Mark task complete

### Phase 3: Validation
- Full test suite
- Full build
- Spec validation (cross-reference completed tasks with spec acceptance criteria)
- Security check if applicable

### Phase 4: Verify and Review Preparation
- Run `/verify` (lint, typecheck, test, build)
- Update documentation
- Create pull request
- Request review via `/ai-eng/review`

## Quality Gates (Run In Order)

| Gate | Command | Must Pass |
|------|---------|-----------|
| Lint | `bun run lint` | Yes |
| Types | `bun run type-check` | Yes |
| Unit Tests | `bun run test:unit` | Yes (80%+ coverage) |
| Build | `bun run build` | Yes |
| Integration | `bun run test:integration` | Yes |

**No task is complete until all gates pass.**

## Integration

- Reads from: `/ai-eng/plan` output (plan.md), `/ai-eng/spec` output (spec.md)
- Feeds into: `/verify`, then `/ai-eng/review`

$ARGUMENTS
