mirror of
https://github.com/daffy0208/ai-dev-standards.git
synced 2026-09-14 20:49:49 +08:00
e5da92f751
Comprehensive design resources for building aesthetically pleasing, accessible websites. ## Phase 3 Overview: 75 New Resources - 35 UI components (overlays, inputs, layouts, utilities) - 12 integrations (media, icons, fonts, design tools) - 11 tools (image optimization, color utilities, accessibility) - 14 MCPs (AI design automation, Figma sync, documentation) - 3 skills (figma-developer, asset-manager, prototype-designer) ## Phase 3.1: Image Management Suite Integrations (3): - Cloudinary: CDN with URL-based transformations, face detection - Imgix: Real-time image processing via URL parameters - Unsplash: Stock photo API with search and collections Components (6): - Image: Optimized lazy-loading with srcset/sizes, blur placeholder - Gallery: Lightbox gallery with grid/masonry layout, keyboard navigation - Carousel: Touch-enabled carousel with autoplay, indicators - ImageUpload: Drag-and-drop uploader with preview and validation - Avatar: User avatar with fallback initials and status indicator - MediaViewer: Full-screen media viewer with zoom/pan Tools (3): - image-optimizer-tool: Sharp-based optimization (compression, resizing) - responsive-image-generator-tool: Generate srcset and sizes attributes - webp-converter-tool: Convert images to WebP format ## Phase 3.2: Icon & Font Systems Integrations (5): - Heroicons: 500+ icons by Tailwind team (outline/solid variants) - Lucide: 1000+ beautiful open-source icons - Font Awesome: Thousands of icons with multiple styles - Google Fonts: 1400+ fonts with pairing suggestions - Adobe Fonts: Premium web font service integration Components (2): - Icon: Universal icon component supporting all libraries - IconPicker: Icon search and selection interface with previews MCPs (2): - icon-library-mcp: Icon search, management, and SVG generation - font-optimizer-mcp: Font subsetting, optimization, and loading Tools (2): - font-pairing-tool: AI-powered font combination suggestions - type-scale-generator-tool: Generate modular typography scales ## Phase 3.3-3.5: Advanced UI Components (35 components) All with TypeScript, Tailwind CSS + CVA, WCAG 2.1 AA accessibility, full keyboard navigation. Overlays & Dialogs (5): - Tooltip: 4 placements, portal rendering, ARIA describedby - Popover: Floating popover with click/hover triggers - Accordion: Collapsible sections with single/multi-expand modes - Drawer: Slide-out panel from 4 sides with focus trap - Dialog: Accessible modal with backdrop and ESC handling Advanced Inputs (5): - Slider: Range slider with marks, tooltips, dual handles - ColorPicker: HEX/RGB/HSL modes with presets and alpha - DatePicker: Calendar picker with range selection, min/max - TimePicker: 12/24hr formats with keyboard input - FileUpload: Drag-and-drop with preview and validation Feedback & Navigation (6): - Progress: Linear/circular with determinate/indeterminate states - Badge: Notification badge with dot/count variants - Alert: Message alerts (info, success, warning, error) - Breadcrumb: Breadcrumb navigation with custom separators - Stepper: Step-by-step progress indicator - Rating: Star rating with half-star support Layout Components (10): - Grid: CSS Grid wrapper with responsive columns - Container: Max-width container with responsive padding - Stack: Flexbox stack (vertical/horizontal) with spacing - Spacer: Flexible spacing component - Divider: Visual divider (horizontal/vertical) - AspectRatio: Maintain aspect ratio wrapper - Center: Center content horizontally and vertically - Switch: Toggle switch with ARIA switch pattern - Checkbox: Checkbox with indeterminate state - Radio: Radio button with RadioGroup Enhanced Existing (9): - Pagination: Intelligent page number display with ellipsis - Select: Enhanced with search and multi-select - Tabs: Compound component with controlled/uncontrolled modes - Table: Sortable with ARIA table semantics - Skeleton: Loading placeholder (enhanced version) - Button: Added loading states and variants - Card: Enhanced with composable sections - Input: Added password toggle and validation states - Modal: Enhanced with focus trap and body scroll lock ## Phase 3.6: AI & Design Tool MCPs (7 MCPs) - image-generator-mcp: DALL-E, Midjourney, Stable Diffusion integration - svg-generator-mcp: Programmatic SVG generation with templates - illustration-generator-mcp: AI-powered custom illustrations - figma-sync-mcp: Figma-to-code with token extraction - design-handoff-mcp: Automated design handoff workflows - theme-builder-mcp: Generate complete themes from base colors - dark-mode-converter-mcp: Light-to-dark palette transformation ## Phase 3.7: Design Tool Integrations (4 integrations + 3 skills) Integrations: - Figma: Complete REST API client with token extraction - Sketch: Sketch API integration for design assets - Adobe XD: Adobe XD API for prototypes and specs - Canva: Canva API for template and asset management Skills: - figma-developer: Figma-to-code workflows and automation - asset-manager: Asset organization, optimization, brand libraries - prototype-designer: Interactive prototypes and user testing ## Phase 3.8: Design Tools & Utilities (6 tools + 5 MCPs) Tools: - color-palette-generator-tool: Generate harmonious palettes with WCAG - contrast-checker-tool: WCAG 2.1 AA/AAA contrast validation - color-scheme-tool: Complementary, analogous, triadic schemes - breakpoint-analyzer-tool: Analyze responsive breakpoints - color-blindness-simulator-tool: Simulate deuteranopia, protanopia, tritanopia - touch-target-validator-tool: Validate 44px minimum touch targets MCPs: - storybook-generator-mcp: Auto-generate Storybook stories - props-documenter-mcp: Component props documentation - typography-analyzer-mcp: Typography analysis and optimization - asset-library-mcp: Design asset library management - responsive-preview-mcp: Multi-device preview generation ## Registry Updates (Phase 3.9) Updated all META registries with Phase 3 resources: - component-registry.json: 35 → 70 components (+35) - integration-registry.json: 13 → 25 integrations (+12) - tool-registry.json: 13 → 24 tools (+11) - mcp-registry.json: 34 → 48 MCPs (+14) - skill-registry.json: 42 → 45 skills (+3) - .claude/CLAUDE.md: Updated resource counts (150 → 216) - README.md: Updated resource counts New Categories: - Components: media (6) - Integrations: media-services (3), icon-libraries (3), font-services (2), design-tools (4) - Tools: media-tools (3), design-tools (8) - MCPs: design category expanded (2 → 16) ## Also Included - 7 comprehensive playbooks (RAG, multi-agent, MCP dev, component dev, monitoring, performance, security) - 4 observability tools (logger, metrics, tracer, error-tracker) - 4 workflow orchestration components (task-queue, workflow-orchestrator, state-manager, event-bus) - 3 MCP server handler components (tool-handler, resource-handler, prompt-handler) - Phase 2 CLI components and tools (auth, forms, errors, feedback) Total Resources: 216 (was 150) All resources discoverable via CLI and relationship mapping system. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Observability Tools
A comprehensive suite of TypeScript tools for monitoring and debugging applications. These tools provide structured logging, metrics collection, distributed tracing, and error tracking with minimal performance overhead.
Tools Overview
1. Logger Tool (logger-tool.ts)
~430 lines - Structured logging with multiple severity levels and output targets.
Features:
- Multiple log levels (debug, info, warn, error, fatal)
- Multiple outputs (console, file, remote endpoint)
- Log formatting (JSON, pretty)
- Contextual logging with child loggers
- Async logging for non-blocking operation
- Log rotation for file outputs
Quick Start:
import { createLogger, FileOutput } from './logger-tool';
const logger = createLogger({
level: 'info',
service: 'api'
});
logger.info('Server started', { port: 3000 });
logger.error('Connection failed', { error: err });
// Add file output
logger.addOutput(new FileOutput('./logs/app.log', {
maxSize: 10 * 1024 * 1024, // 10MB
maxFiles: 5
}));
2. Metrics Tool (metrics-tool.ts)
~470 lines - Performance metrics collection and aggregation.
Features:
- Counter metrics (monotonically increasing)
- Gauge metrics (can increase/decrease)
- Histogram metrics (track distributions)
- Timer metrics (convenience wrapper)
- Metric labels/tags for dimensionality
- Export to JSON and Prometheus formats
Quick Start:
import { MetricsCollector } from './metrics-tool';
const metrics = new MetricsCollector({ service: 'api' });
// Counter
const requests = metrics.counter('http_requests_total');
requests.inc({ method: 'GET', status: '200' });
// Gauge
const memory = metrics.gauge('memory_usage_bytes');
memory.set(process.memoryUsage().heapUsed);
// Histogram
const latency = metrics.histogram('http_request_duration_ms', {
buckets: [10, 50, 100, 500, 1000]
});
latency.observe(245, { endpoint: '/api/users' });
// Export
console.log(metrics.exportPrometheus());
3. Tracer Tool (tracer-tool.ts)
~425 lines - Distributed tracing for tracking request flows.
Features:
- Span creation with parent/child relationships
- Span attributes and events
- Trace context propagation (W3C Trace Context)
- Active span management
- OpenTelemetry-compatible export
- Configurable sampling
Quick Start:
import { Tracer } from './tracer-tool';
const tracer = new Tracer({ service: 'api' });
const span = tracer.startSpan('handle_request', {
attributes: { method: 'GET', path: '/users' }
});
try {
span.addEvent('fetching_from_database');
const users = await db.query('SELECT * FROM users');
span.setAttribute('user_count', users.length);
} finally {
span.end();
}
// Export trace
console.log(tracer.exportJSON());
4. Error Tracker Tool (error-tracker-tool.ts)
~420 lines - Error aggregation, grouping, and reporting.
Features:
- Error capture with stack traces
- Error grouping by similarity
- Breadcrumb tracking for context
- Error occurrence counting
- User/environment context
- Sentry-compatible export
Quick Start:
import { ErrorTracker } from './error-tracker-tool';
const errorTracker = new ErrorTracker({
service: 'api',
environment: 'production'
});
// Add breadcrumbs
errorTracker.addBreadcrumb({
type: 'http',
message: 'API request started',
data: { url: '/api/users' }
});
// Capture error
try {
await riskyOperation();
} catch (error) {
errorTracker.captureException(error as Error, {
severity: 'error',
tags: { operation: 'riskyOperation' }
});
}
// Generate report
const report = errorTracker.generateReport();
console.log(report.topErrors);
Integration Examples
Express.js Integration
import express from 'express';
import { createLogger } from './logger-tool';
import { MetricsCollector } from './metrics-tool';
import { Tracer } from './tracer-tool';
import { ErrorTracker } from './error-tracker-tool';
const app = express();
// Initialize observability tools
const logger = createLogger({ level: 'info', service: 'api' });
const metrics = new MetricsCollector({ service: 'api' });
const tracer = new Tracer({ service: 'api' });
const errorTracker = new ErrorTracker({ service: 'api' });
// Metrics
const requestCounter = metrics.counter('http_requests_total');
const requestDuration = metrics.histogram('http_request_duration_ms');
// Observability middleware
app.use((req, res, next) => {
const requestId = Math.random().toString(36).substring(7);
// Logging
const reqLogger = logger.child({ requestId, method: req.method, path: req.path });
req.logger = reqLogger;
// Tracing
const span = tracer.startSpan('http_request', {
attributes: {
'http.method': req.method,
'http.url': req.url,
'http.target': req.path,
}
});
tracer.setActiveSpan(span);
req.span = span;
// Metrics
const endTimer = requestDuration.startTimer({
method: req.method,
path: req.path
});
// Error tracking
errorTracker.addBreadcrumb({
type: 'http',
message: `${req.method} ${req.path}`,
data: { url: req.url, method: req.method }
});
res.on('finish', () => {
reqLogger.info('Request completed', {
statusCode: res.statusCode,
duration: Date.now() - req._startTime
});
requestCounter.inc({
method: req.method,
path: req.path,
status: res.statusCode.toString()
});
span.setAttribute('http.status_code', res.statusCode);
span.end();
endTimer();
});
next();
});
// Error handler
app.use((err, req, res, next) => {
req.logger.error('Request error', {}, err);
req.span.recordException(err);
errorTracker.captureException(err, {
severity: 'error',
context: {
requestId: req.requestId,
path: req.path,
method: req.method,
}
});
res.status(500).json({ error: 'Internal server error' });
});
// Metrics endpoint
app.get('/metrics', (req, res) => {
res.set('Content-Type', 'text/plain');
res.send(metrics.exportPrometheus());
});
// Health endpoint
app.get('/health', (req, res) => {
res.json({
status: 'healthy',
service: 'api',
timestamp: new Date().toISOString()
});
});
app.listen(3000, () => {
logger.info('Server started', { port: 3000 });
});
React Integration
import React, { useEffect } from 'react';
import { createLogger } from './logger-tool';
import { MetricsCollector } from './metrics-tool';
import { ErrorTracker } from './error-tracker-tool';
// Initialize
const logger = createLogger({ level: 'warn', service: 'frontend' });
const metrics = new MetricsCollector({ service: 'frontend' });
const errorTracker = new ErrorTracker({
service: 'frontend',
environment: process.env.NODE_ENV
});
// Error Boundary
class ErrorBoundary extends React.Component<
{ children: React.ReactNode },
{ hasError: boolean }
> {
state = { hasError: false };
componentDidCatch(error: Error, info: React.ErrorInfo) {
logger.error('React error boundary caught error', {
error: error.message,
componentStack: info.componentStack
});
errorTracker.captureException(error, {
severity: 'error',
context: {
componentStack: info.componentStack,
},
tags: { boundary: 'react' }
});
this.setState({ hasError: true });
}
render() {
if (this.state.hasError) {
return <h1>Something went wrong.</h1>;
}
return this.props.children;
}
}
// Performance tracking component
function PerformanceTracker({ name, children }: {
name: string;
children: React.ReactNode;
}) {
useEffect(() => {
const renderMetric = metrics.histogram('component_render_time_ms');
const end = renderMetric.startTimer({ component: name });
return () => {
end();
};
}, [name]);
return <>{children}</>;
}
// Example component with observability
function UserProfile({ userId }: { userId: string }) {
useEffect(() => {
// Set user context for error tracking
errorTracker.setUser({ id: userId });
// Add breadcrumb
errorTracker.addBreadcrumb({
type: 'navigation',
message: 'Viewed user profile',
data: { userId }
});
logger.info('User profile loaded', { userId });
}, [userId]);
const handleAction = async () => {
const timer = metrics.timer('user_action_duration_ms');
const end = timer.start({ action: 'update_profile' });
try {
await updateUserProfile(userId);
logger.info('Profile updated', { userId });
} catch (error) {
errorTracker.captureException(error as Error, {
severity: 'error',
context: { userId, action: 'update_profile' }
});
} finally {
end();
}
};
return (
<PerformanceTracker name="UserProfile">
<div>
{/* Component content */}
<button onClick={handleAction}>Update Profile</button>
</div>
</PerformanceTracker>
);
}
// Root App
function App() {
return (
<ErrorBoundary>
<UserProfile userId="123" />
</ErrorBoundary>
);
}
Node.js Microservice Integration
import { createLogger, FileOutput, RemoteOutput } from './logger-tool';
import { MetricsCollector } from './metrics-tool';
import { Tracer } from './tracer-tool';
import { ErrorTracker } from './error-tracker-tool';
// Production-ready configuration
const logger = createLogger({
level: process.env.LOG_LEVEL as any || 'info',
service: 'order-service',
format: process.env.NODE_ENV === 'production' ? 'json' : 'pretty',
});
// Add file output for production
if (process.env.NODE_ENV === 'production') {
logger.addOutput(new FileOutput('/var/log/app.log', {
maxSize: 50 * 1024 * 1024, // 50MB
maxFiles: 10
}));
// Add remote logging
logger.addOutput(new RemoteOutput(process.env.LOG_ENDPOINT!, {
batchSize: 100,
flushInterval: 5000
}));
}
const metrics = new MetricsCollector({
service: 'order-service',
defaultLabels: {
environment: process.env.NODE_ENV || 'development',
region: process.env.AWS_REGION || 'us-east-1'
}
});
const tracer = new Tracer({
service: 'order-service',
sampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0
});
const errorTracker = new ErrorTracker({
service: 'order-service',
environment: process.env.NODE_ENV || 'development',
maxBreadcrumbs: 50
});
// Business logic with observability
async function processOrder(orderId: string) {
const span = tracer.startSpan('process_order');
tracer.setActiveSpan(span);
const orderLogger = logger.child({ orderId });
orderLogger.info('Processing order started');
const orderTimer = metrics.timer('order_processing_duration_ms');
const endTimer = orderTimer.start({ orderId });
try {
// Validate order
const validateSpan = tracer.startSpan('validate_order');
errorTracker.addBreadcrumb({
type: 'default',
message: 'Validating order',
data: { orderId }
});
await validateOrder(orderId);
validateSpan.end();
orderLogger.debug('Order validated');
// Process payment
const paymentSpan = tracer.startSpan('process_payment');
errorTracker.addBreadcrumb({
type: 'default',
message: 'Processing payment',
data: { orderId }
});
await processPayment(orderId);
paymentSpan.end();
orderLogger.info('Payment processed');
// Ship order
const shipSpan = tracer.startSpan('ship_order');
await shipOrder(orderId);
shipSpan.end();
orderLogger.info('Order shipped');
metrics.counter('orders_processed_total').inc({ status: 'success' });
span.setStatus({ code: 1, message: 'OK' });
} catch (error) {
orderLogger.error('Order processing failed', {}, error as Error);
span.recordException(error as Error);
errorTracker.captureException(error as Error, {
severity: 'error',
context: { orderId },
tags: { operation: 'process_order' }
});
metrics.counter('orders_processed_total').inc({ status: 'failed' });
throw error;
} finally {
span.end();
endTimer();
}
}
// Export observability data
setInterval(() => {
// Log metrics summary
logger.info('Metrics summary', {
metrics: metrics.collect()
});
// Log error summary
const errorReport = errorTracker.generateReport({
startTime: Date.now() - 60000 // Last minute
});
if (errorReport.totalErrors > 0) {
logger.warn('Errors detected', {
totalErrors: errorReport.totalErrors,
topErrors: errorReport.topErrors.slice(0, 5)
});
}
}, 60000); // Every minute
Environment Variables
All tools respect common environment variables:
# Logging
LOG_LEVEL=info # debug, info, warn, error, fatal
SERVICE_NAME=my-service # Service identifier
# Metrics
METRICS_ENABLED=true # Enable/disable metrics
# Tracing
TRACING_ENABLED=true # Enable/disable tracing
TRACE_SAMPLE_RATE=1.0 # Sample rate (0-1)
# Error Tracking
ERROR_TRACKING_ENABLED=true # Enable/disable error tracking
NODE_ENV=production # Environment identifier
Performance Considerations
All tools are designed with minimal performance overhead:
- Logger: Async I/O, non-blocking writes
- Metrics: In-memory aggregation, no external dependencies
- Tracer: Configurable sampling, lazy evaluation
- Error Tracker: Automatic cleanup, bounded memory usage
Typical overhead: < 1ms per operation
Export Formats
Prometheus Metrics
curl http://localhost:3000/metrics
JSON Exports
// Logs
logger.exportJSON();
// Metrics
metrics.exportJSON();
// Traces
tracer.exportJSON();
// Errors
errorTracker.exportJSON();
OpenTelemetry
// Traces
const otlpTrace = tracer.exportOpenTelemetry(traceId);
Sentry
// Errors
const sentryEvent = errorTracker.exportSentry(occurrence);
License
MIT