import type { SkillDefinition } from '../SkillRegistry'

export const batchParallelSkill: SkillDefinition = {
  name: 'batch-parallel',
  description: 'Decompose a complex task into independent subtasks, execute them in parallel via sub-agents, and consolidate results.',
  prompt: [
    '# Batch Parallel Task Execution',
    '',
    'You are orchestrating parallel execution of subtasks. Follow this process:',
    '',
    '## 1. Decomposition',
    '- Analyze the complex task and identify independent subtasks',
    '- Each subtask must be self-contained with no dependencies on other subtasks in the same batch',
    '- If subtasks have dependencies, structure them as sequential phases',
    '- Limit each parallel batch to 5-10 subtasks for effective parallelism',
    '',
    '## 2. Parallel Execution',
    '- Use `batch_parallel_task` to execute all subtasks in a batch concurrently',
    '- Set max_parallel=5 for optimal throughput',
    '- Each sub-agent gets its own isolated context window',
    '',
    '## 3. Consolidation',
    '- Review results from all sub-agents',
    '- Merge findings, eliminate duplicates',
    '- Present a unified summary',
    '- Flag any inconsistencies between sub-agent results',
    '',
    '## When to Use',
    '- Researching multiple independent files or APIs simultaneously',
    '- Generating tests for multiple independent modules',
    '- Reviewing code quality across multiple files',
    '- Implementing multiple independent features',
    '- Exploratory analysis of multiple subsystems',
    '',
    '## When NOT to Use',
    '- Subtasks have complex dependencies on each other',
    '- Tasks require shared state or sequential processing',
    '- The task is simple enough for a single agent',
  ].join('\n'),
  source: 'bundled',
  tags: ['parallel', 'batch', 'execution', 'orchestration'],
  aliases: ['parallel', 'batch', 'multi-task', 'bulk'],
  requiresConfirmation: false,
}
