agentleFS
Vimalk0703Vimalk0703/shipworthy/skills/frontend/frontend-standards/SKILL.md

frontend-standards

Skill6 starsChanged 8 months agoMITView on GitHub

Component patterns, state management, styling conventions, and rendering strategies for modern frontend development.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 12 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    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:

    Prefer function components over class components

    line 17
  2. Distinctive:

    Keep components small — if it exceeds ~150 lines, split it

    line 18
  3. Very specific:

    Default to server components (no 'use client')

    line 23
  4. Very specific:

    Add 'use client' ONLY when needed: useState, useEffect, event handlers, browser APIs

    line 24
  5. Distinctive:

    Keep client components as leaf nodes (small, focused)

    line 25
  6. Distinctive:

    Never make a layout or page a client component unless absolutely necessary

    line 26
  7. Distinctive:

    Use React Context for truly global state (theme, auth, locale)

    line 36
  8. Distinctive:

    Consider Zustand or Jotai for complex client state

    line 37
  9. Distinctive:

    Avoid prop drilling beyond 2 levels — use Context or composition

    line 42
  10. Distinctive:

    Never store derived data in state (compute it)

    line 43
  11. Distinctive:

    Never mutate state directly — always create new references

    line 44
  12. Distinctive:

    Prefer Tailwind CSS or CSS Modules — not inline styles

    line 48
  13. Distinctive:

    Follow the project's established styling approach (check architecture.md)

    line 49
  14. Very specific:

    Use React.memo only when profiling shows re-render problems

    line 63
  15. Distinctive:

    Avoid unnecessary re-renders (stable references, proper deps arrays)

    line 66

≈ “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 Standards

Component Patterns

File Organization

  • One component per file
  • Co-locate styles, tests, and types with the component
  • Name files after the component: UserProfile.tsx

Component Rules

  • Prefer function components over class components
  • Keep components small — if it exceeds ~150 lines, split it
  • Extract custom hooks for reusable logic
  • Props interfaces defined above the component

Server vs Client Components (Next.js App Router)

  • Default to server components (no 'use client')
  • Add 'use client' ONLY when needed: useState, useEffect, event handlers, browser APIs
  • Keep client components as leaf nodes (small, focused)
  • Never make a layout or page a client component unless absolutely necessary

State Management

Local State

  • useState for component-specific state
  • useReducer for complex state logic within a component

Shared State

  • Lift state to the nearest common parent
  • Use React Context for truly global state (theme, auth, locale)
  • Consider Zustand or Jotai for complex client state
  • Server state: use TanStack Query or SWR (not manual fetch + useState)

Rules

  • State should live as close to where it's used as possible
  • Avoid prop drilling beyond 2 levels — use Context or composition
  • Never store derived data in state (compute it)
  • Never mutate state directly — always create new references

Styling

  • Prefer Tailwind CSS or CSS Modules — not inline styles
  • Follow the project's established styling approach (check architecture.md)
  • Design tokens (colors, spacing, typography) from a single source
  • Responsive by default — mobile-first approach

Data Fetching

  • Server components: fetch directly (Next.js) or in loaders
  • Client components: use data fetching libraries (TanStack Query, SWR)
  • Show loading states for async data
  • Handle error states — don't assume fetches succeed
  • Implement optimistic updates for better UX on mutations

Performance

  • Use React.memo only when profiling shows re-render problems
  • Lazy-load routes and heavy components
  • Optimize images (next/image, WebP, explicit dimensions)
  • Avoid unnecessary re-renders (stable references, proper deps arrays)

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.