Generate multiple UI design variations with Tailwind CSS and optional validation
Generate 1-5 Tailwind UI design variations from a brief, with optional automated validation for accessibility and performance.
/plugin marketplace add rryter/claude-plugins/plugin install ui-design@twy-marketplaceYou are tasked with creating 3 different UI design variations based on this brief:
Brief: {{arg}}
First, parse the brief for flags and variation count:
A. Check for Validation Flag:
--validate or -v is present: Set AUTO_VALIDATE=true and remove the flag from the briefAUTO_VALIDATE=false and prompt user laterB. Determine Variation Count:
--count=N, --variations=N, or -n N in the briefVARIATION_COUNT=N and remove the flag from the briefVARIATION_COUNT=2 (default)Examples:
"create a dashboard --validate --count=3" → Brief: "create a dashboard", AUTO_VALIDATE=true, VARIATION_COUNT=3"create a dashboard -n 4" → Brief: "create a dashboard", AUTO_VALIDATE=false, VARIATION_COUNT=4"create a dashboard" → Brief: "create a dashboard", AUTO_VALIDATE=false, VARIATION_COUNT=2 (default)First, analyze the brief and determine a consistent feature-name following these rules:
Feature Name: [feature-name]
Validate this name before proceeding. It will be used in all directory paths and must follow the rules above.
Then propose VARIATION_COUNT distinct design approaches. Consider:
Document your design variations clearly (repeat for each variation from 1 to VARIATION_COUNT):
Variation [N]: [Name]
Note: Ensure each variation is meaningfully different from the others. If VARIATION_COUNT=1, still provide a well-thought-out design approach.
Use the Task tool to launch VARIATION_COUNT general-purpose agents IN PARALLEL to implement each design variation.
CRITICAL: You MUST send a single message containing VARIATION_COUNT Task tool calls to run all agents simultaneously. Do NOT wait for one agent to complete before starting the next.
Examples:
Each agent should receive a prompt following this structure:
Implement UI Design Variation [1/2/3]: [Variation Name]
Context:
- Original Brief: {{arg}}
- Feature Name: [feature-name] ← USE THIS EXACT NAME in all file paths
- Design Approach:
- Concept: [concept from brainstorming]
- Layout: [layout pattern]
- Key Features: [key features list]
- Target Use Case: [best for scenario]
Implementation Requirements:
1. Create HTML and CSS in directory: ui-design/[feature-name]-variation-[1/2/3]/
2. Use Tailwind 4 via CDN: <script src="https://cdn.tailwindcss.com"></script>
3. Include inline Tailwind config if needed for custom colors/spacing
4. Make the component immediately viewable by opening the HTML file in a browser
5. Use semantic HTML elements (nav, main, article, aside, section, header, footer)
6. Include basic accessibility (alt text, ARIA labels for interactive elements, keyboard navigation)
7. **IMPORTANT:** Use the exact feature name specified above for the directory structure
File Structure (use this exact pattern):
- ui-design/[feature-name]-variation-[1/2/3]/
- index.html (main file - use a descriptive component name internally)
- styles.css (optional, only if custom CSS beyond Tailwind is needed)
- README.md (document design decisions, key features, and trade-offs)
Example: ui-design/dashboard-variation-1/index.html
Deliverable Requirements:
- Working HTML prototype with Tailwind 4 styling
- Include 8-12 items of realistic mock data (not Lorem ipsum)
- Show multiple states where applicable (empty, loading, populated, error)
- Responsive design considerations (mobile, tablet, desktop)
- Consider alignment with Spartan UI design principles where applicable
Deliverable:
A complete, immediately viewable HTML prototype that demonstrates the design variation.
All variations should use the SAME feature name, only the variation number differs.
Error Handling:
After all agents complete, create a comparison page and summary.
Create ui-design/[feature-name]-comparison.html that includes:
Note: Adapt the grid layout based on VARIATION_COUNT:
Create or update ui-design/INDEX.md with an entry for this design session:
## [Feature Name] - [YYYY-MM-DD]
**Brief:** [brief description]
**Variations:**
- [Variation 1 Name](./[feature-name]-variation-1/index.html) - [one-line description]
- [Variation 2 Name](./[feature-name]-variation-2/index.html) - [one-line description]
- [Variation 3 Name](./[feature-name]-variation-3/index.html) - [one-line description]
**Comparison:** [Link to comparison page](./[feature-name]-comparison.html)
**Recommendation:** [brief recommendation summary]
---
Provide a markdown summary comparing all VARIATION_COUNT variations with:
Trigger Conditions:
AUTO_VALIDATE=true: Skip prompt and proceed directly to validationAUTO_VALIDATE=false: Prompt the user with this message:All [VARIATION_COUNT] design variation(s) have been generated successfully!
Would you like to run automated validation using Playwright MCP?
This will:
- Capture screenshots at multiple breakpoints (desktop 1920px, tablet 768px, mobile 375px)
- Run accessibility audits using axe-core (WCAG 2.1 AA compliance)
- Measure performance metrics (load time, DOM size, resource count)
- Verify basic interactions (forms, buttons, navigation)
Run validation? (yes/no):
If user declines or Playwright MCP is not available:
If user accepts or AUTO_VALIDATE=true:
Check MCP Availability:
mcp__playwright or mcp__ prefixRun Validation Checks: For each variation (1 through VARIATION_COUNT), use Playwright MCP tool (if available) or create a Playwright script to:
a. Screenshot Capture:
ui-design/[feature-name]-variation-[N]/index.html in browserui-design/[feature-name]-variation-[N]/screenshots/b. Accessibility Audit:
ui-design/[feature-name]-variation-[N]/a11y-report.jsonc. Performance Metrics:
ui-design/[feature-name]-variation-[N]/performance.jsond. Basic Interaction Tests:
Generate Validation Report:
Create ui-design/[feature-name]-validation-report.html with:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Validation Report: [Feature Name]</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50 p-8">
<div class="max-w-7xl mx-auto">
<h1 class="text-3xl font-bold mb-6">
Validation Report: [Feature Name]
</h1>
<!-- Summary Dashboard -->
<div
class="grid grid-cols-1 md:grid-cols-[repeat(auto-fit,minmax(250px,1fr))] gap-6 mb-8"
>
<!-- Per-variation summary cards with pass/fail metrics (one for each VARIATION_COUNT) -->
</div>
<!-- Detailed Results per Variation -->
<div class="space-y-8">
<!-- Repeat this section for each variation (1 through VARIATION_COUNT) -->
<section class="bg-white rounded-lg shadow p-6">
<h2>Variation [N]: [Name]</h2>
<!-- Screenshots Gallery -->
<div class="grid grid-cols-3 gap-4 my-4">
<img
src="[feature-name]-variation-[N]/screenshots/desktop.png"
/>
<img src="[feature-name]-variation-[N]/screenshots/tablet.png" />
<img src="[feature-name]-variation-[N]/screenshots/mobile.png" />
</div>
<!-- Accessibility Results -->
<div class="my-4">
<h3>Accessibility Audit</h3>
<ul>
<!-- List violations -->
</ul>
</div>
<!-- Performance Metrics -->
<div class="my-4">
<h3>Performance</h3>
<table>
<!-- Metrics table -->
</table>
</div>
<!-- Interaction Tests -->
<div class="my-4">
<h3>Interaction Tests</h3>
<ul>
<!-- Test results -->
</ul>
</div>
</section>
</div>
<!-- Comparison Matrix -->
<section class="bg-white rounded-lg shadow p-6 mt-8">
<h2>Comparison Matrix</h2>
<table class="w-full">
<thead>
<tr>
<th>Metric</th>
<!-- Add one <th> for each variation (1 through VARIATION_COUNT) -->
<th>Variation 1</th>
<!-- ... Variation 2, 3, etc. as needed ... -->
</tr>
</thead>
<tbody>
<tr>
<td>A11y Score</td>
<!-- Add <td> for each variation --><!-- Scores -->
</tr>
<tr>
<td>Load Time</td>
<!-- Add <td> for each variation --><!-- Times -->
</tr>
<tr>
<td>DOM Nodes</td>
<!-- Add <td> for each variation --><!-- Counts -->
</tr>
<tr>
<td>Interactions</td>
<!-- Add <td> for each variation --><!-- Pass/Fail -->
</tr>
</tbody>
</table>
</section>
<!-- Recommendations -->
<section class="bg-blue-50 rounded-lg p-6 mt-8">
<h2>Recommendations</h2>
<ul>
<!-- Based on validation results -->
</ul>
</section>
</div>
</body>
</html>
Analyze Results & Offer Adjustments:
Critical Issues Detected:
If ANY critical issues found:
Validation found critical issues in [list affected variations]:
- [List specific issues]
Would you like me to automatically fix these issues and regenerate the affected variation(s)? (yes/no):
If user agrees:
If user declines or no critical issues:
Update Comparison Page:
Provide the user with:
File Paths: Absolute paths to all generated files
ui-design/[feature-name]-variation-1/index.htmlui-design/[feature-name]-variation-2/index.htmlui-design/[feature-name]-variation-3/index.htmlui-design/[feature-name]-comparison.htmlui-design/[feature-name]-validation-report.htmlViewing Instructions:
# Open comparison page to view all 3 variations side-by-side
open ui-design/[feature-name]-comparison.html
# If validation was run, view the detailed validation report
open ui-design/[feature-name]-validation-report.html
# Or open individual variations
open ui-design/[feature-name]-variation-1/index.html
Validation Summary (if validation was run):
Next Steps Suggestions:
/ui-design [feature-name] --validate on existing designs/ui-design [refined-brief focusing on chosen variation]Design Catalog: Link to ui-design/INDEX.md to view all past design sessions
/ui-design "create a user profile editor"
/ui-design "create a dashboard --count=4"
/ui-design "create a kanban board -n 3"
/ui-design "create a single landing page hero --variations=1"
/ui-design "create a login form --validate"
/ui-design "create a checkout flow --count=3 --validate"
/ui-design "create a settings page -n 2 -v"
/ui-design "create a data table --count=5 --validate"
/ui-design "create an analytics dashboard -n 4 -v"
Flag Reference:
--count=N, --variations=N, -n N: Number of variations (1-5, default: 2)--validate, -v: Auto-run Playwright validation after generation