senior-frontend
Use when the user needs production-grade React/Next.js/TypeScript development with rigorous component architecture, state management, performance optimization, and >85% test coverage. Triggers: React component development, Next.js page creation, state management design, frontend performance audit, component library setup.
What this skill does
# Senior Frontend Engineer
## Overview
Deliver production-grade frontend code following a structured three-phase workflow: context discovery, development, and handoff. This skill enforces strict quality standards including atomic design component architecture, comprehensive state management patterns, SSR/SSG/ISR optimization, and mandatory >85% test coverage with Vitest, React Testing Library, and Playwright.
**Announce at start:** "I'm using the senior-frontend skill for production-grade React/TypeScript development."
---
## Phase 1: Context Discovery
**Goal:** Understand the existing codebase before writing any code.
### Actions
1. Analyze existing codebase structure and conventions
2. Identify the tech stack version (React 18/19, Next.js 14/15, TypeScript version)
3. Review existing component library and design system
4. Check state management approach already in use
5. Understand build tooling and CI pipeline
6. Map existing test infrastructure and coverage
### STOP — Do NOT proceed to Phase 2 until:
- [ ] Tech stack versions are identified
- [ ] Existing patterns and conventions are documented
- [ ] Test infrastructure is mapped
- [ ] State management approach is identified
---
## Phase 2: Development
**Goal:** Implement with strict TypeScript, atomic design, and TDD.
### Actions
1. Design component architecture following atomic design
2. Implement with TypeScript strict mode
3. Write tests alongside implementation (TDD when appropriate)
4. Optimize for performance (bundle size, rendering, loading)
5. Ensure accessibility compliance
### Component Architecture Decision Table (Atomic Design)
| Level | Description | Business Logic | Example |
|-------|------------|---------------|---------|
| **Atoms** | Smallest building blocks | None | Button, Input, Icon, Badge |
| **Molecules** | Composed of atoms | Minimal | FormField, SearchBar, Card |
| **Organisms** | Complex with business logic | Yes | DataTable, NavigationBar, CommentThread |
| **Templates** | Page structure without data | Layout only | DashboardLayout, AuthLayout |
| **Pages** | Templates connected to data | Data fetching | UsersPage, SettingsPage |
### Atom Example
```typescript
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
size?: 'sm' | 'md' | 'lg';
isLoading?: boolean;
}
export function Button({ variant = 'primary', size = 'md', isLoading, children, ...props }: ButtonProps) {
return (
<button className={cn(buttonVariants({ variant, size }))} disabled={isLoading || props.disabled} {...props}>
{isLoading ? <Spinner size={size} /> : children}
</button>
);
}
```
### State Management Decision Table
| State Type | Solution | When to Use |
|------------|----------|-------------|
| Server state | React Query / TanStack Query | API data, caching, sync |
| Form state | React Hook Form + Zod | Form validation, submission |
| Global UI state | Zustand | Theme, sidebar open, modals |
| Local UI state | useState / useReducer | Component-specific state |
| URL state | nuqs / useSearchParams | Filters, pagination, tabs |
| Complex local | useReducer | Multiple related state transitions |
| Shared context | React Context | Theme, locale, auth (infrequent updates) |
### SSR / SSG / ISR Decision Table (Next.js App Router)
| Pattern | Use When | Cache Strategy |
|---------|----------|---------------|
| Static (SSG) | Content rarely changes | Build time |
| ISR | Content changes periodically | Revalidate interval |
| SSR | Content changes per request | No cache |
| Client | User-specific, interactive | Browser |
### Server vs Client Component Decision
| Need | Component Type |
|------|---------------|
| Direct data fetching | Server (default) |
| Event handlers (onClick, onChange) | Client (`'use client'`) |
| useState / useReducer | Client |
| useEffect / useLayoutEffect | Client |
| Browser APIs (window, localStorage) | Client |
| Third-party libs using client features | Client |
| No interactivity needed | Server (default) |
### STOP — Do NOT proceed to Phase 3 until:
- [ ] Components follow atomic design hierarchy
- [ ] TypeScript strict mode is enabled, no `any` types
- [ ] Tests are written for all components
- [ ] Accessibility is verified (axe-core)
---
## Phase 3: Handoff
**Goal:** Verify quality gates and prepare for review.
### Actions
1. Verify test coverage meets >85% threshold
2. Run full lint and type check
3. Document complex components with JSDoc/TSDoc
4. Create Storybook stories for UI components
5. Performance audit (Lighthouse, bundle analysis)
### Performance Checklist
- [ ] Bundle size < 200KB gzipped (initial load)
- [ ] Largest Contentful Paint < 2.5s
- [ ] First Input Delay < 100ms
- [ ] Cumulative Layout Shift < 0.1
- [ ] Images: next/image with proper sizing and formats
- [ ] Fonts: next/font with display swap
- [ ] No layout thrashing (batch DOM reads/writes)
- [ ] Virtualization for lists > 100 items
### Coverage Thresholds
```json
{
"coverageThreshold": {
"global": {
"branches": 85,
"functions": 85,
"lines": 85,
"statements": 85
}
}
}
```
### STOP — Handoff complete when:
- [ ] Test coverage >85% verified
- [ ] Lint and type check pass with zero errors
- [ ] Performance audit completed
- [ ] Complex components documented
---
## Testing Requirements
### Unit Tests (Vitest + React Testing Library)
```typescript
describe('Button', () => {
it('renders children', () => {
render(<Button>Click me</Button>);
expect(screen.getByRole('button', { name: 'Click me' })).toBeInTheDocument();
});
it('shows loading state', () => {
render(<Button isLoading>Click me</Button>);
expect(screen.getByRole('button')).toBeDisabled();
});
it('calls onClick when clicked', async () => {
const onClick = vi.fn();
render(<Button onClick={onClick}>Click me</Button>);
await userEvent.click(screen.getByRole('button'));
expect(onClick).toHaveBeenCalledOnce();
});
});
```
### Integration Tests
- Component compositions (form submission flow)
- Data fetching with MSW (Mock Service Worker)
- Routing and navigation
- Error boundaries and fallbacks
### E2E Tests (Playwright)
```typescript
test('user can complete checkout', async ({ page }) => {
await page.goto('/products');
await page.getByRole('button', { name: 'Add to cart' }).first().click();
await page.getByRole('link', { name: 'Cart' }).click();
await expect(page.getByText('1 item')).toBeVisible();
await page.getByRole('button', { name: 'Checkout' }).click();
});
```
---
## React Query Patterns
```typescript
function useUsers(filters: UserFilters) {
return useQuery({
queryKey: ['users', filters],
queryFn: () => fetchUsers(filters),
staleTime: 5 * 60 * 1000,
placeholderData: keepPreviousData,
});
}
function useUpdateUser() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: updateUser,
onMutate: async (newUser) => {
await queryClient.cancelQueries({ queryKey: ['users'] });
const previous = queryClient.getQueryData(['users']);
queryClient.setQueryData(['users'], (old) =>
old.map(u => u.id === newUser.id ? { ...u, ...newUser } : u)
);
return { previous };
},
onError: (err, newUser, context) => {
queryClient.setQueryData(['users'], context.previous);
},
onSettled: () => {
queryClient.invalidateQueries({ queryKey: ['users'] });
},
});
}
```
---
## Memoization Decision Table
| Technique | Use When | Do NOT Use When |
|-----------|----------|----------------|
| `useMemo` | Expensive computation, referential equality for deps | Simple calculations, primitive values |
| `useCallback` | Functions passed to memoized children | Functions not passed as props |
| `React.memo` | Component re-renders often with same props | Props change on every render |
| None | Default — do not memoize | Always profiRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.