senior-frontend
Scannednpx machina-cli add skill ComposioHQ/awesome-claude-plugins/senior-frontend --openclawSenior Frontend
Frontend development patterns, performance optimization, and automation tools for React/Next.js applications.
Project Scaffolding
Generate a new Next.js or React project with TypeScript, Tailwind CSS, and best practice configurations.
Scaffolder Options
| Option | Description |
|---|---|
--template nextjs | Next.js 14+ with App Router and Server Components |
--template react | React + Vite with TypeScript |
--features auth | Add NextAuth.js authentication |
--features api | Add React Query + API client |
--features forms | Add React Hook Form + Zod validation |
--features testing | Add Vitest + Testing Library |
Generated Structure (Next.js)
my-app/
├── app/
│ ├── layout.tsx # Root layout with fonts
│ ├── page.tsx # Home page
│ ├── globals.css # Tailwind + CSS variables
│ └── api/health/route.ts
├── components/
│ ├── ui/ # Button, Input, Card
│ └── layout/ # Header, Footer, Sidebar
├── hooks/ # useDebounce, useLocalStorage
├── lib/ # utils (cn), constants
├── types/ # TypeScript interfaces
├── tailwind.config.ts
├── next.config.js
└── package.json
Component Generation
Generate React components with TypeScript, tests, and Storybook stories.
Generator Options
| Option | Description |
|---|---|
--type client | Client component with 'use client' (default) |
--type server | Async server component |
--type hook | Custom React hook |
--with-test | Include test file |
--with-story | Include Storybook story |
Bundle Analysis
Analyze package.json and project structure for bundle optimization opportunities.
Heavy Dependencies to Replace
| Package | Size | Alternative |
|---|---|---|
| moment | 290KB | date-fns (12KB) or dayjs (2KB) |
| lodash | 71KB | lodash-es with tree-shaking |
| axios | 14KB | Native fetch or ky (3KB) |
| jquery | 87KB | Native DOM APIs |
| @mui/material | Large | shadcn/ui or Radix UI |
React Patterns
Compound Components
const Tabs = ({ children }) => {
const [active, setActive] = useState(0);
return (
<TabsContext.Provider value={{ active, setActive }}>
{children}
</TabsContext.Provider>
);
};
Tabs.List = TabList;
Tabs.Panel = TabPanel;
Custom Hooks
function useDebounce<T>(value: T, delay = 500): T {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(() => {
const timer = setTimeout(() => setDebouncedValue(value), delay);
return () => clearTimeout(timer);
}, [value, delay]);
return debouncedValue;
}
Next.js Optimization
Server vs Client Components
Use Server Components by default. Add 'use client' only when you need:
- Event handlers (onClick, onChange)
- State (useState, useReducer)
- Effects (useEffect)
- Browser APIs
Image Optimization
import Image from 'next/image';
// Above the fold - load immediately
<Image
src="/hero.jpg"
alt="Hero"
width={1200}
height={600}
priority
/>
// Responsive image with fill
<div className="relative aspect-video">
<Image
src="/product.jpg"
alt="Product"
fill
sizes="(max-width: 768px) 100vw, 50vw"
className="object-cover"
/>
</div>
Accessibility Checklist
- Semantic HTML: Use proper elements (
<button>,<nav>,<main>) - Keyboard Navigation: All interactive elements focusable
- ARIA Labels: Provide labels for icons and complex widgets
- Color Contrast: Minimum 4.5:1 for normal text
- Focus Indicators: Visible focus states
// Accessible button
<button
type="button"
aria-label="Close dialog"
onClick={onClose}
className="focus-visible:ring-2 focus-visible:ring-blue-500"
>
<XIcon aria-hidden="true" />
</button>
Quick Reference
Tailwind CSS Utilities
import { cn } from '@/lib/utils';
<button className={cn(
'px-4 py-2 rounded',
variant === 'primary' && 'bg-blue-500 text-white',
disabled && 'opacity-50 cursor-not-allowed'
)} />
TypeScript Patterns
// Props with children
interface CardProps {
className?: string;
children: React.ReactNode;
}
// Generic component
interface ListProps<T> {
items: T[];
renderItem: (item: T) => React.ReactNode;
}
function List<T>({ items, renderItem }: ListProps<T>) {
return <ul>{items.map(renderItem)}</ul>;
}
Source
git clone https://github.com/ComposioHQ/awesome-claude-plugins/blob/master/senior-frontend/skills/senior-frontend/SKILL.mdView on GitHub Overview
Senior Frontend covers patterns, performance optimization, and automation for React and Next.js apps. It includes project scaffolding with TypeScript and Tailwind, component generation, bundle analysis, accessibility, and frontend code quality reviews.
How This Skill Works
Uses CLI scaffolding to generate a Next.js or React project with TypeScript and Tailwind, with optional features like auth, API, forms, and testing. It also provides patterns (compound components, custom hooks) and bundle-analysis guidance to swap heavy dependencies and apply Next.js optimization (server components by default, image optimization).
When to Use It
- Starting a new Next.js or React project with TypeScript and Tailwind using scaffolding
- Optimizing Next.js performance, including server vs client components and image handling
- Analyzing and reducing bundle sizes by replacing heavy dependencies
- Generating reusable components with TypeScript, tests, and Storybook stories
- Ensuring accessibility and frontend code quality during reviews
Quick Start
- Step 1: Scaffold a Next.js or React project with TypeScript + Tailwind, choosing relevant features (--template nextjs or --template react, --features forms/auth, etc.)
- Step 2: Build components with TypeScript, add tests and Storybook as needed, and decide server vs client components
- Step 3: Run bundle analysis, swap heavy dependencies, and apply Next.js optimizations (image, server components) and accessibility improvements
Best Practices
- Default to Server Components; opt into Client Components only for event handlers, state, and effects
- Replace heavy libraries with lighter alternatives (moment -> date-fns/dayjs, lodash -> lodash-es, axios -> native fetch/ky, jquery -> native APIs, @mui/material -> lighter UI kits)
- Leverage Next/Image for above-the-fold performance with priority and responsive sizing
- Follow the Accessibility Checklist: semantic HTML, keyboard navigation, ARIA labels, color contrast, and visible focus indicators
- Maintain a consistent project structure (app, components, hooks, lib, types, tailwind.config.ts, next.config.js) aligned with scaffolder outputs
Example Use Cases
- Scaffold a Next.js 14+ app with App Router and Server Components using the CLI (--template nextjs) and features (--features forms, auth)
- Generate a client React component with TypeScript, tests, and a Storybook story (--type client, --with-test, --with-story)
- Audit and replace heavy dependencies: moment to date-fns, lodash to lodash-es, axios to native fetch
- Implement a Tabs component using the compound components pattern to share state across children
- Optimize a hero image with next/image, using priority for above-the-fold assets and a responsive fill layout