Build, design, and review web UIs, component design systems, and responsive layouts. Use for React, Next.js, Vite, Tailwind, WCAG, i18n and RTL, visual hierarchy, color palettes, anti-slop styling, animation, easing, motion, UI states, and masonry. Trigger on 'build this page', 'fix the hydration error', 'make it accessible', 'this UI looks generic', 'polish the UI'.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Frontend Engineering?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/juninmd-frontend-engineering)
---
name: frontend-engineering
description: |
Build, design, and review web UIs, component design systems, and responsive layouts. Use for React, Next.js, Vite, Tailwind, WCAG, i18n and RTL, visual hierarchy, color palettes, anti-slop styling, animation, easing, motion, UI states, and masonry. Trigger on 'build this page', 'fix the hydration error', 'make it accessible', 'this UI looks generic', 'polish the UI'.
---
# Frontend Engineering
**Not this skill:** choosing the framework or component library (`stack-selection`), rendering 3D on a canvas (`threejs`), or Core Web Vitals measurement (`performance-engineering`).
## Preflight
```bash
cat package.json | jq '{dependencies, devDependencies, scripts}' | head -40
ls next.config.* vite.config.* components.json tailwind.config.* 2>/dev/null
ls app/ pages/ src/ 2>/dev/null # App Router, Pages Router, or SPA
```
Framework and router decide where data may be fetched, where state may live, and what "server component" means here. Read this before writing a line.
## Workflow
1. Name the primary user task, its states, and its responsive behavior before building anything. Infer the design read and calibrate variance/motion/density dials with [anti-slop-taste](references/anti-slop-taste.md) to avoid generic defaults.
2. Keep server/client boundaries explicit. `'use client'` is a leaf decision — put it on the smallest component that needs it, because everything imported below it becomes client code too.
3. Implement loading, empty, error, disabled, overflow, and slow-network alongside the happy path. Enumerate them with [ui-state-design](references/ui-state-design.md).
4. Keep the UI layer thin: calculations and business policy live in domain modules, services, or hooks — not in JSX.
5. Verify keyboard, focus, responsive layout, a clean console, tests, and the production build. The dev build hides real failures.
## Hydration Mismatch
Server and client HTML differ, React discards the server markup, and the console names the node.
| Cause | Fix |
|---|---|
| `Date`, `Math.random`, `crypto` during render | compute in an effect, or pass a server-generated value down |
| `window`, `document`, `localStorage` during render | `useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)`, where getServerSnapshot returns the value the server rendered. Omitting it makes server rendering throw; omit only inside a Suspense boundary, to force client rendering. Or render after mount. |
| Locale/timezone formatting | format on one side only, or pin the locale explicitly |
| Invalid nesting (`<div>` in `<p>`, `<p>` in `<p>`) | fix the markup — the browser silently rewrites the tree |
| Extension-injected markup | reproduce in a clean profile before chasing it |
`suppressHydrationWarning` is allowed only on the leaf element whose content is a known, unavoidable mismatch, such as a client-local timestamp, as the React docs describe; it works one level deep. Never put it on a parent to hide a bug — that hides the real divergence and every future one under the same subtree.
## State That Should Not Be State
| Instinct | Do instead |
|---|---|
| `useEffect` to derive B from A | compute during render |
| `useEffect` to sync props into state | read the prop; key the component to reset |
| `useState` for server data | the framework's data layer or a query cache |
| `useEffect` to fetch on mount | server component, loader, or query library |
An effect for derived state produces one extra render and a window where the two disagree.
## Reference Routing
Open a file only when its trigger matches.
- Any component work: [ui-components.md](references/ui-components.md).
- Anti-slop UI direction, dials, and redesign audits: [anti-slop-taste.md](references/anti-slop-taste.md).
- Choosing native CSS/HTML over a library, adopting a newer platform feature (container queries, `@layer`, popover, anchor positioning, View Transitions), Baseline gating, WCAG/DTCG/Core Web Vitals targets: [modern-web-platform.md](references/modern-web-platform.md).
- Open UX brief for an app, or a polish pass (theming, one-tap flows, motion roles, command palette, status color): [app-ux-patterns.md](references/app-ux-patterns.md).
- `app/` directory: [nextjs-app-router.md](references/nextjs-app-router.md) — server/client boundaries, streaming, caching, actions.
- `components.json` (shadcn/ui): discovery, installation, and extending primitives in [shadcn-integration.md](references/shadcn-integration.md).
- `vite.config.*`: [vite-core.md](references/vite-core.md), [vite-patterns.md](references/vite-patterns.md); Tailwind v4 there: [vite-tailwind-v4.md](references/vite-tailwind-v4.md).
- Polish, standardize, or perfect an existing UI (one design system, alignment and CSS fixes, UX, before/after screenshots): [ui-polish-pass.md](references/ui-polish-pass.md).
- Reviewing UI: [frontend-review.md](references/frontend-review.md); slow UI, heavy bundles, or any Server Action: [frontend-optimization.md](references/frontend-optimization.md).
- Behavior that should work but does not: [real-world-cases.md](references/real-world-cases.md).
See [Reference Map](references/TOPIC_MAP.md) for specialized references and sub-domain guides.
## Stop
- A hydration warning appears in the console. Fix the divergence; `suppressHydrationWarning` belongs only on the leaf of a known, unavoidable mismatch, never on a parent.
- A secret or server-only value would cross into a client component. Stop before it ships to every browser.
- Only the dev build was verified. Verify against the production build — StrictMode and minification change behavior.
## Rules
- Hand off API contracts to `backend-systems`, end-to-end tests to `test-engineering`, mobile apps to `mobile-engineering`, and performance budgets to `performance-engineering`.
- Preserve the repository's design system. Never add a second component stack casually — two stacks is a permanent tax on every future component.
- A secret read in a client component ships to the browser. Environment variables without the public prefix are server-only for a reason; check before moving code across the boundary.
- `key` on a list must be stable and identity-bearing. Array index as key corrupts state whenever the list reorders.
- Delegate accessibility to [accessibility](references/accessibility.md), runtime and bundle cost to `performance-engineering`, visual system decisions to [frontend-design](references/frontend-design.md), and native or cross-platform mobile apps to `mobile-engineering`. Do not restate their rules here.
- Verify against the production build. Dev-only warnings, double-invoked effects in StrictMode, and unminified behavior all differ.
## Checklist
- [ ] Framework, router, and component system read before writing.
- [ ] `'use client'` sits on the smallest component that needs it; no secret crosses the boundary.
- [ ] Main, loading, empty, error, and slow-network states all work.
- [ ] No hydration warning in the console; any `suppressHydrationWarning` sits on a leaf with a known, unavoidable mismatch.
- [ ] No effect used for derived state; list keys stable.
- [ ] Keyboard, focus, and responsive checks pass; tests and the production build are clean.