agentleFS
rkalievrkaliev/eng-kit/skills/web-frontend/SKILL.md

web-frontend

Skill1 starsChanged 13 days agoMITView on GitHub

Use when building, changing or reviewing web UI - components, pages, forms, client-side state, routing, browser behavior, keyboard shortcuts or frontend performance

10 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 6 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow the project's architecture: Keep its layering (for example FSD), its state manager and data-fetching layer, and its component …

    line 12
  2. Very specific:

    Use native button, a href, input/select/textarea and form, not clickable divs.

    line 18
  3. Very specific:

    Every control has an accessible name: a visible label, or aria-label when there is no visible text.

    line 19
  4. Distinctive:

    Every data view has loading, empty, error and success states.

    line 31
  5. Distinctive:

    Prefer familiar controls; a custom widget follows its WAI-ARIA Authoring Practices pattern.

    line 34
  6. Very specific:

    Stale results: when requests overlap (search typing, tab switching), only the latest may win.

    line 38
  7. Distinctive:

    Keep interactions responsive: move long tasks to a Web Worker or chunk them.

    line 46
  8. Very specific:

    Never render untrusted HTML without sanitizing it (DOMPurify or the framework's safe path).

    line 53
  9. Very specific:

    No secrets in the bundle; everything in the client is public.

    line 54
  10. Distinctive:

    No PII or tokens in URLs, logs, error reports or analytics.

    line 55
  11. Distinctive:

    Add these to code review for UI diffs:

    line 68

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Web frontend

A web UI runs on browsers and devices you don't control, for people and browser agents. It must be operable, predictable under slow or overlapping requests, and verified in the browsers the product targets.

Always

  • Follow the project's architecture. Keep its layering (for example FSD), its state manager and data-fetching layer, and its component library and design tokens. A new screen copies an existing screen's structure. Don't introduce a second state or styling approach.
  • Browser targets come from the project (browserslist, CONTRIBUTING, CLAUDE.md), not from memory. Features outside them need a fallback or the user's agreement.
  • Read the design context first (design.md or design-system docs). Tokens, component variants, fonts and destructive-action copy: references/design-system.md. State, optimistic updates, placeholders, time zones and the client/server boundary: references/state-and-data.md. Animation and gestures: ui-motion.

Semantics and accessibility: the practical minimum

  • Use native button, a href, input/select/textarea and form, not clickable divs. Links navigate; buttons act.
  • Every control has an accessible name: a visible label, or aria-label when there is no visible text. Icon-only buttons included.
  • States and errors are exposed:
    • disabled, aria-expanded, aria-pressed, aria-invalid;
    • error text linked with aria-describedby;
    • async status announced via aria-live where the user would otherwise miss it.
  • Keyboard: everything works by keyboard, focus is visible, and it moves deliberately (into dialogs, back to the trigger on close, to the first error on submit). No focus traps outside modals.
  • Logical headings (one h1, no skipped levels for styling) and landmarks (header, nav, main).
  • alt text for meaningful images; empty alt for decorative ones.
  • Browser and AI agents act through the accessibility tree too. Native semantics first; ARIA only for a concrete benefit.

Standard interaction patterns

  • Every data view has loading, empty, error and success states. Errors say what happened and how to recover.
  • Navigation behaves consistently: Back works, URLs reflect shareable state (filters, tabs), and deep links load.
  • App shortcuts must not break text editing. Inside input, textarea and contenteditable, leave copy/paste, select-all, undo/redo and caret movement alone. Scope global shortcuts, and check event.target and isComposing (IME input).
  • Prefer familiar controls; a custom widget follows its WAI-ARIA Authoring Practices pattern.

Async reliability

  • Stale results: when requests overlap (search typing, tab switching), only the latest may win. Cancel with AbortController, or ignore responses that are no longer current.
  • Cancellation and cleanup: abort requests and unsubscribe on unmount or route change. Clear timers, observers, listeners and object URLs.
  • Double submit: disable the control or deduplicate while pending. Mutations that can repeat carry an idempotency key (payments-and-money).
  • Ordering: effects don't finish in start order; derive state from the result and its request id.
  • Retry only idempotent requests, with backoff. Show an offline or failed state instead of spinning forever.

Performance

  • Keep interactions responsive: move long tasks to a Web Worker or chunk them. Virtualize large lists and tables.
  • Profile before memoizing; then fix the cause (unstable props, selector granularity), not every component.
  • Release buffers, canvases, blobs and detached DOM on large documents.
  • Bundle budgets are measured on the built, compressed artifact, not a bundler's summary; raising one is a reviewed change with the measurement. Lazy-load heavy routes. No new large dependency without the user's approval.

Security and privacy

  • Never render untrusted HTML without sanitizing it (DOMPurify or the framework's safe path). Treat innerHTML/dangerouslySetInnerHTML, eval, and URLs from user data (javascript:) as sinks.
  • No secrets in the bundle; everything in the client is public. Tokens go in httpOnly cookies where the architecture allows it. Justify anything placed in localStorage.
  • No PII or tokens in URLs, logs, error reports or analytics. Respect consent before loading trackers.
  • Validate data from APIs at the boundary. See security-review.

Verification ladder

Report which rungs you actually ran:

  1. Unit tests for logic, and component tests that query by role and label (Testing Library style). This also checks accessible names.
  2. Typecheck, lint (including a11y lint rules if the project has them), and a production build.
  3. End-to-end tests (Playwright or the project's tool) for critical flows, including keyboard-only paths.
  4. Manual check in the target browsers and viewport sizes, with screenshots for UI changes. Name the browsers you used.

Review points

Add these to code review for UI diffs:

  • Clickable non-controls.
  • Missing labels or names.
  • Hidden error states.
  • Broken keyboard access or focus.
  • Missing loading, empty or error states.
  • Shortcuts that hijack text editing.
  • Stale-result races, missing cleanup, double submit.
  • Unsanitized HTML.
  • PII in analytics.
  • Unjustified bundle growth.
  • Motion on frequent or keyboard actions (ui-motion), optimistic payments, silent rollbacks.

A visible slowdown in responsiveness is a blocker, not a suggestion.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.