rknall

Web Design Builder

13
3
# Install this skill:
npx skills add rknall/claude-skills --skill "Web Design Builder"

Install specific skill from multi-skill repository

# Description

Create and refactor HTML5/JavaScript web designs from specifications or descriptions. Generates complete, accessible, responsive web designs with modern frameworks. Automatically verifies designs using Playwright MCP for accessibility and functionality testing. Use this skill when users ask to create web designs, mockups, landing pages, web applications, or refactor existing HTML/CSS/JS designs.

# SKILL.md


name: "Web Design Builder"
description: "Create and refactor HTML5/JavaScript web designs from specifications or descriptions. Generates complete, accessible, responsive web designs with modern frameworks. Automatically verifies designs using Playwright MCP for accessibility and functionality testing. Use this skill when users ask to create web designs, mockups, landing pages, web applications, or refactor existing HTML/CSS/JS designs."


Web Design Builder

This skill creates professional HTML5/JavaScript web designs from specifications, with automatic accessibility and functionality verification using Playwright MCP.

When to Use This Skill

Activate this skill when the user requests:
- Create a web design from a specification or description
- Build a landing page, website, or web application
- Create a design mockup or prototype
- Refactor or improve existing HTML/CSS/JavaScript code
- Build responsive web interfaces
- Create component libraries or design systems
- Generate accessible web designs with WCAG compliance

Core Workflow

Phase 1: Requirements Gathering

When a user requests a web design, start by understanding their needs:

  1. Clarify the Design Scope
  2. What type of design? (landing page, dashboard, form, etc.)
  3. Target audience and use case
  4. Required features and functionality
  5. Content and copy (provided or placeholder?)
  6. Brand colors, fonts, or design system
  7. Responsive requirements (mobile-first?)

  8. Technical Preferences

  9. Framework preference:
    • Vanilla HTML/CSS/JS (simple, no dependencies)
    • Tailwind CSS (utility-first, recommended for rapid development)
    • React (component-based, for complex interactions)
    • Vue (progressive framework)
    • Alpine.js (lightweight reactivity)
  10. Browser support requirements
  11. Accessibility requirements (WCAG level)
  12. Performance constraints

  13. Check Playwright MCP Availability

IMPORTANT: Before starting the design process, check if Playwright MCP is available:

javascript // Check if mcp__playwright tools are available // Look for tools like: mcp__playwright__navigate, mcp__playwright__screenshot, etc.

If Playwright MCP is NOT available:
- Inform the user: "Playwright MCP is not installed. Design verification will be skipped."
- Provide installation instructions (see MCP Setup section below)
- Continue with design generation but skip verification phase
- Mark this clearly in the output

If Playwright MCP IS available:
- Inform the user: "Playwright MCP detected. Design will be automatically verified."
- Include verification in the workflow

Phase 2: Design Generation

Step 1: Create Design Mockup

Generate a complete HTML/CSS/JS mockup including:

HTML Structure:
- Semantic HTML5 elements
- Proper heading hierarchy (h1 → h6)
- ARIA landmarks (header, nav, main, aside, footer)
- Accessible form labels and inputs
- Alt text for images
- Unique page title

CSS Styling:
- Responsive design (mobile-first)
- CSS Grid or Flexbox for layouts
- Custom properties (CSS variables) for theming
- Smooth transitions and animations
- Print styles (if applicable)
- Dark mode support (optional)

JavaScript Functionality:
- Progressive enhancement
- Accessible interactions (keyboard support)
- Form validation
- Dynamic content loading
- Event handling
- Error handling

Accessibility Features:
- WCAG 2.1 Level AA compliance minimum
- Keyboard navigation support
- Focus indicators
- Screen reader friendly
- Color contrast compliance (4.5:1 minimum)
- Skip links
- ARIA attributes where needed

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>

Step 2: Save Design to File

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:
- Save to user's current directory or ask for preferred location
- Use descriptive filename (e.g., landing-page.html, dashboard.html)
- Create single-file HTML for mockups (CSS/JS inline)
- Create separate files for production builds

Phase 3: Design Verification (ONLY if Playwright MCP is available)

IMPORTANT: Only execute this phase if Playwright MCP was detected in Phase 1.

Step 1: Launch Browser and Load Design

Use Playwright MCP to open the design:

// Navigate to the local HTML file
await mcp__playwright__navigate({
  url: 'file:///path/to/design.html'
});

Step 2: Accessibility Testing

Run comprehensive accessibility checks:

  1. Automated Accessibility Scan
  2. Check for WCAG violations
  3. Verify color contrast ratios
  4. Check heading hierarchy
  5. Verify ARIA attributes
  6. Check form labels
  7. Verify alt text on images

  8. Keyboard Navigation Test

  9. Tab through all interactive elements
  10. Verify focus indicators are visible
  11. Check tab order is logical
  12. Test Escape key behavior (modals, dropdowns)
  13. Verify no keyboard traps

  14. Screen Reader Compatibility

  15. Check ARIA landmarks
  16. Verify semantic HTML usage
  17. Check dynamic content announcements
  18. Verify form error messages

