Get the FREE Ultimate OpenClaw Setup Guide →

Frontend

Scanned
npx machina-cli add skill Joncik91/ucai/frontend --openclaw
Files (1)
SKILL.md
8.2 KB

name: frontend description: Use when building React components, optimizing performance, analyzing bundle sizes, scaffolding projects, implementing accessibility, reviewing frontend code quality, performing visual overhauls, or designing UI/UX systems.

Frontend Engineer

Frontend development patterns, performance optimization, accessibility, and distinctive UI design for any framework.


Step 1: Detect the Stack

Before writing any code, identify the framework and tooling from project signals:

Signal file / patternStack
next.config.*Next.js (React)
nuxt.config.*Nuxt (Vue)
svelte.config.*SvelteKit
astro.config.*Astro
remix.config.* / @remix-run in package.jsonRemix (React)
angular.jsonAngular
vite.config.* + ReactVite + React
vite.config.* + VueVite + Vue
tailwind.config.*Tailwind CSS
styled-components / emotion in package.jsonCSS-in-JS

Check: cat package.json, ls -la, cat vite.config.* — whichever applies.


Step 2: Research Current Practices

Once you know the stack, search before making framework-specific recommendations:

WebSearch: " component patterns best practices 2025" WebSearch: " performance optimization 2025" WebSearch: " bundle size optimization 2025" WebSearch: " accessibility best practices 2025" WebSearch: " best practices 2025"


Step 3: Design Thinking

When building any UI — component, page, or application — commit to a bold aesthetic direction before writing a line of code:

  • Purpose: What problem does this interface solve? Who uses it?
  • Tone: Pick an extreme and own it. Brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian — commit to one direction and execute it with precision.
  • Differentiation: What makes this unforgettable? What is the one thing someone will remember?
  • Constraints: Framework, performance budget, accessibility requirements.

The goal is intentionality, not intensity. Refined minimalism and bold maximalism both work — generic middle ground does not.

Typography

Choose fonts that are beautiful, unique, and characterful. Pair a distinctive display font with a refined body font.

  • Avoid: Inter, Roboto, Arial, system fonts, Space Grotesk (overused)
  • Prefer: Unexpected choices that elevate the aesthetic and feel designed for the context
  • Every font decision should be documented with a reason

Color and Theme

Commit to a cohesive aesthetic. Use CSS variables for consistency.

  • Dominant colors with sharp accents outperform timid, evenly-distributed palettes
  • Define tokens: primary, surface, text, error, border — never scatter raw hex values
  • Vary between light and dark themes — do not default to one
  • Check contrast ratios (4.5:1 for body text, 3:1 for large text)

Motion

Use animation for effects and micro-interactions. Prioritize CSS-only for HTML; Motion library for React when available.

  • One well-orchestrated page load with staggered reveals creates more delight than scattered micro-interactions
  • Use scroll-triggering and hover states that surprise
  • Match animation complexity to the aesthetic vision — maximalist designs need elaborate motion, refined designs need restraint

Spatial Composition

  • Unexpected layouts: asymmetry, overlap, diagonal flow, grid-breaking elements
  • Generous negative space OR controlled density — not the muddled middle
  • Visual hierarchy through size contrast, not just color

Backgrounds and Visual Details

Create atmosphere and depth rather than defaulting to solid colors:

  • Gradient meshes, noise textures, geometric patterns, layered transparencies
  • Dramatic shadows, decorative borders, grain overlays
  • Custom cursors, contextual effects that match the overall aesthetic

Aesthetic Anti-Patterns

Never use generic AI-generated aesthetics:

  • Overused fonts: Inter, Roboto, Arial, Space Grotesk, system fonts
  • Purple gradients on white backgrounds
  • Predictable layouts and cookie-cutter component patterns
  • Design that lacks context-specific character
  • Two consecutive generations that converge on the same choices

Step 4: Universal Frontend Principles

These apply regardless of framework.

Component Design

  • Single responsibility: one component, one job — split when a component does two distinct things
  • Props as API: treat component props like a public API — document what is required vs optional
  • Co-location: keep styles, tests, and types next to the component they belong to
  • Composition over inheritance: prefer passing children/slots over extending base components
  • Controlled vs uncontrolled: be intentional — controlled for forms that need validation, uncontrolled for simple inputs

Performance

  • Render budget: components should render in under 16ms for 60fps; profile before optimizing
  • Lazy loading: code-split at route boundaries; defer below-fold components
  • Image optimization: use the framework image component or <picture> + srcset; never serve 2x the display size
  • Memoization: only add when profiling shows a problem — premature memoization adds complexity for no gain
  • Bundle analysis: regularly audit bundle size; flag dependencies over 50kb that can be replaced or lazy-loaded

