Frontend Engineering
ASecurityFrontend engineering for web and mobile apps — rendering strategy (client, server, static), component architecture, state management, data fetching, routing, forms and validation, error boundaries, TypeScript strictness, browser support policy, internationalisation, offline and PWA, client-side security, bundle and performance budgets, frontend testing and mobile/cross-platform delivery. Use when the user says "frontend", "React", "Next.js", "Vue", "Svelte", "Angular", "state management", "fo...
- 3 stars
- 0 votes
- 0 copies
- 1 view
- Added December 1, 2026
Works with
Security analysis
100/100Pro scans all 4 files and shows the line behind each finding
npx -y skills add Kin9Zeus/senior-engineer-skills --skill frontend-engineering --agent claude-codeAre 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/kin9zeus-frontend-engineering)---
name: frontend-engineering
description: Frontend engineering for web and mobile apps — rendering strategy (client, server, static), component architecture, state management, data fetching, routing, forms and validation, error boundaries, TypeScript strictness, browser support policy, internationalisation, offline and PWA, client-side security, bundle and performance budgets, frontend testing and mobile/cross-platform delivery. Use when the user says "frontend", "React", "Next.js", "Vue", "Svelte", "Angular", "state management", "forms", "routing", "SSR or SPA", "component structure", "folder structure", "TypeScript", "i18n", "PWA", "responsive", "browser support", "build the UI", "React Native", "Flutter", "mobile app", "desktop app", "front-end", "interfaz", "componentes" or "estado de la aplicación"; when implementing designed screens; and in phase 5 of any new project. By Devleck.
license: MIT
---
# Frontend Engineering
The frontend is where design meets the network, the device and the user's patience.
Most frontend failures are not framework mistakes — they are **missing states, unhandled
failure, unbounded data, inaccessible controls and secrets in the bundle**.
**Scope:** the user's own app. Framework names below are examples; versions and APIs
change quickly — **check the current documentation** and the project's own lockfile
rather than assuming. Pair with `ux-ui-design` (what to build), `accessibility-audit`,
`performance-engineering`, `security-hardening` and `testing-strategy`.
---
## The order of work
```
1 DECIDE rendering strategy, framework, language strictness, browser/device policy
2 STRUCTURE folders, module boundaries, naming, import rules
3 FOUNDATION tokens → base components → layout shell → routing → error/loading shells
4 DATA a typed API client, caching rules, mutation and error handling
5 STATE put each kind of state in the right place (see below)
6 SLICES build features end to end with every state from the screen spec
7 QUALITY tests, accessibility, performance budgets, bundle analysis
8 SHIP env/config, build, source maps, error tracking, CSP, deploy preview
```
Build the **shell and one real slice** first (phase 4/5): routing, layout, auth
handling, an error boundary, a loading pattern, a form, a list with pagination. Every
later feature copies it.
---
## 1. Decide deliberately (record ADRs)
**Rendering strategy** — decide per route, not per app:
| Need | Usually | Because |
|---|---|---|
| Public, SEO/GEO-critical, mostly static content | Static generation or server rendering | Crawlers and AI assistants read HTML; fastest first paint |
| Personalised, behind login, app-like | Client-rendered app (or server components for the data parts) | SEO irrelevant; interactivity matters |
| Mixed (marketing + app) | One framework with per-route modes, or two apps on one domain | Don't SSR a dashboard to please a landing page |
| Content that changes rarely | Static + revalidation | Cheap and fast |
**Rule:** anything that must be found by search engines or AI assistants must be
**readable without running JavaScript**. View the page with JS disabled to check.
**Language:** TypeScript with `strict` on from day one (or an equally strict typed
setup). Parse and validate data at the boundary (schema library) and derive types from
the schema — types alone do not check runtime data.
**Browser and device policy:** write down which browsers/versions and devices are
supported (look at your analytics or audience; default to current evergreen browsers
and the platform's supported mobile versions). Test the lowest supported tier. Use
feature detection and progressive enhancement, not user-agent sniffing.
**Boring over novel.** Pick the framework the team knows with a healthy ecosystem; avoid
pre-1.0 foundations for production unless it is the differentiator. Fewer dependencies
beat more; every dependency is code you ship to every user.
Details: `references/architecture-and-state.md`.
## 2. Structure
- **Feature-oriented folders** (`features/billing/{components,hooks,api,tests}`) with a
small shared `ui/` (design-system components) and `lib/`. Layer rules: features may
import shared; shared may not import features; features do not import each other's
internals (use a public index).
- **Components:** small, presentational where possible; container logic in hooks;
props typed and minimal; no business rules in JSX; one component, one reason to change.
- **Naming and conventions** written once (file names, exports, hooks prefixes), enforced
by linter and formatter.
- **Path aliases** and an import-boundary lint rule keep the graph clean.
## 3. State — put each kind in its place
| Kind | Examples | Home |
|---|---|---|
| **Server state** | users, orders, lists from the API | A data-fetching/cache layer (query library or the framework's loaders) with keys, staleness, retries, invalidation — **not** hand-rolled in global state |
| **URL state** | filters, page, tab, selected id | The URL (shareable, back-button friendly) |
| **Form state** | inputs, touched, errors | A forms library or controlled state scoped to the form |
| **UI state** | modal open, hover, accordion | Local component state |
| **Global client state** | auth session, theme, feature flags | A small store/context; keep it tiny |
| **Persistent** | draft, preferences | localStorage/IndexedDB *only for non-sensitive data*; wrap in try/catch (it can be unavailable) |
Most "state management problems" are server state kept in the wrong place.
## 4. Data fetching and mutations
- One **typed API client** (generated from the OpenAPI schema if you have one —
`api-contracts`); central handling of auth headers, timeouts, retries with backoff for
idempotent calls, error mapping.
- **Every request has: loading, success, empty, error, and cancelled/stale behaviour.**
- **Optimistic updates** only when rollback is clear; always reconcile with the server.
- **Pagination/infinite scroll/virtualisation** for lists that can grow; never render
10 000 rows.
- **Debounce** search input; **cancel** superseded requests; **dedupe** identical ones.
- Don't trust the client: all authorisation and validation is repeated on the server.
## 5. Forms and validation
Labels, `type`, `autocomplete`, inline validation after blur with specific messages,
summary of errors, focus the first error, keep input on failure, prevent double submit,
disable only while submitting, show progress for long saves. Validate with the **same
schema** as the API where possible (shared package or generated), but never *only* on the
client. File uploads: show progress, size/type limits, retry, accessible fallback.
## 6. Errors, loading and resilience
- **Error boundaries** at route and widget level with a useful fallback and a reload
action; report to error tracking with release and a request id.
- **Global handlers** for unhandled rejections and failed chunk loads (stale deploy → offer
refresh).
- **Suspense/skeletons** shaped like content; no layout shift.
- **Offline and flaky networks:** detect, tell the user, queue writes where it makes
sense, retry safely (idempotency keys).
- **Never swallow errors** silently; never show raw stack traces or server messages.
## 7. Security in the browser
- **No secrets in the bundle.** Anything shipped to the browser is public — including
`NEXT_PUBLIC_`/`VITE_`/`PUBLIC_` variables. API keys for paid services go behind your
server.
- **XSS:** framework auto-escaping on; every `dangerouslySetInnerHTML`/`v-html`/`innerHTML`
justified and sanitised with a maintained library; URLs from users validated against a
scheme allowlist.
- **Tokens:** prefer HttpOnly, Secure, SameSite cookies for sessions over tokens in
`localStorage`; if tokens must be in JS, keep them short-lived and in memory.
- **CSP** without `unsafe-inline`/`unsafe-eval`, using nonces/hashes; third-party scripts
minimal, with Subresource Integrity where supported.
- **Dependencies:** lockfile, audit in CI, no unvetted packages (typosquats), check install
scripts.
- **postMessage / iframes / redirects:** check origins; allowlist redirect targets.
- `security-hardening/references/security-headers.md` for headers.
## 8. Performance — budgets, not hopes
Set budgets in the PRD and enforce them in CI: Core Web Vitals targets (LCP, INP, CLS),
JS size per route, image weight, request count. Techniques in `performance-engineering`;
the frontend habits that matter most: **ship less JavaScript** (route-level code
splitting, no big libraries for small jobs), **optimise images** (responsive, modern
formats, `width`/`height`, lazy below the fold, priority for the LCP image),
**self-host and subset fonts**, **avoid layout shift**, **defer third-party scripts**,
**cache static assets with hashed filenames**.
## 9. Accessibility in code
Semantic HTML first (button, a, form, headings, landmarks), ARIA only when HTML cannot
express it; keyboard operability for every control; focus management on route changes and
dialogs; accessible names; live regions for async messages; respects reduced motion and
zoom; lint with an accessibility plugin and test with an automated checker **plus** a
keyboard and screen-reader pass (`accessibility-audit`).
## 10. Internationalisation and metadata
Externalise strings from day one if more than one language is plausible; use the
platform `Intl` APIs for dates, numbers, plurals, currency; logical CSS properties for
RTL; locale in the URL for public pages with `hreflang`. Per-route **titles, descriptions,
canonical, Open Graph** and structured data are frontend work (`web-presence-audit`).
## 11. Testing and delivery
Component tests for behaviour (not implementation), integration tests for flows with a
mocked network boundary, **E2E for the critical journeys** in a real browser, visual
regression for the design system if it pays off, accessibility checks in CI.
`references/quality-and-delivery.md` covers tests, build, env, source maps, error
tracking, feature flags and deploy previews.
## 12. Mobile, desktop and cross-platform
If the product ships as a mobile or desktop app, `references/mobile-and-cross-platform.md`
covers the decision (native vs cross-platform vs PWA), offline, permissions, push, deep
links, signing, store review (check current store policies), updates and crash reporting.
---
## What people get wrong
- **Only the happy path** — no loading, empty, error or offline states.
- **Server state in global state**, then manual cache invalidation bugs forever.
- **A SPA for a content site**, then "why doesn't Google/AI cite us?".
- **Secrets in public env variables.**
- **Huge dependencies for small features**; nobody looks at the bundle until it is 3 MB.
- **Div soup** — clickable `div`s, no labels, no focus handling.
- **Types without validation** — the API returns something else at runtime.
- **Premature global state/microfrontends/monorepo tooling.**
- **Ignoring the lowest supported device.**
- **No error tracking in production**, so the first bug report is a customer's angry email.
## Report format
Findings: **location → problem → who it hurts → fix → verification** (a test, a
Lighthouse/CWV number, or a manual keyboard/screen-reader check). End with **What I
could not verify** (browsers/devices not tested, real-user performance).
---
## References
- `references/architecture-and-state.md` — rendering, folders, boundaries, state taxonomy, data layer, forms, routing, TypeScript, error handling
- `references/quality-and-delivery.md` — testing, budgets, build/config, source maps, error tracking, flags, i18n, PWA, deploy previews
- `references/mobile-and-cross-platform.md` — native vs cross-platform vs PWA, offline, permissions, push, signing, stores, updates
- Related: `ux-ui-design`, `accessibility-audit`, `performance-engineering`, `security-hardening`, `testing-strategy`, `web-presence-audit`, `api-contracts`
Files in this skill
- SKILL.md
- references/architecture-and-state.md
- references/mobile-and-cross-platform.md
- references/quality-and-delivery.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.