Component template generator

From curiositech/windags-skills · View interactive version

Component template generator is an AI agent skill from the GitHub repository curiositech/windags-skills. Generates starter component code using design tokens. Creates React/Vue/Svelte components with proper token usage, variants, and accessibility built in.

How to use this skill

Skill file

Component Template Generator

Create production-ready component code that properly uses your design tokens. Generates React, Vue, or Svelte components with variants, accessibility, and token integration.

DECISION POINTS

Framework Selection Tree

Component request → Framework choice:
├── React requested or TypeScript heavy → React + TypeScript
│   ├── Has Tailwind tokens → React + Tailwind template
│   └── Has CSS variables → React + CSS Modules template
├── Vue requested or composition API mentioned → Vue 3 + Composition API
│   ├── Has Tailwind tokens → Vue + Tailwind template
│   └── Has CSS variables → Vue + CSS Variables template
├── Svelte requested or lightweight mentioned → Svelte template
└── No framework specified → Default to React + TypeScript

Component Complexity Decision

Component type → Template complexity:
├── Simple (Button, Badge, Input) → Single file template
│   ├── <5 props → Basic variant system
│   └── 5+ props → Props interface + defaults
├── Composite (Card, Dialog, Accordion) → Multi-part template
│   ├── Has children slots → Compound component pattern
│   └── State management needed → Hook/composable pattern
├── Interactive (Dropdown, Tabs, Toggle) → Full template + logic
│   └── Always include → Keyboard handlers + ARIA
└── Layout (Container, Grid, Stack) → Responsive template
    └── Always include → Breakpoint variants

Variant System Selection

Number of variants → Implementation:
├── 2-3 variants → Simple string union + className mapping
├── 4-8 variants → Object-based variant system
├── 8+ variants → Compound variants (size × color × state)
└── Complex states → Separate state management hook

FAILURE MODES

Hardcoded Colors Anti-Pattern

Missing ARIA Anti-Pattern

Variant Collision Anti-Pattern

Framework Pattern Violation

Schema Bloat Anti-Pattern

WORKED EXAMPLES

Complete Button Generation Walkthrough

Input: Generate neobrutalism Button for React + Tailwind with primary/secondary variants

Decision Process:

  1. Framework → React (specified) + TypeScript (best practice)
  2. Has Tailwind → Use Tailwind template
  3. Component type → Simple (Button)
  4. Variants → 2 variants → Simple string union
  5. Trend → Neobrutalism → Add brutal shadows + transforms

Generated Output:

import { forwardRef } from 'react';
import { cn } from '@/lib/utils';

interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  variant?: 'primary' | 'secondary';
  size?: 'sm' | 'md' | 'lg';
}

export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
  ({ variant = 'primary', size = 'md', className, children, ...props }, ref) => {
    return (
      <button
        ref={ref}
        className={cn(
          // Base neobrutalism styles
          'border-3 border-brutal-black font-display font-bold uppercase',
          'shadow-brutal transition-all duration-100',
          'hover:shadow-brutal-hover hover:-translate-x-0.5 hover:-translate-y-0.5',
          'active:shadow-brutal-active active:translate-x-0.5 active:translate-y-0.5',
          
          // Focus accessibility
          'focus:outline-none focus-visible:ring-2 focus-visible:ring-brutal-blue',
          
          // Variants using tokens
          variant === 'primary' && 'bg-brutal-red text-white',
          variant === 'secondary' && 'bg-brutal-yellow text-brutal-black',
          
          // Sizes
          size === 'sm' && 'px-3 py-1.5 text-sm',
          size === 'md' && 'px-4 py-2 text-base',
          size === 'lg' && 'px-6 py-3 text-lg',
          
          className
        )}
        {...props}
      >
        {children}
      </button>
    );
  }
);

Button.displayName = 'Button';

Expert Catches vs Novice Misses:

QUALITY GATES

NOT-FOR BOUNDARIES

Do NOT use this skill for:

Delegate to other skills:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.