@endgame-build/claude-workflows
Version:
Claude Code workflow system with commands, agents, and templates for AI-native development
156 lines (121 loc) • 4.89 kB
Markdown
description: Execute the implementation plan with continuous code review
argument-hint: <instance-name> <@plan.md>
# /eg:implement
You are tasked with executing an implementation plan by iterating through tasks, implementing each one with the coder agent, and validating quality with the code-reviewer agent before proceeding.
Input: `$ARGUMENTS`
## Step 1: Parse Arguments and Load Plan
Parse the arguments to extract:
- Instance name (first word before space)
- Plan document path (everything after first space)
Load the plan and progress:
- Read plan from `.eg/{instance-name}/plan.md`
- Read progress from `.eg/{instance-name}/progress.json` if it exists
## Step 2: Identify Next Tasks
Analyze the plan to identify tasks that:
- Have all dependencies completed
- Are not yet started or completed
- Can be worked on in parallel
## Step 3: Implement Tasks
For each task ready to implement:
### 3a. Update Progress to In-Progress
```
!jq '.tasks."{task-id}" = {"status": "in_progress", "started_at": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' .eg/{instance-name}/progress.json > .eg/{instance-name}/progress.tmp && mv .eg/{instance-name}/progress.tmp .eg/{instance-name}/progress.json
```
### 3b. Implement the Task
```
Task(
description="Implement {task-description}",
prompt=`
Implement task {task-id}: {task-description}
Context:
- Architecture: @.eg/{instance-name}/architecture.md
- Full plan: @.eg/{instance-name}/plan.md
- Task acceptance criteria: {acceptance-criteria}
Requirements:
- Write clean, efficient, well-documented code
- Follow project conventions and patterns
- Implement proper error handling
- Add appropriate logging
- Ensure code is testable
- Create focused, atomic changes
Do not overengineer. Keep it simple and maintainable.
`,
subagent_type="coder"
)
```
### 3c. Validate the Implementation
```
Task(
description="Validate implementation against requirements",
prompt=`
Validate the implementation for task {task-id}: {task-description}
Use the implementation-validator agent to check:
- Requirements compliance
- Architecture adherence
- Code quality standards
- Integration correctness
- Error handling completeness
The validator will output APPROVED/NEEDS_REVISION/MAJOR_ISSUES
`,
subagent_type="implementation-validator"
)
```
### 3d. Review and Iterate
If validation result is NEEDS_REVISION or MAJOR_ISSUES:
1. Use the validator feedback to fix issues
2. Re-invoke the coder with specific fixes
3. Re-validate until APPROVED
### 3e. Review the Implementation
Once validation passes, perform code review:
```
Task(
description="Review implementation of {task-description}",
prompt=`
Review the code changes for task {task-id}: {task-description}
Check for:
- Bugs and logic errors
- Security vulnerabilities
- Performance issues
- Code quality and maintainability
- Adherence to project standards
- Test coverage
Read project conventions from CLAUDE*.md files.
Provide specific, actionable feedback.
If critical issues are found, they must be fixed before proceeding.
`,
subagent_type="code-reviewer"
)
```
### 3f. Handle Review Feedback
If the reviewer finds critical issues:
- Re-invoke the coder to fix them
- Re-review until approved
### 3g. Commit the Changes
```
!git add -A
!git commit -m "feat: {task-description} (Task {task-id})"
```
### 3h. Update Progress to Completed
```
!jq '.tasks."{task-id}" = {"status": "completed", "started_at": "{start-time}", "completed_at": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'", "commit": "'$(git rev-parse HEAD)'"}' .eg/{instance-name}/progress.json > .eg/{instance-name}/progress.tmp && mv .eg/{instance-name}/progress.tmp .eg/{instance-name}/progress.json
```
## Step 4: Continue Until Complete
Repeat Step 3 for all tasks, respecting dependencies.
Update overall progress:
```
!jq '.completed_tasks += 1 | .current_phase = if .completed_tasks == .total_tasks then "completed" else "implementation" end' .eg/{instance-name}/progress.json > .eg/{instance-name}/progress.tmp && mv .eg/{instance-name}/progress.tmp .eg/{instance-name}/progress.json
```
## Step 5: Summary and Phase Gate
Once all tasks are complete, provide a summary:
- Total tasks implemented
- Commits created
- Any blockers encountered
- Implementation validation status
### Phase Gate - Approval Required
Present the implementation summary and ask for explicit approval:
"Implementation complete with {X} tasks implemented and validated. Ready to proceed to testing? (yes/no)"
Only suggest the next step after receiving "yes":
- If approved: "You can now test the implementation with: `/eg:test {instance-name} {feature-name}`"
- If not approved: "Please review the implementation and let me know what needs to be adjusted."