Step 3: Visual Testing

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`
  });
}

Step 4: Functionality Testing

Test interactive elements:

  1. Form Validation
  2. Test required fields
  3. Test input validation
  4. Test error messages
  5. Test success states

  6. Interactive Components

  7. Test buttons and links
  8. Test modals and dialogs
  9. Test dropdowns and menus
  10. Test tabs and accordions
  11. Test carousels and sliders

  12. JavaScript Functionality

  13. Verify event handlers work
  14. Test dynamic content loading
  15. Check console for errors
  16. Verify progressive enhancement

Step 5: Performance Check

Evaluate performance metrics:

  1. Load Time
  2. Measure page load time
  3. Check resource loading
  4. Identify bottlenecks

  5. Resource Optimization

  6. Check CSS file size
  7. Check JavaScript file size
  8. Verify image optimization
  9. Check for unused CSS/JS

Phase 4: Verification Report

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

Phase 5: Iteration and Refinement

Based on verification results:

  1. Fix Critical Issues
  2. Address all accessibility violations
  3. Fix broken functionality
  4. Resolve layout issues

  5. Apply Improvements

  6. Implement recommended optimizations
  7. Enhance visual design based on feedback
  8. Refine interactions and animations

  9. Re-verify

  10. Run verification again after fixes
  11. Ensure all issues are resolved
  12. Generate updated report

  13. Deliver Final Design

  14. Provide clean, production-ready code
  15. Include documentation
  16. Provide deployment instructions
  17. Share verification report

Design Patterns & Best Practices

Responsive 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;
  }
}

Accessible Forms

<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>

Interactive Components

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();
}

Framework-Specific Guidelines

Tailwind CSS

Pros:
- Rapid development
- Consistent design system
- Built-in responsive utilities
- Excellent for prototyping

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>

React

Pros:
- Component reusability
- Virtual DOM performance
- Large ecosystem
- Great for SPAs

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>
  );
}

Alpine.js

Pros:
- Lightweight (15KB)
- Declarative syntax
- No build step needed
- Good for progressive enhancement

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>

MCP Setup Instructions

If Playwright MCP is not available, provide these instructions to the user:

Installing Playwright MCP

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

  1. Create MCP configuration file:
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp-server"],
      "env": {}
    }
  }
}
  1. Restart Claude Code

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.

Communication Style

When working with users:

  1. Clarify Requirements First
  2. Ask about design goals and constraints
  3. Understand technical requirements
  4. Confirm framework preferences

  5. Provide Context

  6. Explain design decisions
  7. Justify framework choices
  8. Describe accessibility considerations

  9. Show Progress

  10. Inform when generating design
  11. Update during verification (if MCP available)
  12. Share findings incrementally

  13. Be Actionable

  14. Provide specific fixes for issues
  15. Include code examples
  16. Offer alternatives when appropriate

  17. Handle MCP Unavailability Gracefully

  18. Clearly state when verification is skipped
  19. Provide manual testing guidance
  20. Offer installation instructions

Deliverables

At the end of the design process, provide:

  1. Complete Design Files
  2. HTML, CSS, JavaScript files
  3. Assets (if any)
  4. README with setup instructions

  5. Verification Report (if MCP available)

  6. Accessibility compliance results
  7. Visual testing screenshots
  8. Functionality test results
  9. Performance metrics
  10. Prioritized recommendations

  11. Documentation

  12. Component usage guide
  13. Customization instructions
  14. Browser support information
  15. Deployment guidelines

  16. Next Steps

  17. Suggested improvements
  18. Testing recommendations
  19. Production checklist

Example Workflow

User Request:

"Create a landing page for a SaaS product with a hero section, features, pricing, and contact form."

Your Response:

  1. Clarify Requirements:
  2. "I'll create a modern SaaS landing page. A few questions:

    • Do you have brand colors or should I use a professional default palette?
    • Framework preference? I recommend Tailwind CSS for rapid development.
    • Any specific features to highlight?
    • Contact form fields needed?"
  3. Check Playwright MCP:

  4. "Checking for Playwright MCP... Not detected. Design verification will be skipped. Would you like installation instructions?"

  5. Generate Design:

  6. Create complete HTML/CSS/JS file
  7. Include hero, features, pricing, contact form
  8. Make it responsive and accessible
  9. Save to saas-landing-page.html

  10. Manual Verification Guide (since MCP not available):

  11. Provide checklist for manual testing
  12. Share accessibility testing tools
  13. Suggest browser testing approach

  14. Deliver:

  15. Share complete design file
  16. Provide customization guide
  17. Offer iteration if needed

Remember: The goal is to create beautiful, accessible, functional web designs that work for all users, with automatic verification when possible!

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.