Accessibility (a11y)

  • Semantic HTML: use the right element (<button> not <div onClick>, <nav> not <div class="nav">)
  • Focus management: custom modals/drawers/dropdowns must trap focus and restore it on close
  • ARIA: only use ARIA to extend semantics, not replace them; prefer native elements
  • Color contrast: 4.5:1 for body text, 3:1 for large text (WCAG AA minimum)
  • Keyboard navigation: every interactive element reachable and operable by keyboard
  • Screen reader testing: test with NVDA+Firefox or VoiceOver+Safari before shipping

State Management

  • Locality first: co-locate state with the component that owns it; lift only when needed
  • Server state vs client state: use a data-fetching library for server state (TanStack Query, SWR, Apollo) — do not store it in global store
  • Derived state: compute from source of truth — do not sync two pieces of state
  • Global store: only for genuinely cross-cutting state (auth user, theme, feature flags)

Forms

  • Validation: validate on blur for UX, on submit for correctness; show errors inline
  • Accessibility: every input has a <label>; error messages referenced via aria-describedby
  • Loading states: disable submit during async; show spinner or progress
  • Optimistic UI: apply the mutation locally, rollback on error

Security

  • XSS: never set innerHTML/dangerouslySetInnerHTML from user input; sanitize if unavoidable
  • CSP: Content-Security-Policy header; avoid unsafe-inline
  • Sensitive data: never log tokens, passwords, or PII to the console
  • Third-party scripts: audit before adding; every script is a supply chain risk
  • Dependency audit: run npm audit regularly; keep dependencies current

Review Checklist

Before any frontend PR:

  • Aesthetic direction chosen and documented before any code was written
  • Font choices are distinctive and context-appropriate (not Inter/Roboto/Arial/Space Grotesk)
  • Color tokens defined; contrast ratios verified (WCAG AA)
  • All component states handled — default, hover, focus, disabled, loading, error, empty
  • Components have single, clear responsibility
  • No dangerouslySetInnerHTML from unvalidated input
  • Every interactive element is keyboard-accessible
  • Every input has an associated <label>
  • Images have meaningful alt text (or alt="" if decorative)
  • Bundle impact assessed for new dependencies
  • No console.log of tokens or PII
  • Responsive at mobile, tablet, and desktop breakpoints

Source

git clone https://github.com/Joncik91/ucai/blob/main/skills/frontend/SKILL.mdView on GitHub

Overview

Frontend covers building React components, optimizing performance, analyzing bundle sizes, scaffolding projects, accessibility, code quality reviews, visual overhauls, and UI/UX systems. It blends engineering discipline with distinctive UI design to ensure fast, accessible, and cohesive interfaces across frameworks.

How This Skill Works

Start by Detecting the Stack through project signals (e.g., next.config.*, package.json, vite.config.*). Then Research current practices for performance, accessibility, and patterns. Finally, use Design Thinking to define a bold direction and concrete design tokens before coding.

When to Use It

  • Starting a new frontend project and scaffolding structure
  • Building React components or UI libraries and optimizing render performance
  • Analyzing and reducing bundle sizes across the app
  • Implementing accessibility and designing UI/UX systems
  • Reviewing frontend code quality during audits or refactors

Quick Start

  1. Step 1: Detect the Stack by inspecting project signals (config files, package.json, vite.config.*)
  2. Step 2: Research current practices and set clear performance and accessibility goals
  3. Step 3: Define a bold design direction and establish tokens for typography, color, and motion

Best Practices

  • Identify the stack early by inspecting signals like next.config.* or package.json and confirm with quick checks (cat package.json, ls -la, etc.)
  • Research prevailing patterns, performance budgets, and accessibility best practices for the detected stack
  • Define a bold design direction (purpose, tone, differentiation) before coding and document the rationale
  • Establish typography, color, motion, and spacing tokens using CSS variables for consistency
  • Prioritize semantic HTML, accessibility, and performance budgets throughout implementation

Example Use Cases

  • Audit a Next.js app to identify and reduce webpack/ tooling bloat and improve hydration performance
  • Build a design system with typography and color tokens to support a cohesive UI kit
  • Scaffold a new frontend project with standardized patterns and CI checks for quality
  • Perform an accessibility review and implement WCAG-aligned components across the UI
  • Overhaul a dashboard with a bold visual direction and responsive, coherent UI rules

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers