Task Implementation Agent

SkillProductivity

Implements one task in an isolated git worktree following TDD. Creates commits for implementation and fixes, invokes independent verification.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Task Implementation Agent skill

What this skill tells your AI

The instructions your AI receives, as published by vinzenz/prd-breakdown-execute in .claude/skills/execute-task/SKILL.md and read by ahel’s review.

You implement a single task from a breakdown-generated XML file in an isolated git worktree. Your goal is to produce working code that passes independent verification.

Input Arguments

The orchestrator provides these arguments (parse from the prompt):

ArgumentRequiredDescription
--task-file <path>YesAbsolute path to task XML file
--project-path <path>YesMain project path (where main branch lives)
--worktree-dir <path>YesDirectory for worktrees
--attempt <N>NoCurrent attempt number (default: 1)
--worktree-path <path>NoExisting worktree to reuse (for retries)
--retry-feedback <json>NoPrevious failure feedback JSON

Execution Flow

Step 1: Parse Task XML

Read the task file and extract all sections:

<task>
  <meta><id>L1-001</id><name>Create enums</name><layer>1-foundation</layer></meta>
  <context>...</context>
  <dependencies>...</dependencies>
  <objective>...</objective>
  <requirements>...</requirements>
  <test-requirements>...</test-requirements>
  <files-to-create>...</files-to-create>
  <verification>...</verification>
  <exports>...</exports>
</task>

Extract and store:

  • task_id: From <meta><id>
  • task_name: From <meta><name>
  • layer: From <meta><layer>
  • objective: What you're implementing
  • requirements: List of requirements with IDs
  • test_requirements: Test cases to implement first
  • files_to_create: Files to create/modify
  • dependencies: Interface contracts to follow
  • verification: Commands to verify implementation

Step 2: Setup Worktree

If attempt == 1 (first attempt):

Create a new worktree from main:

cd {project_path}
git fetch origin main
git checkout main
git pull origin main
git checkout -b worktree-{task_id}
git worktree add {worktree_dir}/{task_id} worktree-{task_id}
git checkout main

Set worktree_path = {worktree_dir}/{task_id}

If attempt > 1 (retry):

Use the existing worktree provided via --worktree-path. The worktree already has previous implementation attempts.

cd {worktree_path}
git status  # Verify we're in the right worktree

Step 3: Handle Retry Context

If --retry-feedback is provided, parse the JSON and understand what failed:

{
  "attempt": 2,
  "previous_error": {
    "type": "verification_failed",
    "step": "pytest tests/models/test_enums.py -v",
    "error": "test_enum_from_string failed: ValueError on empty input",
    "actionable_fix": "Add empty string check in ProjectStatus.from_string()"
  }
}

CRITICAL: Address the specific failure. Do NOT repeat the same mistake.

Step 4: Implement with TDD

4a. Write Tests First (attempt 1 only)

Read <test-requirements> and create test files:

  1. Create test file at path from <files-to-create>
  2. Implement each test case with concrete values
  3. Use exact assertions from spec
  4. Do NOT run tests yet - proceed to implementation

Example from spec:

<test id="1">
Test: test_project_status_values
- Assert ProjectStatus.draft.value == "draft"
- Assert ProjectStatus.in_progress.value == "in_progress"
- Assert ProjectStatus.complete.value == "complete"
</test>
4b. Implement Requirements

Read <requirements> and implement each one:

  1. Create files listed in <files-to-create>
  2. Follow interface contracts from <dependencies> exactly
  3. Implement each requirement by ID order
  4. Use exact types, names, and values from spec

Quality Rules:

  • NO placeholders: No "TODO", "TBD", "...", or "implement later"
  • NO scope creep: Only implement what's in the spec
  • NO guessing: Use exact names/types from XML

Step 5: Run Local Verification

Before requesting independent verification, do a quick local check:

cd {worktree_path}
# Run the test command from <verification>
pytest tests/... -v  # or whatever the verification specifies

If tests fail, fix the issues immediately before proceeding.

Step 6: Create Git Commit

For attempt 1 (implementation):

cd {worktree_path}
git add .
git commit -m "$(cat <<'EOF'
[{task_id}] {task_name}

Implements:
{list of requirements implemented}

Files:
{list of files created}

Task: {task_id}
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
EOF
)"

For attempt > 1 (fix):

cd {worktree_path}
git add .
git commit -m "$(cat <<'EOF'
[{task_id}] Fix: {brief description of fix}

Previous failure:
- {error from retry_feedback}

Fix applied:
- {what you changed to fix it}

Attempt: {attempt}/5
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
EOF
)"

Step 7: Request Independent Verification

Invoke the /execute-verify skill for independent verification:

/execute-verify --task-file {task_file} --worktree-path {worktree_path}

The verify skill uses Haiku and runs verification commands independently.

Step 8: Handle Verification Result

If verification PASSES:

Return success result:

{
  "task_id": "L1-001",
  "status": "verified",
  "attempt": 1,
  "worktree_path": "/path/.worktrees/L1-001",
  "branch": "worktree-L1-001",
  "commit_hash": "abc1234",
  "commit_type": "implementation",
  "files_created": ["app/models/enums.py", "tests/models/test_enums.py"],
  "verification_summary": "3/3 steps passed"
}

If verification FAILS and attempt < 5:

  1. Parse the actionable feedback from verification result
  2. Fix the specific issue in the worktree
  3. Create a fix commit (see Step 6)
  4. Request verification again (repeat Steps 5-8)
  5. Track attempt count - max 5 attempts total

If verification FAILS and attempt >= 5:

Return abandoned result:

{
  "task_id": "L1-001",
  "status": "abandoned",
  "attempt": 5,
  "worktree_path": "/path/.worktrees/L1-001",
  "branch": "worktree-L1-001",
  "commits": [
    {"hash": "abc1234", "type": "implementation", "attempt": 1},
    {"hash": "def5678", "type": "fix", "attempt": 2},
    {"hash": "ghi9012", "type": "fix", "attempt": 3},
    {"hash": "jkl3456", "type": "fix", "attempt": 4},
    {"hash": "mno7890", "type": "fix", "attempt": 5}
  ],
  "final_error": {
    "type": "verification_failed",
    "step": "pytest...",
    "error": "Still failing after 5 attempts"
  },
  "worktree_preserved": true
}

IMPORTANT: Never delete the worktree. It must be preserved for debugging.

Constraints

  1. Stay in worktree: All edits happen in the worktree directory, never in main project
  2. Only specified files: Only create/modify files listed in <files-to-create>
  3. Follow spec exactly: Use exact names, types, values from XML
  4. Interface contracts: Dependencies are type signatures - implement exactly
  5. No scope creep: Don't add features not in the spec
  6. Self-contained: All context is in the XML, don't look elsewhere
  7. Preserve worktree: Never delete worktree, even on failure

Error Recovery

If you encounter a blocker that prevents implementation:

  1. Document the specific issue with file path and line number
  2. Include full error message
  3. Do NOT leave partial/broken implementation
  4. Return error status with details:
{
  "task_id": "L1-001",
  "status": "error",
  "error_type": "blocker",
  "error": "Dependency interface not found: Base class missing from app/models/__init__.py",
  "worktree_path": "/path/.worktrees/L1-001",
  "worktree_preserved": true
}

Output Format

Always end with a JSON result block:

RESULT:
{json object}

The orchestrator parses this to update state and decide next steps.

Signals

GitHub stars
56
Forks
3
Last commit
Jan 2026
Advanced
Catalog kind
skill
Gateway key
execute-task-vinzenz
Source
github.com/vinzenz/prd-breakdown-execute