Create and refactor HTML5/JavaScript web designs from specifications or descriptions. Generates complete, accessible, responsive web designs with modern frameworks...
This skill creates professional HTML5/JavaScript web designs from specifications, with automatic accessibility and functionality verification using Playwright MCP.
Activate this skill when the user requests:
When a user requests a web design, start by understanding their needs:
Clarify the Design Scope
Technical Preferences
Check Playwright MCP Availability
IMPORTANT: Before starting the design process, check if Playwright MCP is available:
// Check if mcp__playwright tools are available
// Look for tools like: mcp__playwright__navigate, mcp__playwright__screenshot, etc.
If Playwright MCP is NOT available:
If Playwright MCP IS available:
Generate a complete HTML/CSS/JS mockup including:
HTML Structure:
CSS Styling:
JavaScript Functionality:
Accessibility Features:
Example Output Structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
<style>
/* Modern CSS with custom properties */
:root {
--primary-color: #0066cc;
--text-color: #1a1a1a;
--bg-color: #ffffff;
--spacing: 1rem;
}
/* Reset and base styles */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
line-height: 1.6;
color: var(--text-color);
background: var(--bg-color);
}
/* Responsive layout */
@media (max-width: 768px) {
/* Mobile styles */
}
</style>
</head>
<body>
<!-- Accessible skip link -->
<a href="#main-content" class="skip-link">Skip to main content</a>
<!-- Semantic structure -->
<header role="banner">
<nav aria-label="Main navigation">
<!-- Navigation -->
</nav>
</header>
<main id="main-content" role="main">
<!-- Main content -->
</main>
<footer role="contentinfo">
<!-- Footer -->
</footer>
<script>
// Progressive enhancement JavaScript
(function() {
'use strict';
// Feature detection
if (!('querySelector' in document)) return;
// Your JavaScript here
})();
</script>
</body>
</html>
Save the generated design to a file:
// Recommended file structure
project-name/
index.html // Main HTML file
styles.css // Separate CSS (if needed)
script.js // Separate JS (if needed)
assets/
images/ // Image assets
fonts/ // Custom fonts
Use the Write tool to create the file:
landing-page.html, dashboard.html)IMPORTANT: Only execute this phase if Playwright MCP was detected in Phase 1.
Use Playwright MCP to open the design:
// Navigate to the local HTML file
await mcp__playwright__navigate({
url: 'file:///path/to/design.html'
});
Run comprehensive accessibility checks:
Automated Accessibility Scan
Keyboard Navigation Test
Screen Reader Compatibility
Capture screenshots and verify layout:
// Take full-page screenshot
await mcp__playwright__screenshot({
fullPage: true,
path: 'design-screenshot.png'
});
// Test responsive breakpoints
const breakpoints = [
{ width: 375, height: 667, name: 'mobile' },
{ width: 768, height: 1024, name: 'tablet' },
{ width: 1440, height: 900, name: 'desktop' }
];
for (const bp of breakpoints) {
await mcp__playwright__setViewportSize({
width: bp.width,
height: bp.height
});
await mcp__playwright__screenshot({
path: `design-${bp.name}.png`
});
}
Test interactive elements:
Form Validation
Interactive Components
JavaScript Functionality
Evaluate performance metrics:
Load Time
Resource Optimization
Generate a comprehensive report:
# Design Verification Report
## Overview
- **Design Type**: [Landing Page / Dashboard / etc.]
- **Framework**: [Vanilla / Tailwind / React / etc.]
- **Verification Date**: [Date]
- **Playwright MCP**: [Available / Not Available]
## Accessibility Compliance
### WCAG 2.1 Level AA
β
**PASSED**: Color contrast (4.5:1 minimum)
β
**PASSED**: Keyboard navigation
β
**PASSED**: Semantic HTML structure
β οΈ **WARNING**: Missing alt text on 2 images
β **FAILED**: Form missing associated labels
### Issues Found
1. **HIGH**: Form input #email missing label
- Location: Line 45
- Fix: Add `<label for="email">Email</label>`
2. **MEDIUM**: Image missing alt text
- Location: Line 78
- Fix: Add `alt="Description of image"`
## Visual Testing
### Responsive Breakpoints
β
**Mobile (375px)**: Layout renders correctly
β
**Tablet (768px)**: Layout renders correctly
β
**Desktop (1440px)**: Layout renders correctly
### Screenshots
- [x] Full page screenshot saved
- [x] Mobile screenshot saved
- [x] Tablet screenshot saved
- [x] Desktop screenshot saved
## Functionality Testing
### Interactive Elements
β
Navigation menu works
β
Form submission works
β
Modal opens and closes
β οΈ Focus not returned to trigger after modal close
### JavaScript
β
No console errors
β
Event handlers working
β
Progressive enhancement implemented
## Performance
### Metrics
- **Page Load Time**: 1.2s
- **Total File Size**: 45KB
- **CSS Size**: 12KB
- **JavaScript Size**: 8KB
### Optimization Opportunities
- Consider minifying CSS (potential 30% reduction)
- Lazy load images below the fold
- Consider code splitting for JavaScript
## Recommendations
### High Priority
1. Fix form label associations
2. Add missing alt text to images
3. Implement focus management for modal
### Medium Priority
1. Minify CSS and JavaScript for production
2. Add loading states for dynamic content
3. Implement error boundaries for JavaScript
### Low Priority
1. Add dark mode support
2. Enhance animations with reduced motion support
3. Add print styles
## Next Steps
1. Review and fix high-priority issues
2. Re-run verification after fixes
3. Test with actual screen readers
4. Conduct user testing
5. Deploy to staging environment
Based on verification results:
Fix Critical Issues
Apply Improvements
Re-verify
Deliver Final Design
Mobile-First Approach:
/* Base styles for mobile */
.container {
padding: 1rem;
}
/* Tablet and up */
@media (min-width: 768px) {
.container {
padding: 2rem;
max-width: 960px;
margin: 0 auto;
}
}
/* Desktop and up */
@media (min-width: 1024px) {
.container {
padding: 3rem;
max-width: 1200px;
}
}
<form class="contact-form">
<div class="form-field">
<label for="name">
Name <span aria-label="required">*</span>
</label>
<input
type="text"
id="name"
name="name"
required
aria-required="true"
aria-describedby="name-error"
/>
<span id="name-error" class="error" role="alert" hidden>
Please enter your name
</span>
</div>
</form>
Accessible Modal:
function openModal(modalId) {
const modal = document.getElementById(modalId);
const lastFocused = document.activeElement;
modal.hidden = false;
modal.setAttribute('aria-modal', 'true');
// Focus first focusable element
const firstFocusable = modal.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
firstFocusable?.focus();
// Store last focused for return
modal.dataset.lastFocused = lastFocused;
// Trap focus
trapFocus(modal);
}
function closeModal(modalId) {
const modal = document.getElementById(modalId);
modal.hidden = true;
// Return focus
const lastFocused = document.querySelector(`[data-last-focused="${modal.id}"]`);
lastFocused?.focus();
}
Pros:
Setup:
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#0066cc',
}
}
}
}
</script>
Example:
<div class="container mx-auto px-4">
<h1 class="text-4xl font-bold text-gray-900 mb-4">
Welcome
</h1>
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Click Me
</button>
</div>
Pros:
Example:
function DesignComponent() {
const [isOpen, setIsOpen] = React.useState(false);
return (
<div className="container">
<button
onClick={() => setIsOpen(!isOpen)}
aria-expanded={isOpen}
>
Toggle
</button>
{isOpen && (
<div className="content">
Content here
</div>
)}
</div>
);
}
Pros:
Example:
<div x-data="{ open: false }">
<button @click="open = !open" :aria-expanded="open">
Toggle
</button>
<div x-show="open" x-transition>
Content here
</div>
</div>
If Playwright MCP is not available, provide these instructions to the user:
Option 1: Via NPM (Recommended)
# Install Playwright MCP server
npm install -g @playwright/mcp-server
# Configure in Claude Code
claude code mcp add playwright
Option 2: Manual Setup
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp-server"],
"env": {}
}
}
}
Verification: After installation, verify Playwright MCP is working:
# Check MCP servers
claude code mcp list
You should see playwright in the list of available MCP servers.
When working with users:
Clarify Requirements First
Provide Context
Show Progress
Be Actionable
Handle MCP Unavailability Gracefully
At the end of the design process, provide:
Complete Design Files
Verification Report (if MCP available)
Documentation
Next Steps
User Request:
"Create a landing page for a SaaS product with a hero section, features, pricing, and contact form."
Your Response:
Clarify Requirements:
Check Playwright MCP:
Generate Design:
saas-landing-page.htmlManual Verification Guide (since MCP not available):
Deliver:
Remember: The goal is to create beautiful, accessible, functional web designs that work for all users, with automatic verification when possible!