Loading...
Loading...
Assembles component outputs from AI Design Components skills into unified, production-ready component systems with validated token integration, proper import chains, and framework-specific scaffolding. Use as the capstone skill after running theming, layout, dashboard, data-viz, or feedback skills to wire components into working React/Next.js, Python, or Rust projects.
npx skill4agent add ancoleman/ai-design-components assembling-components┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ theming- │────▶│ designing- │────▶│ creating- │
│ components │ │ layouts │ │ dashboards │
└──────────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
tokens.css Layout.tsx Dashboard.tsx
theme-provider.tsx Header.tsx KPICard.tsx
│ │ │
└────────────────────────┴────────────────────────┘
│
▼
┌──────────────────────┐
│ visualizing-data │
│ providing-feedback │
└──────────────────────┘
│
▼
DonutChart.tsx
Toast.tsx, Spinner.tsx
│
▼
┌──────────────────────┐
│ ASSEMBLING- │
│ COMPONENTS │
│ (THIS SKILL) │
└──────────────────────┘
│
▼
WORKING COMPONENT SYSTEM| Skill | Primary Outputs | Token Dependencies |
|---|---|---|
| tokens.css, theme-provider.tsx | Foundation |
| Layout.tsx, Header.tsx, Sidebar.tsx | --spacing-, --color-border- |
| Dashboard.tsx, KPICard.tsx | All layout + chart tokens |
| Chart components, legends | --chart-color-, --font-size- |
| Form inputs, validation | --spacing-, --radius-, --color-error |
| Table, pagination | --color-, --spacing- |
| Toast, Spinner, EmptyState | --color-success/error/warning |
# Basic validation
python scripts/validate_tokens.py src/styles
# Strict mode with fix suggestions
python scripts/validate_tokens.py src --strict --fix-suggestions
# JSON output for CI/CD
python scripts/validate_tokens.py src --json/* Colors - semantic naming */
--color-primary: #FA582D; /* Brand primary */
--color-success: #00CC66; /* Positive states */
--color-warning: #FFCB06; /* Caution states */
--color-error: #C84727; /* Error states */
--color-info: #00C0E8; /* Informational */
--color-bg-primary: #FFFFFF; /* Main background */
--color-bg-secondary: #F8FAFC; /* Elevated surfaces */
--color-text-primary: #1E293B; /* Body text */
--color-text-secondary: #64748B; /* Muted text */
/* Spacing - 4px base unit */
--spacing-xs: 0.25rem; /* 4px */
--spacing-sm: 0.5rem; /* 8px */
--spacing-md: 1rem; /* 16px */
--spacing-lg: 1.5rem; /* 24px */
--spacing-xl: 2rem; /* 32px */
/* Typography */
--font-size-xs: 0.75rem; /* 12px */
--font-size-sm: 0.875rem; /* 14px */
--font-size-base: 1rem; /* 16px */
--font-size-lg: 1.125rem; /* 18px */
/* Component sizes */
--icon-size-sm: 1rem; /* 16px */
--icon-size-md: 1.5rem; /* 24px */
--radius-sm: 4px;
--radius-md: 8px;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);| Must Use Tokens (Errors) | Example Fix |
|---|---|
| Colors | |
| Spacing (≥4px) | |
| Font sizes | |
| Should Use Tokens (Warnings) | Example Fix |
|---|---|
| Border radius | |
| Shadows | |
| Z-index (≥100) | |
python scripts/validate_tokens.py <component-directory>// src/main.tsx - Entry point
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { ThemeProvider } from '@/context/theme-provider'
import App from './App'
import './styles/tokens.css' // FIRST - token definitions
import './styles/globals.css' // SECOND - global resets
createRoot(document.getElementById('root')!).render(
<StrictMode>
<ThemeProvider>
<App />
</ThemeProvider>
</StrictMode>,
)<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{PROJECT_TITLE}}</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>// src/context/theme-provider.tsx
import { createContext, useContext, useEffect, useState } from 'react'
type Theme = 'light' | 'dark' | 'system'
const ThemeContext = createContext<{
theme: Theme
setTheme: (theme: Theme) => void
} | undefined>(undefined)
export function ThemeProvider({ children }: { children: React.ReactNode }) {
const [theme, setTheme] = useState<Theme>('system')
useEffect(() => {
const root = document.documentElement
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark' : 'light'
root.setAttribute('data-theme', theme === 'system' ? systemTheme : theme)
localStorage.setItem('theme', theme)
}, [theme])
return (
<ThemeContext.Provider value={{ theme, setTheme }}>
{children}
</ThemeContext.Provider>
)
}
export const useTheme = () => {
const context = useContext(ThemeContext)
if (!context) throw new Error('useTheme must be used within ThemeProvider')
return context
}// src/components/ui/index.ts
export { Button } from './button'
export { Card } from './card'
// src/components/features/dashboard/index.ts
export { KPICard } from './kpi-card'
export { DonutChart } from './donut-chart'
export { Dashboard } from './dashboard'import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
}){
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"strict": true,
"baseUrl": ".",
"paths": { "@/*": ["./src/*"] }
},
"include": ["src"]
}// Import tokens first, components inherit token values
import './styles/tokens.css'
// Use ThemeProvider at root
<ThemeProvider>
<App />
</ThemeProvider>// Components from creating-dashboards skill
import { Dashboard, KPICard } from '@/components/features/dashboard'
// Wire with data
<Dashboard>
<KPICard
label="Total Threats"
value={1234}
severity="critical"
trend={{ value: 15.3, direction: 'up' }}
/>
</Dashboard>// Charts from visualizing-data skill
import { DonutChart } from '@/components/charts'
// Charts use --chart-color-* tokens automatically
<DonutChart
data={threatData}
title="Threats by Severity"
/>// From providing-feedback skill
import { Toast, Spinner, EmptyState } from '@/components/feedback'
// Wire toast notifications
<ToastProvider>
<App />
</ToastProvider>
// Use spinner for loading states
{isLoading ? <Spinner /> : <Dashboard />}tokens.cssvalidate_tokens.pydata-theme@media (prefers-reduced-motion)scripts/validate_tokens.pyscripts/generate_scaffold.pyscripts/check_imports.pyscripts/generate_exports.pypython scripts/validate_tokens.py demo/examples --fix-suggestionsreferences/library-context.mdreferences/react-vite-template.mdreferences/nextjs-template.mdreferences/python-fastapi-template.mdreferences/rust-axum-template.mdreferences/token-validation-rules.mdexamples/react-dashboard/examples/nextjs-dashboard/examples/fastapi-dashboard/examples/rust-axum-dashboard/assets/templates/react/assets/templates/python/assets/templates/rust/validate_tokens.pyreferences/library-context.md