component-template-generator
dhriyatinandu-bot/claude-skills/.claude/skills/component-template-generator/SKILL.md
Generates starter component code using design tokens. Creates React/Vue/Svelte components with proper token usage, variants, and accessibility built in.
Skill0 starsChanged 7 months ago
What's in it
- Component Template Generator
- Quick Start
- Core Mission
- When to Use
- Component Catalog
- Core Components
- Layout Components
- Interactive Components
- Template Structure
- Framework Templates
- React + Tailwind
- React + CSS Variables
- Vue 3 + Composition API
- Svelte
- Accessibility Patterns
- Focus Management
- Keyboard Navigation
- ARIA Attributes
- Trend-Specific Patterns
- Neobrutalism Components
- Glassmorphism Components
- Terminal Components
- Generation Workflow
- See Also
- References
- Related Skills
Tools it asks for
- Read
- Write
- Glob
---
name: component-template-generator
description: Generates starter component code using design tokens. Creates React/Vue/Svelte components with proper token usage, variants, and accessibility built in.
allowed-tools: Read,Write,Glob
metadata:
category: Development
pairs-with:
- skill: design-system-generator
reason: Uses generated tokens in component code
- skill: frontend-developer
reason: Implement and customize generated components
- skill: design-system-documenter
reason: Document generated components
tags:
- components
- react
- vue
- svelte
- templates
---
# 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.
## Quick Start
**Minimal example - generate a Button component:**
```typescript
// Input: Trend ID + Component type
// Output: Complete component with token usage
// Button.tsx (neobrutalism)
import { cn } from '@/lib/utils';
interface ButtonProps {
variant?: 'primary' | 'secondary' | 'ghost';
size?: 'sm' | 'md' | 'lg';
children: React.ReactNode;
}
export function Button({ variant = 'primary', size = 'md', children }: ButtonProps) {
return (
<button className={cn(
'border-3 border-brutal-black font-display transition-all duration-100',
'shadow-brutal 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',
// Variants
variant === 'primary' && 'bg-brutal-red text-white',
variant === 'secondary' && 'bg-brutal-cream text-brutal-black',
variant === 'ghost' && 'bg-transparent border-transparent shadow-none',
// 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',
)}>
{children}
</button>
);
}
```
**Key principle**: Components use semantic token names, not hardcoded values.
## Core Mission
Generate component templates that:
1. Use design tokens correctly (semantic names, not hex values)
2. Include common variants (size, color, state)
3. Have accessibility built in (ARIA, keyboard, focus)
4. Are framework-idiomatic (React hooks, Vue composition, Svelte stores)
## When to Use
✅ Use when:
- Starting a component library with generated tokens
- Need consistent token usage across components
- Want accessibility baked into templates
- Bootstrapping a design system implementation
❌ Do NOT use when:
- Need tokens only (use design-system-generator)
- Need complete UI library (use shadcn/ui or similar)
- Customizing existing components (just edit them)
## Component Catalog
### Core Components
| Component | Variants | Accessibility |
|-----------|----------|---------------|
| Button | primary, secondary, ghost, destructive | ✅ Focus ring, disabled state |
| Input | default, error, disabled | ✅ Label association, error announcement |
| Card | default, interactive, highlighted | ✅ Semantic article/section |
| Badge | default, success, warning, error | ✅ Status announcements |
### Layout Components
| Component | Variants | Features |
|-----------|----------|----------|
| Container | default, narrow, wide | Max-width + padding |
| Stack | vertical, horizontal | Gap using spacing tokens |
| Grid | 2-col, 3-col, 4-col, auto | Responsive breakpoints |
### Interactive Components
| Component | Variants | Accessibility |
|-----------|----------|---------------|
| Dialog | default, alert | ✅ Focus trap, escape close |
| Dropdown | default | ✅ Keyboard navigation |
| Tabs | default | ✅ Arrow key navigation |
| Toggle | default | ✅ Switch role |
## Template Structure
Each component template includes:
```typescript
// 1. Type definitions
interface ComponentProps {
variant?: 'primary' | 'secondary';
size?: 'sm' | 'md' | 'lg';
// ... other props
}
// 2. Component implementation
export function Component({ variant, size, ...props }: ComponentProps) {
// Token-based styling
// Accessibility attributes
// Event handlers
}
// 3. Subcomponents (if applicable)
Component.Header = function Header() { /* ... */ };
Component.Body = function Body() { /* ... */ };
// 4. Default export
export default Component;
```
## Framework Templates
### React + Tailwind
```tsx
// Uses: className, cn() utility, React.forwardRef for refs
import { forwardRef } from 'react';
import { cn } from '@/lib/utils';
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary';
}
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
({ variant = 'primary', className, ...props }, ref) => (
<button
ref={ref}
className={cn(
'border-3 border-brutal-black shadow-brutal',
variant === 'primary' && 'bg-brutal-red',
className
)}
{...props}
/>
)
);
```
### React + CSS Variables
```tsx
// Uses: style prop with CSS variables, CSS modules
import styles from './Button.module.css';
export function Button({ variant = 'primary', ...props }) {
return (
<button
className={`${styles.button} ${styles[variant]}`}
style={{
'--button-shadow': 'var(--shadow-md)',
'--button-border': 'var(--border-width) solid var(--color-border)',
}}
{...props}
/>
);
}
```
### Vue 3 + Composition API
```vue
<script setup lang="ts">
interface Props {
variant?: 'primary' | 'secondary';
size?: 'sm' | 'md' | 'lg';
}
const props = withDefaults(defineProps<Props>(), {
variant: 'primary',
size: 'md',
});
const classes = computed(() => [
'border-3 border-brutal-black shadow-brutal',
props.variant === 'primary' && 'bg-brutal-red',
props.variant === 'secondary' && 'bg-brutal-cream',
]);
</script>
<template>
<button :class="classes">
<slot />
</button>
</template>
```
### Svelte
```svelte
<script lang="ts">
export let variant: 'primary' | 'secondary' = 'primary';
export let size: 'sm' | 'md' | 'lg' = 'md';
</script>
<button
class="border-3 border-brutal-black shadow-brutal"
class:bg-brutal-red={variant === 'primary'}
class:bg-brutal-cream={variant === 'secondary'}
on:click
>
<slot />
</button>
```
## Accessibility Patterns
### Focus Management
```tsx
// All interactive components include visible focus
'focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2'
'focus-visible:ring-brutal-blue'
```
### Keyboard Navigation
```tsx
// Dropdown with keyboard support
function handleKeyDown(e: KeyboardEvent) {
switch (e.key) {
case 'ArrowDown': focusNext(); break;
case 'ArrowUp': focusPrev(); break;
case 'Escape': close(); break;
case 'Enter': select(); break;
}
}
```
### ARIA Attributes
```tsx
// Dialog with proper ARIA
<div
role="dialog"
aria-modal="true"
aria-labelledby="dialog-title"
aria-describedby="dialog-description"
>
```
## Trend-Specific Patterns
### Neobrutalism Components
```tsx
// Hard shadows, bold borders, transform on interaction
'border-3 border-black shadow-brutal'
'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'
```
### Glassmorphism Components
```tsx
// Frosted glass, subtle borders, backdrop blur
'bg-glass-white/10 backdrop-blur-glass'
'border border-glass-white/20'
'shadow-glass'
```
### Terminal Components
```tsx
// Monospace, green-on-black, CRT effects
'font-mono bg-term-bg text-term-green'
'border border-term-green/30'
'shadow-term-glow'
```
## Generation Workflow
```
1. design-system-generator → tokens (Tailwind/CSS)
2. component-template-generator → component code
3. Customize variants and props as needed
4. design-system-documenter → component docs
```
## See Also
### References
- `references/component-patterns.md` - Full patterns for neobrutalism, glassmorphism, terminal, web3, swiss
- `references/component-catalog.md` - **NEW**: 21st.dev component counts (1400+ components)
- Marketing blocks: 73 heroes, 34 CTAs, 11 nav menus, 36 features
- UI components: 130 buttons, 102 inputs, 79 cards, 40 accordions
- Design system references: Elastic UI, HeroUI, Ariakit, shadcn
### Related Skills
- design-system-generator - Generate tokens first (24 trends, 31 styles)
- design-system-documenter - Document generated components
More agent context in dhriyatinandu-bot/claude-skills
185 other files this repository gives its agents, the first 60 shown.
CLAUDE.md
Skill
- 2000s-visualization-expert.claude/skills/2000s-visualization-expert/SKILL.md
- 2026-legal-research-agent.claude/skills/2026-legal-research-agent/SKILL.md
- adhd-daily-planner.claude/skills/adhd-daily-planner/SKILL.md
- adhd-design-expert.claude/skills/adhd-design-expert/SKILL.md
- admin-dashboard.claude/skills/admin-dashboard/SKILL.md
- agent-creator.claude/skills/agent-creator/SKILL.md
- ai-engineer.claude/skills/ai-engineer/SKILL.md
- ai-video-production-master.claude/skills/ai-video-production-master/SKILL.md
- anthropic-technical-deep-dive.claude/skills/anthropic-technical-deep-dive/SKILL.md
- api-architect.claude/skills/api-architect/SKILL.md
- automatic-stateful-prompt-improver.claude/skills/automatic-stateful-prompt-improver/SKILL.md
- background-job-orchestrator.claude/skills/background-job-orchestrator/SKILL.md
- bot-developer.claude/skills/bot-developer/SKILL.md
- caching-strategies.claude/skills/caching-strategies/SKILL.md
- career-biographer.claude/skills/career-biographer/SKILL.md
- chatbot-analytics.claude/skills/chatbot-analytics/SKILL.md
- checklist-discipline.claude/skills/checklist-discipline/SKILL.md
- claude-ecosystem-promoter.claude/skills/claude-ecosystem-promoter/SKILL.md
- clinical-diagnostic-reasoning.claude/skills/clinical-diagnostic-reasoning/SKILL.md
- clip-aware-embeddings.claude/skills/clip-aware-embeddings/SKILL.md
- cloudflare-worker-dev.claude/skills/cloudflare-worker-dev/SKILL.md
- code-architecture.claude/skills/code-architecture/SKILL.md
- code-necromancer.claude/skills/code-necromancer/SKILL.md
- code-review-checklist.claude/skills/code-review-checklist/SKILL.md
- collage-layout-expert.claude/skills/collage-layout-expert/SKILL.md
- color-contrast-auditor.claude/skills/color-contrast-auditor/SKILL.md
- color-theory-palette-harmony-expert.claude/skills/color-theory-palette-harmony-expert/SKILL.md
- competitive-cartographer.claude/skills/competitive-cartographer/SKILL.md
- computer-vision-pipeline.claude/skills/computer-vision-pipeline/SKILL.md
- cost-accrual-tracker.claude/skills/cost-accrual-tracker/SKILL.md
- cost-optimizer.claude/skills/cost-optimizer/SKILL.md
- cost-verification-auditor.claude/skills/cost-verification-auditor/SKILL.md
- crisis-detection-intervention-ai.claude/skills/crisis-detection-intervention-ai/SKILL.md
- crisis-response-protocol.claude/skills/crisis-response-protocol/SKILL.md
- cv-creator.claude/skills/cv-creator/SKILL.md
- dark-mode-design-expert.claude/skills/dark-mode-design-expert/SKILL.md
- database-design-patterns.claude/skills/database-design-patterns/SKILL.md
- data-pipeline-engineer.claude/skills/data-pipeline-engineer/SKILL.md
- data-viz-2025.claude/skills/data-viz-2025/SKILL.md
- dependency-management.claude/skills/dependency-management/SKILL.md
- design-accessibility-auditor.claude/skills/design-accessibility-auditor/SKILL.md
- design-archivist.claude/skills/design-archivist/SKILL.md
- design-critic.claude/skills/design-critic/SKILL.md
- design-justice.claude/skills/design-justice/SKILL.md
- design-system-creator.claude/skills/design-system-creator/SKILL.md
- design-system-documenter.claude/skills/design-system-documenter/SKILL.md
- design-system-generator.claude/skills/design-system-generator/SKILL.md
- design-trend-analyzer.claude/skills/design-trend-analyzer/SKILL.md
- devops-automator.claude/skills/devops-automator/SKILL.md
- diagramming-expert.claude/skills/diagramming-expert/SKILL.md
- digital-estate-planner.claude/skills/digital-estate-planner/SKILL.md
- docker-containerization.claude/skills/docker-containerization/SKILL.md
- document-generation-pdf.claude/skills/document-generation-pdf/SKILL.md
- drizzle-migrations.claude/skills/drizzle-migrations/SKILL.md
- drone-cv-expert.claude/skills/drone-cv-expert/SKILL.md
- drone-inspection-specialist.claude/skills/drone-inspection-specialist/SKILL.md
- email-composer.claude/skills/email-composer/SKILL.md
- error-handling-patterns.claude/skills/error-handling-patterns/SKILL.md
- event-detection-temporal-intelligence-expert.claude/skills/event-detection-temporal-intelligence-expert/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

