agentleFS
robo311robo311/devflow/skills/fe-rules/SKILL.md

fe-rules

Skill1 starsChanged 24 days agoMITView on GitHub

Rules for frontend code: design, state and data flow, loading/error/empty states, API types, components, forms, accessibility, SEO for public pages, client-side security and performance. Use when implementing or changing UI code, and when judging whether it follows them.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow the project's existing design: its design system or UI kit, tokens, typography, spacing, layout patterns and component look.

    line 12
  2. Distinctive:

    Keep one source of truth for each piece of state.

    line 17
  3. Distinctive:

    Keep server data (fetched, cached) apart from UI state (open, selected, draft), using the project's store or data-fetching pattern.

    line 18
  4. Distinctive:

    Every view that loads data has a loading state, an error state and an empty state, shown the way the project already shows them.

    line 23
  5. Distinctive:

    Use the project's generated or shared API types.

    line 28
  6. Distinctive:

    No requests in loops where one request would do.

    line 60
  7. Distinctive:

    Only for pages search engines are meant to index.

    line 64
  8. Distinctive:

    No secrets in client code or bundles.

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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 rules

These add to code-rules for UI code, under the same priority: the developer's instructions and the plan first, then the project's docs (CLAUDE.md, AGENTS.md, docs/), then its existing frontend code and conventions, then these rules. Apply each rule where its subject exists in the task.

Design

  • Follow the project's existing design: its design system or UI kit, tokens, typography, spacing, layout patterns and component look. A new screen looks like it belongs, unless the developer asked for something different.
  • Colours, spacing and breakpoints come from the project's tokens or theme, not literals.

Data and state

  • Keep one source of truth for each piece of state; derive values instead of copying them into new state.
  • Keep server data (fetched, cached) apart from UI state (open, selected, draft), using the project's store or data-fetching pattern.
  • State worth sharing or restoring (filters, pagination, selected tab) lives in the URL when the project does that elsewhere.

Async UI

  • Every view that loads data has a loading state, an error state and an empty state, shown the way the project already shows them.
  • Actions that call the server show progress, block double submission, and report failure to the user.

API contract

  • Use the project's generated or shared API types; when the backend part of the same task changes the contract, build on its final shape from that part's report.
  • Optional and nullable fields in the contract are handled as real states, not assumed present.

Components

  • A component renders and wires events; logic that is not about rendering lives in the project's composables, hooks or services.
  • Props go down, events go up; a child does not reach into its parent's state.

Forms

  • Client validation mirrors the backend rules and shows messages next to the field; the backend stays the authority.
  • Invalid fields carry aria-invalid and aria-describedby pointing at their message; after a failed submit, focus moves to the first invalid field or the error summary; an error is never shown by colour alone.
  • Inputs use the most specific type and a correct autocomplete token (email, current-password, new-password, one-time-code, ...); pasting is never blocked.
  • The user's input survives a failed submit.

Accessibility

  • Semantic elements first (button for actions, a for navigation, labelled form controls).
  • Everything works with the keyboard, focus is visible and moves sensibly after dialogs and route changes, images have meaningful alt.
  • Icon-only buttons and links have an accessible name (aria-label or visually hidden text); the decorative icon inside gets aria-hidden="true".
  • Modals use the native <dialog> with showModal(), or make the background inert, so focus cannot leave the open dialog.
  • Messages that appear without moving focus (saved, toasts, async errors) go into a live region (role="status", or role="alert" for errors) that is already in the page before the message is inserted.
  • Animations, carousels and autoplaying media respect prefers-reduced-motion.

Text and formatting

  • User-facing text goes through the project's i18n when it has one.
  • Dates, numbers and currency are formatted with Intl or the project's i18n, with an explicit locale and time zone, so server and client render the same.

Media and performance

  • Images have width and height (or a reserved aspect ratio); images below the first screen load lazily, the main above-the-fold image never does.
  • No requests in loops where one request would do; heavy routes and components load lazily when the project does that.

SEO (public, indexable pages)

Only for pages search engines are meant to index; skip for apps behind a login.

  • Each route has its own <title>, meta description, canonical URL and Open Graph tags, present in the server-rendered HTML together with the main content and real <a href> links.
  • A missing resource answers with HTTP 404 or 410, not a 200 page saying "not found" and not a redirect to the home page.
  • Staging, preview and admin pages carry noindex.

Security

  • Untrusted data never reaches raw HTML (v-html, innerHTML, dangerouslySetInnerHTML) unsanitised.
  • No secrets in client code or bundles.

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.