Claude
Skills
Sign in
Back

task-coordination

Included with Lifetime
$97 forever

Coordinate work across multiple agents using memory and Task tool for clean context and parallel execution

Productivity

What this skill does


# Task Coordination Skill

## Purpose
Break work into small tasks, execute each in a **clean subagent** using the Task tool, and use **memory as the coordination layer** to track progress and enable parallel execution.

## Critical Architecture Principles

### 1. ✅ Clean Context Per Task
**Each task runs in a fresh subagent with minimal context:**
- Use Task tool to spawn clean agent
- Agent loads ONLY what it needs from memory
- No large context passed in prompts
- Context window stays small and efficient

### 2. ✅ Memory as Coordination Layer
**Memory is the single source of truth:**
- Task status tracked in memory
- Results saved to memory immediately
- Next agent loads from memory, not from previous agent
- Enables pause/resume of work

### 3. ✅ Parallel Execution
**Run multiple subagents simultaneously:**
- Independent tasks run in parallel
- Use single message with multiple Task tool calls
- Each subagent works on different task
- All save to memory when complete

### 4. ✅ Verification Loop with Task Tracking
**If user stops to correct:**
- Save current task status to memory
- Fix the issue
- Load pending tasks from memory
- Continue with remaining tasks

## Task Lifecycle

### 1. Break Work into Tasks
```javascript
// High-level agent breaks work into tasks
const tasks = [
  {
    id: 'task_001',
    name: 'Plan feature structure',
    agent: 'work-planner-agent',
    dependencies: [],
    status: 'pending',
    context_needed: {
      feature_name: 'inventory',
      requirements: 'CRUD for products'
    }
  },
  {
    id: 'task_002',
    name: 'Implement backend API',
    agent: 'dotnet-engineer-agent',
    dependencies: ['task_001'], // Needs planning complete
    status: 'pending',
    context_needed: {
      service: 'inventory',
      load_from_memory: ['feature_plan', 'architectural_decisions']
    }
  },
  {
    id: 'task_003',
    name: 'Implement frontend UI',
    agent: 'ui-engineer-agent',
    dependencies: ['task_001'], // Needs planning, NOT backend (can run parallel)
    status: 'pending',
    context_needed: {
      service: 'inventory',
      load_from_memory: ['feature_plan', 'component_patterns']
    }
  },
  {
    id: 'task_004',
    name: 'QA backend',
    agent: 'qa-backend-engineer',
    dependencies: ['task_002'], // Needs backend complete
    status: 'pending',
    context_needed: {
      service: 'inventory',
      load_from_memory: ['service_api_info']
    }
  },
  {
    id: 'task_005',
    name: 'QA frontend',
    agent: 'qa-frontend-engineer',
    dependencies: ['task_003'], // Needs frontend complete
    status: 'pending',
    context_needed: {
      service: 'inventory',
      load_from_memory: ['service_ui_info', 'docker_ips']
    }
  },
  {
    id: 'task_006',
    name: 'Verify complete',
    agent: 'verification-agent',
    dependencies: ['task_004', 'task_005'], // Needs both QA complete
    status: 'pending',
    context_needed: {
      service: 'inventory',
      load_from_memory: ['qa_results_backend', 'qa_results_frontend']
    }
  }
]

// Save to memory
memory_save_task_list({
  feature: 'inventory_management',
  tasks: tasks,
  created: new Date().toISOString()
})
```

### 2. Execute Tasks in Parallel
```javascript
// Get tasks ready to run (dependencies met)
const readyTasks = tasks.filter(t =>
  t.status === 'pending' &&
  t.dependencies.every(dep => isComplete(dep))
)

// Launch all ready tasks in PARALLEL using single message with multiple Task calls
// IMPORTANT: Use single message to launch all parallel tasks

if (readyTasks.length > 0) {
  console.log(`Launching ${readyTasks.length} tasks in parallel:`)
  readyTasks.forEach(task => {
    console.log(`- ${task.name} (${task.agent})`)
  })

  // Update status before launch
  readyTasks.forEach(task => {
    memory_update_task(task.id, {
      status: 'running',
      started: new Date().toISOString()
    })
  })

  // Launch ALL in single message (see example below)
}
```

