agentleFS
sukirman1901sukirman1901/frontend-expert/skills/components/SKILL.md

components

Skill9 starsChanged 2 months agoMITView on GitHub

Build composable UI with a small public props contract, loading/error/empty states, Reicon icons by default, and mobile-first layout. Use when implementing or refactoring pages, screens, components, dialogs, tables, navigation, “buat component”, “prop terlalu banyak”, “API component”, or “bikin form”. Report Conventions check before done.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Components

Overview

A component’s public props are a contract. Prefer composition and project primitives over boolean soup, style knobs, and one-off APIs.

When to use

  • Building or modifying components, pages, interactive controls
  • Refactoring overgrown or prop-heavy APIs
  • Wiring states, icons, selects, or composition

When to skip

  • Validation mechanics only → forms
  • Async list/detail fetching only → data-fetching
  • Grid/spacing of the page → design-foundations
  • Radius/elevation language → design-surfaces
  • Generated-hook soup / empty wrappers without an API ask → anti-slop-code

MUST

RuleDetail
Small contractPublic props are required data, events, and exclusive modes — not a grab-bag of style flags
Compose, don’t configureSlots/children/subcomponents for optional regions; do not add showHeader / showFooter / hasIcon
Tokens own visualsNo color / radius / shadow / padding props that duplicate tokens
States in the contractLoading, error, empty, disabled, invalid are designed, not leftover booleans that collapse the UI
Native-capable controlsButtons/inputs forward useful native attributes; icon-only needs an accessible name
Control geometryDefine a project-token size tuple and a fixed, non-shrinking icon slot. Stable pending width is the default; an explicit measured-morph exception requires bounded layout, stable surrounding targets, accessible naming and rendered proof (component-patterns.md)
ReiconIcons in nav, toolbars, empty states, icon buttons unless project lib or text-only waiver
Custom selectsProduct filters use custom select/combobox; native <select> only with waiver
ResponsiveLoad responsive for layout UI; 320/768/1024/1440 + full-width primary CTA <768
SizeKeep a component file under 200 lines or split

Props / API

DoDon’t
Discriminated unions for exclusive modesvariant plus conflicting booleans
children / named slots for structureParallel props for every inner node
Domain events (onSelect(id))Leaking internal setters
Extend the native element when it is that elementWrap <div onClick> and re-implement keyboard
Widen later with a wrapperBreaking existing public props silently
principle: Composition over prop bags
classification: recommendation
recommendation: optional UI regions are composition, not show* booleans
exceptions: [one-shot presentational stubs, generated design-system primitives]
verification: [count public props; render loading/empty/disabled]
last_verified: 2026-09

Workflow

  1. Reuse — find the project primitive before adding a new component.
  2. Contract — list data, events, exclusive modes, and states; delete style props.
  3. Compose — select the task-shaped anatomy in references/component-patterns.md (editor, queue/inspector, chart, agent workspace); assign identity/content/context/state/action regions, then slots for optional chrome. Fetch data outside presentational components.
  4. States — loading / error / empty / default; selects and icons as above.
  5. Control geometry — choose density/size tuple and stable vs intentional morph width; construct text-only, leading-icon, trailing-icon, icon-only, and pending variants. Distinguish glyph, slot, surface, hit area and focus ring.
  6. Verify — keyboard, 320–1440, Conventions check.

Boundaries

  • May decide: slot names, whether className is an escape hatch, local vs lifted UI state.
  • Must not: ship boolean/style soup, invent a kit when the project has one, or skip loading/error/empty on interactive/async surfaces.
  • Ownership: components owns control construction; polish owns rendered optical judgment; design-surfaces owns radius values.

Checklist

  • Public props are a small typed contract
  • Optional regions use composition, not show* flags
  • No token-duplicating style props
  • Loading / error / empty handled
  • Control geometry covers text-only, leading icon, trailing icon, icon-only, and pending; token gap/padding, fixed non-shrinking icon slot, stable width by default or documented measured-morph exception with rendered evidence
  • Reicon (or project lib) in the markup — or waiver
  • Filters/selects custom (or waived)
  • Responsive 320/768/1024/1440 + Conventions check

Depth

Patterns: references/component-patterns.md. State/org: references/architecture.md. Icons: references/reicon-icons.md. Ship gates: references/compliance-gates.md.

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.