$npx -y skills add am-will/swarms --skill co-designOnly to be triggered by explicit /co-design commands. Parallel task executor that routes frontend/design tasks to Claude CLI print mode for superior design output.
| 1 | # Co-Design: Parallel Task Executor with Design-Mode Routing |
| 2 | |
| 3 | You are an Orchestrator for subagents. Use orchestration mode to parse plan files and delegate tasks to parallel subagents using task dependencies, in a loop, until all tasks are completed. |
| 4 | |
| 5 | **Key difference from standard parallel-task**: When a task involves **frontend design, styling, UI, or visual work**, you launch it via `claude -p` (print mode) in a background shell instead of using the Task tool. This gives the design agent full CLI capabilities and tool access. All other tasks use normal Task tool subagents. |
| 6 | |
| 7 | ## Task Classification |
| 8 | |
| 9 | Before launching each task, classify it as **design** or **standard**: |
| 10 | |
| 11 | ### Design Tasks (route to `claude -p`) |
| 12 | A task is a **design task** if it primarily involves ANY of: |
| 13 | - CSS, SCSS, Tailwind, or any styling |
| 14 | - HTML structure/templates for UI |
| 15 | - React/Vue/Svelte/Angular component **markup and styling** |
| 16 | - Layout, responsive design, grid, flexbox |
| 17 | - Design tokens, theme files, color schemes |
| 18 | - UI component creation (buttons, cards, modals, navbars, etc.) |
| 19 | - Animation, transitions, visual effects |
| 20 | - Accessibility (a11y) related to visual presentation |
| 21 | - Asset management (icons, images, fonts) |
| 22 | - Design system implementation |
| 23 | |
| 24 | ### Standard Tasks (route to Task tool subagent) |
| 25 | Everything else: |
| 26 | - Backend logic, API endpoints, database |
| 27 | - Business logic, services, utilities |
| 28 | - Configuration, tooling, CI/CD |
| 29 | - Testing (unless it's visual/snapshot testing) |
| 30 | - State management, data fetching |
| 31 | - Authentication, authorization |
| 32 | |
| 33 | **When in doubt**: If a task mixes both (e.g., "create a form with validation"), route it as a **design task** since it has a UI component. |
| 34 | |
| 35 | ## Process |
| 36 | |
| 37 | ### Step 1: Parse Request |
| 38 | |
| 39 | Extract from user request: |
| 40 | 1. **Plan file**: The markdown plan to read |
| 41 | 2. **Task subset** (optional): Specific task IDs to run |
| 42 | |
| 43 | If no subset provided, run the full plan. |
| 44 | |
| 45 | ### Step 2: Read & Parse Plan |
| 46 | |
| 47 | 1. Find task subsections (e.g., `### T1:` or `### Task 1.1:`) |
| 48 | 2. For each task, extract: |
| 49 | - Task ID and name |
| 50 | - **depends_on** list (from `- **depends_on**: [...]`) |
| 51 | - Full content (description, location, acceptance criteria, validation) |
| 52 | 3. Build task list |
| 53 | 4. **Classify each task** as `design` or `standard` based on the rules above |
| 54 | 5. If a task subset was requested, filter the task list to only those IDs and their required dependencies. |
| 55 | |
| 56 | ### Step 3: Launch Tasks |
| 57 | |
| 58 | For each **unblocked** task, launch it based on its classification: |
| 59 | |
| 60 | #### For STANDARD tasks → Use Task tool subagent |
| 61 | |
| 62 | Launch with: |
| 63 | - **description**: "Implement task [ID]: [name]" |
| 64 | - **prompt**: Use the Task Prompt Template below |
| 65 | - **subagent_type**: "parallel" |
| 66 | |
| 67 | #### For DESIGN tasks → Use `claude -p` in background shell |
| 68 | |
| 69 | Construct the exact same prompt you would give a subagent, then launch via Bash: |
| 70 | |
| 71 | ```bash |
| 72 | claude -p "YOUR_PROMPT_HERE" \ |
| 73 | --allowedTools "Bash,Read,Edit,Write,Glob,Grep,WebFetch,WebSearch" \ |
| 74 | --max-turns 50 \ |
| 75 | --output-format text \ |
| 76 | > /tmp/co-design-[TASK_ID]-output.log 2>&1 & |
| 77 | ``` |
| 78 | |
| 79 | **CRITICAL rules for design task launch:** |
| 80 | 1. The prompt content must be IDENTICAL to what you'd give a Task tool subagent (use the same Task Prompt Template) |
| 81 | 2. Escape the prompt properly for shell execution - use a heredoc approach: |
| 82 | ```bash |
| 83 | claude -p "$(cat <<'PROMPT_EOF' |
| 84 | [full prompt content here] |
| 85 | PROMPT_EOF |
| 86 | )" \ |
| 87 | --allowedTools "Bash,Read,Edit,Write,Glob,Grep,WebFetch,WebSearch" \ |
| 88 | --max-turns 50 \ |
| 89 | --output-format text \ |
| 90 | > /tmp/co-design-[TASK_ID]-output.log 2>&1 & |
| 91 | ``` |
| 92 | 3. Log output to `/tmp/co-design-[TASK_ID]-output.log` for later inspection |
| 93 | 4. Track the background PID so you can check completion |
| 94 | 5. Launch ALL unblocked design tasks in parallel (multiple background shells) |
| 95 | |
| 96 | Launch all unblocked tasks (both types) in parallel. A task is unblocked if all IDs in its depends_on list are complete. |
| 97 | |
| 98 | ### Task Prompt Template |
| 99 | |
| 100 | Use this for BOTH standard subagents AND design-mode `claude -p` tasks: |
| 101 | |
| 102 | ``` |
| 103 | You are implementing a specific task from a development plan. |
| 104 | |
| 105 | ## Context |
| 106 | - Plan: [filename] |
| 107 | - Goals: [relevant overview from plan] |
| 108 | - Dependencies: [prerequisites for this task] |
| 109 | - Related tasks: [tasks that depend on or are depended on by this task] |
| 110 | - Constraints: [risks from plan] |
| 111 | |
| 112 | ## Your Task |
| 113 | **Task [ID]: [Name]** |
| 114 | |
| 115 | Location: [File paths] |
| 116 | Description: [Full description] |
| 117 | |
| 118 | Acceptance Criteria: |
| 119 | [List from plan] |
| 120 | |
| 121 | Validation: |
| 122 | [Tests or verification from plan] |
| 123 | |
| 124 | ## Instructions |
| 125 | 1. Read the working plan and fully understand this task before coding. |
| 126 | 2. Read all relevant files first, then do targeted codebase research (related modules, tests, call sites, and dependencies) to confirm the approach. |
| 127 | 3. Default to TDD RED phase first using a `tdd_test_writer` subagent: |
| 128 | - Pass task context and acceptance criteria. |
| 129 | - Require tests-only edits. |