agentleFS
sagarithmsagarithm/sagarithm-kit/.agents/skills/frontend-ui-engineering/SKILL.md

frontend-ui-engineering

Skill17 starsChanged 14 days agoApache-2.0View on GitHub

67 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use observability-and-instrumentation, constraint-driven-development and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • HK-hubSkill

    observability-and-instrumentation

    Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.

    Also in 30 projects that use this

  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 13 projects that use this

  • HK-hubSkill

    deprecation-and-migration

    Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.

    Also in 33 projects that use this

  • seikaikyoSkill

    doubt-driven-development

    對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。

    Also in 29 projects that use this

  • seikaikyoSkill

    interview-me

    需求不明時的意圖萃取訪談:一次一題、每題附上自己的猜測、聽出「真正想要 vs 覺得應該要」,直到能預測使用者反應(約 95% 信心)才動工。適用:需求缺少對象 / 動機 / 成功標準 / 約束,或使用者點名「訪談我」「先確認一下」「我們確定嗎」。明確自足的指示、純資訊查詢、機械性操作不適用。

    Also in 31 projects that use this

  • AnasX7Skill

    redesign-existing-projects

    Upgrades existing websites and apps to premium quality. Audits current design, identifies generic AI patterns, and applies high-end design standards without breaking functionality. Works with any CSS framework or vanilla CSS.

    Also in 3 projects that use this

  • +2 more from HK-hub

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 60 edited versions we read keep these.

  • 3

    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:

    Component Boundary Precision: Do not generate 500-line monolithic components.

    line 24
  2. Distinctive:

    Zero Hallucinated CSS: Use design tokens or validated utility classes (Tailwind CSS / CSS Variables).

    line 26
  3. Distinctive:

    Lean Context State: Avoid global state dumpsters.

    line 27
  4. Very specific:

    Keyboard Navigation: All interactive elements must be focusable, show distinct focus rings (focus-visible:ring-2), and support standard …

    line 37
  5. Very specific:

    ARIA Semantics: Use native semantic HTML elements (<button>, <nav>, <main>, <article>) before applying ARIA attributes.

    line 38
  6. Very specific:

    Cumulative Layout Shift (CLS < 0.1): Always provide explicit width and height (or aspect-ratio containers) on images, skeletons, and …

    line 43
  7. Very specific:

    Avoid accessing window, localStorage, or document during server-side rendering (SSR).

    line 47
  8. Very specific:

    Never render non-deterministic content during SSR (e.g.

    line 48

“Common” is measured: kept by at least 6 in 10 of the 60 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
<!-- SAGARITHM:START - DO NOT EDIT DIRECTLY -->

id: "frontend.ui-engineering" name: "Frontend Architecture & UI/UX Engineering" version: "1.2.0" domain: "frontend" description: "Engineer production-grade frontend architectures, design systems, accessible UI components, state machines, and optimal Core Web Vitals with minimal token overhead." triggers:

  • "Designing UI component hierarchies or design systems"
  • "Building interactive web applications or frontend features"
  • "Optimizing Core Web Vitals (LCP, CLS, INP) and client performance"
  • "Implementing responsive layouts, dark mode, or accessibility (WCAG 2.1 AA)" prerequisites:
  • "architecture.system-design" risk_profile: "medium"

Frontend Architecture & UI/UX Engineering

Overview

This skill encodes the standards of a Principal Frontend Architect and Staff Design Systems Engineer. It guides AI agents in authoring resilient, accessible, high-performance UI components while minimizing prompt/context bloat through concise architectural patterns.

🎯 Token Conservation & High-Yield Heuristics

  1. Component Boundary Precision: Do not generate 500-line monolithic components. Decompose into focused subcomponents: Presentational (pure UI), Container (data/hooks), and Compound Components.
  2. Deterministic Prop Interfaces: Define strict TypeScript interfaces for component props before implementation. Prefer discriminated unions for polymorphic components (type ButtonProps = PrimaryBtn | SecondaryBtn).
  3. Zero Hallucinated CSS: Use design tokens or validated utility classes (Tailwind CSS / CSS Variables). Do not output arbitrary pixel values or inline style clutter.
  4. Lean Context State: Avoid global state dumpsters. Colocate state as close as possible to where it is consumed; use URL search params for bookmarkable UI state.

📐 Core Engineering Directives

1. Component Architecture & Design Systems

  • Atomic Design Principles: Organize UI into Atoms (buttons, inputs), Molecules (form fields, search bars), Organisms (navbars, cards, tables), and Templates/Pages.
  • Compound Components Pattern: Provide flexible composition (<Dialog>, <Dialog.Title>, <Dialog.Body>, <Dialog.Close>) rather than ballooning boolean props (showCloseButton, hasHeaderDivider, etc.).
  • Headless UI Primitives: Separate logic and accessibility from styling. Leverage Radix UI, Headless UI, or native HTML5 elements (<dialog>, <details>) whenever possible.

2. Accessibility (WCAG 2.1 AA Compliance)

  • Keyboard Navigation: All interactive elements must be focusable, show distinct focus rings (focus-visible:ring-2), and support standard keyboard interactions (Enter, Space, Escape, arrow keys).
  • ARIA Semantics: Use native semantic HTML elements (<button>, <nav>, <main>, <article>) before applying ARIA attributes. Never place click handlers on non-interactive <div> or <span> without role="button", tabIndex={0}, and onKeyDown.
  • Color Contrast: Maintain minimum 4.5:1 contrast for normal text and 3:1 for large text / UI controls.

3. Performance & Core Web Vitals

  • Largest Contentful Paint (LCP < 2.5s): Preload hero images, avoid client-side rendering cascades for above-the-fold content, use modern image formats (WebP/AVIF).
  • Cumulative Layout Shift (CLS < 0.1): Always provide explicit width and height (or aspect-ratio containers) on images, skeletons, and dynamic embeds.
  • Interaction to Next Paint (INP < 200ms): Defer heavy computations off the main thread; use useTransition or startTransition for non-urgent state updates; avoid synchronous re-renders of huge lists (use virtual scrolling).

4. Hydration Safety & Rendering Boundaries

  • Avoid accessing window, localStorage, or document during server-side rendering (SSR). Guard with useEffect or client-only components.
  • Never render non-deterministic content during SSR (e.g. Date.now(), random numbers) without proper hydration isolation.

🛑 Anti-Rationalization Matrix

Agent Excuse / ShortcutFrontend Engineering RealityMandatory Action
"I'll use a div with an onClick because it's easier to style."Breaks screen readers, keyboard navigation, and browser accessibility trees.Use a native <button> element with appropriate CSS reset or accessibility props.
"I'll store all UI state in global Redux/Zustand."Triggers unnecessary re-renders across the entire component tree and bloats memory.Colocate state in local component state, URL search params, or atomic context.
"I'll skip responsive layout testing; desktop view is fine."Over 55% of web traffic is mobile. Layout will break on viewport resize.Implement mobile-first responsive breakpoints (sm:, md:, lg:) and test touch targets ($\ge 44 \times 44\text{px}$).
"I'll generate inline SVG paths directly in the JSX."Clutters code and consumes massive prompt context tokens.Extract SVGs into standalone icon components or use established icon libraries (Lucide, Heroicons).

✅ Frontend Verification Checklist

  • No layout shift (CLS = 0) during page load or font loading.
  • Full keyboard navigation verified without mouse assistance.
  • Responsive across 320px, 768px, 1024px, and 1440px viewports.
  • Zero console warnings regarding missing keys, duplicate IDs, or hydration mismatches.
  • Strict TypeScript prop contracts with zero any types.
<!-- SAGARITHM:END -->

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.