**Example Parallel Launch:**
```
I'm launching 2 tasks in parallel:
- Task 002: Implement backend API (dotnet-engineer-agent)
- Task 003: Implement frontend UI (ui-engineer-agent)

[Use Task tool twice in SAME MESSAGE]

Task 1:
Use the dotnet-engineer-agent to:
1. Load feature plan from memory: memory_get_feature('inventory_management')
2. Load architectural decisions from memory: memory_get_decisions()
3. Implement inventory API with CRUD endpoints
4. Save API details to memory when complete
5. Mark task_002 as complete in memory

Context to load from memory:
- Feature plan: inventory_management
- Service: inventory
- Load only what's needed for backend

Task 2:
Use the ui-engineer-agent to:
1. Load feature plan from memory: memory_get_feature('inventory_management')
2. Load component patterns from memory: memory_get_component_patterns()
3. Implement inventory UI with CRUD interface
4. Save UI details to memory when complete
5. Mark task_003 as complete in memory

Context to load from memory:
- Feature plan: inventory_management
- Service: inventory
- Load only what's needed for frontend
```

### 3. Each Subagent Works with Minimal Context
```javascript
// Inside dotnet-engineer-agent subagent (clean context)

// Step 1: Load ONLY what I need from memory
const featurePlan = memory_get_feature('inventory_management')
const decisions = memory_get_decisions()
const existingService = memory_get_service('inventory')

// Step 2: Do the work
// ... implement API ...

// Step 3: Save results to memory
memory_save_service({
  name: 'inventory',
  api: {
    endpoints: [...],
    database: 'stylemate_inventory',
    // ... other details
  }
})

// Step 4: Mark task complete
memory_update_task('task_002', {
  status: 'completed',
  completed: new Date().toISOString(),
  results: {
    endpoints_created: 5,
    tests_passing: true
  }
})

// Return summary (not full details, those are in memory)
return "✅ Task 002 complete: Inventory API created with 5 endpoints. Details saved to memory."
```

### 4. Verification Loop with Pause/Resume
```javascript
// User interrupts: "Wait, the database schema needs a 'sku' field"

// Current state in memory:
// task_002: completed ✅
// task_003: running 🔄
// task_004: pending ⏸️
// task_005: pending ⏸️
// task_006: pending ⏸️

// Handle interruption:
console.log('User correction requested. Current state:')
const tasks = memory_get_task_list('inventory_management')
tasks.forEach(t => console.log(`${t.id}: ${t.status}`))

// Fix the issue
console.log('Fixing database schema...')
// ... add 'sku' field ...
memory_update_service('inventory', {
  api: {
    database_schema: {
      products: {
        columns: [..., 'sku: string']
      }
    }
  }
})

// Mark task as needs re-test
memory_update_task('task_002', {
  status: 'needs_retest',
  correction: 'Added sku field to schema'
})

// Continue with pending tasks
const pendingTasks = tasks.filter(t => t.status === 'pending')
console.log(`Continuing with ${pendingTasks.length} pending tasks...`)
// ... launch next batch ...
```

## Task Tracking Schema

### Task Schema
```typescript
interface Task {
  id: string                    // task_001, task_002, etc.
  name: string                  // Human-readable task name
  agent: string                 // Which agent executes this
  dependencies: string[]        // Task IDs that must complete first
  status: 'pending' | 'running' | 'completed' | 'failed' | 'needs_retest'
  context_needed: {
    [key: string]: any         // Minimal context needed
    load_from_memory: string[] // What to load from memory
  }
  created: string               // ISO timestamp
  started?: string              // When execution started
  completed?: string            // When execution finished
  results?: any                 // Summary results (details in memory)
  error?: string                // Error if failed
  correction?: string           // If needs_retest, what was fixed
}

interface TaskList {
  feature: string               // Feature name
  tasks: Task[]                

Related in Productivity