agentleFS
tadoEngtadoEng/web-starter/.claude/skills/frontend-page/SKILL.md

frontend-page

Skill2 starsChanged 4 months agoMITView on GitHub

Add or change a page, screen, form, table or component in this product's React frontend, with the five async states and the accessibility floor. Use when asked to build a page, add a route, create a form, show a list or table, or change the UI.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read AGENTS.md first. The frontend owns presentation and client state.

    line 11
  2. Very specific:

    If the endpoint doesn't exist yet, use the api-endpoint skill first — do not work around a missing endpoint from the client side.

    line 18
  3. Very specific:

    Every input has a real <label>.

    line 47
  4. Distinctive:

    Every interactive element keyboard-reachable and operable, in sensible order.

    line 53
  5. Distinctive:

    Never convey state by colour alone.

    line 58
  6. Distinctive:

    Every screen must work at 375px and at desktop width.

    line 64
  7. Very specific:

    Use relative units and max-width: 100% on media.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

Frontend page or component

Read AGENTS.md first. The frontend owns presentation and client state. It does not own business rules, authorization, or data shapes.

Steps

  1. Route in frontend/src/routes/, registered with React Router.
  2. Data via a TanStack Query hook in frontend/src/api/, built on the generated client. If the endpoint doesn't exist yet, use the api-endpoint skill first — do not work around a missing endpoint from the client side.
  3. UI from shadcn/ui primitives in frontend/src/components/ui/, composed in frontend/src/components/. Prefer an unmodified primitive over a bespoke one.
  4. Forms: React Hook Form + the generated Zod schema from src/generated/api-client/zod.gen.ts. Zod is generated precisely so the shape is never written twice — never hand-write one that mirrors the request type. For presentation-only constraints (confirm-password, a client-side max), .extend() or .refine() the generated schema rather than copying its fields.
  5. Tests: Vitest + React Testing Library. Query by role and label.
  6. ./scripts/verify.sh, then verify in the browser and attach a screenshot.

The five states — all of them, every async surface

StateRequirement
LoadingSkeleton sized like the real content, so layout doesn't jump
EmptySays what would appear here and how to create the first one
ErrorThe message from the error contract, plus retry where retry helps
SuccessThe content; for mutations, a confirmation the user can notice
DisabledButtons disable while a mutation is in flight — no double submits

A screen that renders only the happy path is not finished. Optimistic updates need a rollback path or they are a bug.

Forms

  • Field errors map from 422 responses, not just client validation. A form that silently fails a server rejection is worse than a crash.
  • Every input has a real <label>. A placeholder is not a label.

Accessibility floor

Cheap to get right, expensive to retrofit:

  • Every interactive element keyboard-reachable and operable, in sensible order.
  • Visible focus ring — never outline: none without a replacement.
  • aria-label on icon-only buttons.
  • Contrast 4.5:1 body, 3:1 large text and UI borders.
  • Dialogs trap focus, close on Escape, return focus to the trigger.
  • Never convey state by colour alone.

Testing by role and label keeps most of this honest automatically.

Responsive — a hard gate, not a finish

Every screen must work at 375px and at desktop width.

  • The page body never scrolls horizontally. Wide content — tables, charts, code, long unbroken strings — scrolls inside its own overflow-x: auto container.
  • Decide desktop → tablet → mobile per surface. Navigation, tables, forms, toolbars, dialogs and charts each need an actual decision, not whatever flexbox does by default.
  • A six-column table becomes compact record rows on mobile, or scrolls in its own container. Both are legitimate; a horizontally crushed table is not.
  • Use relative units and max-width: 100% on media. Test with a long title and a null optional field, not just the comfortable middle.

frontend/e2e/smoke.spec.ts enforces the no-overflow rule at 375px mechanically. Do not weaken that test to make a layout pass — that inverts the gate into a rubber stamp.

Ship visual work with a desktop screenshot and a 375px screenshot. For layout-led work, use the frontend-craft skill instead of this one.

Stop

Hiding a control because of a role is UX only — the backend must reject the action independently and have a test proving it. If you find yourself writing a business rule in a component, it belongs on the backend.

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.