--- name: web-frontend description: "Build browser UIs with HTML, CSS, JS, Tailwind; test and debug via Playwright and Chrome DevTools." license: MIT metadata: kind: task author: Médéric HURIER (Fmind) source: github.com/fmind/dot/tree/main/skills/web-frontend created: "2026-09-03" updated: "2026-11-28" --- # Web Frontend Build calm browser UIs with native HTML, CSS, and JS. Default to `~/.agents/DESIGN.md` and [humanize](../humanize/SKILL.md) unless a brand exists; use native CSS for simple pages, [standalone Tailwind](references/tailwind.md) beyond one stylesheet, and preserve existing stacks. [python](../python/SKILL.md) ([fastapi](../python/references/fastapi/GUIDE.md), [django](../python/references/django/GUIDE.md), [litestar](../python/references/litestar/GUIDE.md)) owns backends; [playwright](references/playwright.md) owns E2E. ## Workflow 1. **Design system**: follow `~/.agents/DESIGN.md` (one primary action, flat hierarchy, inline states, minimal chrome); copy `~/.agents/themes/css/fmind.css` from [fmind/theme](https://github.com/fmind/theme/tree/main/themes) unchanged ([tailwind](references/tailwind.md) for Tailwind/DaisyUI). Lint/export tokens via `npx --yes @google/design.md@0.4.0 {lint|export --format dtcg|css-tailwind|css-vars} ~/.agents/DESIGN.md`. 1. **Native primitives**: prefer `
` (keep a chevron if hiding the marker), ``, Popover, Invoker Commands (`command`/`commandfor`, never with `popovertarget`), subgrid, container queries, and CSS nesting. Keep `popover` anchored and non-modal; reserve `dialog.showModal()` for modal confirmations. 1. **Platform guidance**: ```bash DISABLE_TELEMETRY=1 npx --yes modern-web-guidance@1.0.2 search "" DISABLE_TELEMETRY=1 npx --yes modern-web-guidance@1.0.2 retrieve "[,]" DISABLE_TELEMETRY=1 npx --yes modern-web-guidance@1.0.2 legacy-scan "" ``` 1. **Tailwind**: compile via [standalone Tailwind](references/tailwind.md) (zero Node, ~1 KB gzip overhead; reserve `npx` for guidance/token CLIs). 1. **Verify live**: inspect **empty, loading, error, and populated states** at `1440x900` and `390x844` via [chrome-devtools](references/chrome-devtools.md) (`scrollWidth <= innerWidth`); run `lighthouse_audit` + CWV/CLS trace; ship `` (prevents Lighthouse `errors-in-console`); verify `@font-face` (`document.fonts`) or system fallbacks; confirm zero errors, `>= 4.5:1` text / `>= 3:1` control contrast, and keyboard focus. ## Surface, A11y & Security Floors - **Security**: block DOM XSS sinks (`innerHTML`, `dangerouslySetInnerHTML`, `document.write`, `javascript:` URLs); ship nonce/hash `CSP`, `nosniff`, `frame-ancestors`, `Referrer-Policy`, `HttpOnly`/`Secure`/`SameSite` cookies, and `SRI` ([tailwind](references/tailwind.md) for strict-CSP HTMX). - **SEO & HTTP**: public pages set ``, `description`, `canonical`, `robots.txt`, `sitemap.xml`; private/admin/preview routes send `noindex` + `Cache-Control: private, no-store` (`is-crawlable` drops Lighthouse SEO to ~`60`; gate SEO on public routes); zero soft-`200` errors. - **A11y & forms**: set `<meta name="color-scheme">`, honor `prefers-reduced-motion`, enforce `>= 24x24px` visible targets + `:focus-visible` (`>= 44x44px` focused skip links), and keep input on error without leaking stacks. ## Task guides <!-- guides:start --> - [chrome-devtools](references/chrome-devtools.md): Debug Chrome via DevTools MCP/CLI: screenshots, console, network, CWV/Lighthouse, accessibility. - [playwright](references/playwright.md): Automate browsers/E2E tests via Playwright: screenshots, traces. - [tailwind](references/tailwind.md): Compile standalone Tailwind CSS in Python web apps via mise without Node. <!-- guides:end --> ## Gotchas - **Copy & numbers**: action verbs on buttons ("Save changes", not "Submit"), right-aligned `tabular-nums`, semantic delta colors, dashes for missing values vs `0`. - **Baselines**: verify on MDN (else Baseline Widely available + `@supports`). CSS nesting & core Popover are Widely available, Invoker Commands Newly available (Dec 2025), `<dialog closedby>` lacks Safari (keep Esc/button or JS fallback); Tailwind v4 needs Chrome ≥111, Safari ≥16.4, Firefox ≥128. - **Pin `modern-web-guidance`**: replace `@latest` in retrieved docs and upgrade all three commands together. ## Official Skills Upstream: `GoogleChrome/modern-web-guidance`; follow [vendor-skill policy](../agent-harnesses/references/vendor-skills.md). ## Documentation - [Modern Web Guidance](https://developer.chrome.com/docs/modern-web-guidance) · [repo](https://github.com/GoogleChrome/modern-web-guidance) · [npm](https://registry.npmjs.org/modern-web-guidance) · [Tailwind releases](https://github.com/tailwindlabs/tailwindcss/releases) - Copy/number rules adapted from [anthropics/skills frontend-design](https://github.com/anthropics/skills/blob/ca45fc496a3436251f191354091d557da31c15b5/skills/frontend-design/SKILL.md) (Apache-2.0) and [taste-skill app-screens](https://github.com/Leonxlnx/taste-skill/blob/12af471f627f866411b4bd785b19646d3672784c/skills/taste-skill/references/app-screens.md) (MIT). - Companion: [python/foundation](../python/references/foundation/GUIDE.md).