| name | design-swarm |
|---|---|
| description | Orchestrate a multi-agent swarm that analyzes a codebase for UI elements, then draws them in Paper.design using the Prowl design system. Use when the user wants to render codebase UI into a Paper canvas — tables, forms, dashboards, pages, or any visual element group. Triggered by phrases like "draw the UI in Paper", "render components in Paper", "design swarm", or "recreate the app in Paper". |
You are a swarm orchestrator. Your mission: analyze a codebase to find a category of UI elements, then coordinate parallel agents to draw them in Paper.design matching the Prowl Storybook design system.
The user invokes this as /design-swarm <instructions> where <instructions> describes:
- What to find — the type of UI elements to extract (tables, forms, dashboards, pages, etc.)
- Where to find them — a codebase path or repo to analyze
- Where to draw — a Paper.design file URL and target page/section
- Design system reference — defaults to the Prowl Storybook design system in this repo; user may specify otherwise
If any of these are missing, ask the user before proceeding.
Spawn a single Code Analyst Agent to produce a structured JSON manifest.
Analyze
<codebase path>and produce a JSON manifest of every<element type>found.For each element, capture:
id: unique slug (e.g.,dashboard-overview-table)route: file path or route where it appearscomponentName: React component namegroup: logical grouping (e.g., "dashboard", "settings", "pricing")columns/fields/sections: structural details (schema depends on element type)variants: responsive or conditional variants (desktop, mobile, empty state, loading)interactivity: sorting, pagination, filters, row actions, expand/collapse, drag, etc.designTokens: colors, spacing, typography tokens referenceddependencies: other components this element composesOutput format:
{ "elementType": "<type>", "elements": [...], "groups": { "<name>": ["<id>", ...] }, "tokenSummary": {...} }
- Count elements. This determines parallelism.
- Identify groups. Each group becomes one Section Agent's workload.
- If a group has > 6 elements, split it into sub-groups of ~4.
Before spawning drawing agents, load the design system reference:
- Invoke the prowl-storybook skill (or call
list-all-documentation/get-documentationon the PROWL-DESIGN-SYSTEM MCP) to get the prop API, variants, and tokens for any components the manifest references (Table, Badge, Tag, Button, etc.). - Produce a Style Brief — a compact cheat sheet for Section Agents containing:
- Color tokens and CSS custom properties to use
- Typography scale (font sizes, weights, line heights)
- Spacing scale
- Border radii and shadows
- Component-specific notes (e.g., "Table uses
--table-header-bgfor header background")
This brief is included in every Section Agent's prompt so they draw consistently without needing to re-query the design system.
Before spawning Section Agents:
- Call
get_basic_infoon the Paper file to understand the current canvas state. - Call
get_tree_summaryon the target page to see existing content. - For each group, call
find_empty_space_on_canvasor calculate non-overlapping coordinates. - Pre-allocate artboard positions: record
{ groupId, x, y, width, height }for each. - Optionally
create_artboardfor each group upfront, or let Section Agents create them.
Critical rule: No two agents may edit overlapping node trees. Pre-allocation prevents collisions.
Spawn one Section Agent per group. Run up to 8 in parallel (scale down to 3-4 if context is getting large).
You are a Section Agent drawing
<element type>for the group: .Paper file:
<url>Your assigned area: artboard at (x:<x>, y:<y>, w:<w>, h:<h>) — or create an artboard named<group name>at these coordinates.Elements to draw (from manifest):
<filtered manifest slice for this group>Style Brief:
<style brief from Phase 2>Workflow:
- Read the Paper MCP guide:
get_guide({ topic: "paper-mcp-instructions" })- Call
get_basic_infoto orient yourself on the canvas- For each element in your manifest slice: a. Build the HTML using the style brief's tokens and the component patterns b. Call
write_htmlto render it into your assigned artboard c. Callget_screenshotto verify it looks correct d. If misaligned or wrong, callupdate_styles/set_text_contentto fix- When all elements are drawn and verified, call
finish_working_on_nodes- Report back: list of element IDs completed, any issues encountered
Rules:
- Stay within your assigned coordinates. Do not create nodes outside your area.
- Use design tokens (CSS custom properties), not hardcoded hex values.
- Match the Prowl design system — refer to the style brief for exact values.
- Take a screenshot after each major element to catch layout issues early.
| Manifest size | Parallel agents | Notes |
|---|---|---|
| 1–4 elements | 1–2 agents | Small job, minimal parallelism |
| 5–12 elements | 3–6 agents | One agent per group |
| 13+ elements | Up to 8 agents | Split large groups; cap at 8 |
Use the Agent tool with run_in_background: true for all Section Agents so they execute concurrently.
While Section Agents run:
- Track completions as agents return results
- Output a progress update after each agent completes:
Progress: X/Y elements drawn | Agents: Z active | Groups done: [list] - If an agent fails, apply the error recovery rules (see below)
After all Section Agents complete, spawn a single QA Agent:
Review the Paper canvas at
<url>.Checklist:
- Call
get_tree_summaryto see all nodes created by the swarm- Call
get_screenshoton each artboard / section to visually inspect- Check for:
- Consistent spacing between elements
- Correct typography hierarchy
- Token usage (no hardcoded colors)
- Alignment within and across artboards
- Missing elements (compare against manifest)
- Overlapping or clipped content
- Fix minor issues directly via
update_styles/set_text_content- Flag major issues for the user
- Call
finish_working_on_nodeswhen done- Report: summary of fixes applied, any flagged issues, final screenshot of each section
These rules apply to any agent in the swarm:
| Condition | Action |
|---|---|
| Agent timeout or MCP error | Re-spawn with the same prompt + latest canvas state. Retry up to 3 times. |
| Agent returns partial results | Spawn a new agent for the remaining elements only. |
| 3 consecutive failures on same task | Pause the swarm. Report to user with error details + screenshots. Wait for manual instruction. |
| Node collision detected | Immediately stop the conflicting agent. Re-assign with corrected coordinates. |
- Lock protocol: Every agent that writes to the canvas must call
start_working_on_nodes(or the Paper equivalent) before its first write, andfinish_working_on_nodeswhen done. - No overlapping trees: Agents are assigned non-overlapping regions. If an agent needs to reference another agent's work, it reads via
get_screenshot— never by editing shared nodes. - Sequential fallback: If the design tool doesn't support concurrent edits well, downgrade to 2 agents at a time.
When the swarm completes, report to the user:
- Summary table: element name, group, status (drawn / skipped / failed), artboard ID
- Link to the Paper canvas
- Screenshots of each completed section (inline via Read tool if available)
- Issues log: anything the QA agent flagged or couldn't auto-fix
- Manifest diff: any elements in the codebase that were intentionally skipped and why
This skill is generic. The user controls specificity via their /design-swarm arguments:
| What the user says | What changes |
|---|---|
| "draw all the tables" | Element type = tables; manifest captures columns, sorting, etc. |
| "recreate the dashboard pages" | Element type = pages; manifest captures layout, widgets, routes |
| "render the form components" | Element type = forms; manifest captures fields, validation, submit actions |
| "draw everything" | Full UI audit; manifest covers all visual elements; more groups, more agents |
The Phase 1 Code Analyst adapts its extraction logic based on the element type. The Phase 4 Section Agents adapt their HTML generation based on what they're drawing.