Opinionated preferences for managing client and server state in React apps.
# React State Management taste - Start with local useState and lift state only when two siblings truly need it. Confidence: 0.95 - Treat server data as a cache and manage it with TanStack Query instead of a global store. Confidence: 0.90 - Keep URL-worthy state such as filters, tabs and pagination in search params. Confidence: 0.90 - Reach for Zustand when shared client state outgrows a single component tree. Confidence: 0.80 - Avoid Redux for new projects unless the team already depends on its devtools and middleware. Confidence: 0.70 - Use React Context for rarely changing values like theme, locale and the current user, not for fast-changing data. Confidence: 0.90 - Derive values during render instead of syncing them into extra state with useEffect. Confidence: 0.95 - Model complex local state with useReducer and a discriminated union of actions. Confidence: 0.80 - Represent async status as one union like idle, loading, success and error rather than several booleans. Confidence: 0.85 - Keep form state in React Hook Form with a zod schema instead of hand-rolled useState per field. Confidence: 0.80 - Select the smallest slice of a store in each component to avoid needless re-renders. Confidence: 0.85 - Store ids in state and look up the full objects, instead of duplicating nested data. Confidence: 0.80 - Use optimistic updates for quick user actions and roll back on error. Confidence: 0.75 - Never mutate state objects in place; return new objects or use Immer for deep updates. Confidence: 0.90 - Keep persisted state small and versioned when saving it to localStorage. Confidence: 0.75 - Reset component state by changing its key instead of writing reset effects. Confidence: 0.80 - Colocate stores with the feature that owns them rather than in one global store folder. Confidence: 0.75 - Type every store and context value explicitly and avoid any in state shapes. Confidence: 0.90
Opinionated preferences for writing maintainable, accessible and responsive CSS in modern web apps.
# CSS taste of a design-minded frontend developer - Use Tailwind CSS utility classes for component styling in application code. Confidence: 0.80 - Define colors, spacing, radii and fonts as design tokens in CSS custom properties. Confidence: 0.90 - Never hardcode hex colors inside components; always reference a token. Confidence: 0.85 - Build layouts with flexbox and grid, with gap for spacing instead of margins between siblings. Confidence: 0.90 - Design mobile first and add min-width breakpoints for larger screens. Confidence: 0.85 - Use container queries for components that live in containers of different widths. Confidence: 0.75 - Use rem for font sizes and spacing, and px only for hairline borders. Confidence: 0.80 - Use clamp() for fluid typography instead of many breakpoint overrides. Confidence: 0.75 - Keep specificity flat: single class selectors, no IDs, and no !important outside utilities. Confidence: 0.90 - Use cascade layers to order reset, base, components and utilities. Confidence: 0.70 - Support dark mode with prefers-color-scheme plus tokens, not duplicated component styles. Confidence: 0.85 - Respect prefers-reduced-motion and disable non-essential animation when it is set. Confidence: 0.90 - Never remove focus outlines; style them with :focus-visible instead. Confidence: 0.95 - Meet WCAG AA contrast for all text and interactive elements. Confidence: 0.90 - Animate only transform and opacity for smooth, cheap transitions. Confidence: 0.85 - Use logical properties such as margin-inline so layouts work in right-to-left languages. Confidence: 0.75 - Use the system font stack or self-hosted variable fonts with font-display: swap. Confidence: 0.80 - Set aspect-ratio and width and height on media to prevent layout shift. Confidence: 0.85 - Use native CSS nesting sparingly and never more than two levels deep. Confidence: 0.70 - Sort Tailwind classes automatically with the Prettier plugin. Confidence: 0.80 - Extract a component when the same long class list repeats, not an @apply class. Confidence: 0.75 - Make sure nothing scrolls horizontally at a 320px viewport width. Confidence: 0.85
Opinionated preferences for making web pages load fast and stay responsive for real users.
# Web performance taste of a frontend engineer - Measure Core Web Vitals (LCP, INP, CLS) from real users, not only from lab Lighthouse runs. Confidence: 0.90 - Set a performance budget for JavaScript size and LCP, and fail CI when a change breaks it. Confidence: 0.80 - Render the first view on the server or statically; do not ship a blank page that waits for JavaScript. Confidence: 0.90 - Ship less JavaScript before optimizing the JavaScript you ship. Confidence: 0.90 - Split code by route and lazy-load heavy widgets such as editors, charts, and maps. Confidence: 0.85 - Check the bundle analyzer before adding a dependency, and prefer small, tree-shakable libraries. Confidence: 0.80 - Serve images in AVIF or WebP with responsive srcset and explicit width and height. Confidence: 0.90 - Mark the LCP image with fetchpriority="high" and never lazy-load it. Confidence: 0.85 - Lazy-load below-the-fold images and iframes with loading="lazy". Confidence: 0.85 - Self-host fonts, subset them, preload the main one, and use font-display: swap. Confidence: 0.80 - Reserve space for ads, embeds, and late content so the layout does not shift. Confidence: 0.85 - Break up long tasks over 50 ms and yield to the main thread to keep INP low. Confidence: 0.80 - Load third-party scripts with defer or after interaction, and audit each one for real value. Confidence: 0.85 - Cache hashed static assets with Cache-Control: immutable for a year. Confidence: 0.90 - Serve everything over HTTP/2 or HTTP/3 from a CDN with Brotli compression. Confidence: 0.85 - Preconnect only to the one or two origins needed for the first render. Confidence: 0.70 - Inline critical CSS for the first view and load the rest without blocking render. Confidence: 0.65 - Virtualize long lists instead of rendering thousands of DOM nodes. Confidence: 0.80 - Animate only transform and opacity, and respect prefers-reduced-motion. Confidence: 0.85 - Avoid layout thrashing: batch DOM reads before DOM writes. Confidence: 0.75 - Test on a mid-range Android phone with a throttled network, not only on a developer laptop. Confidence: 0.90 - Treat a performance regression like a bug, with an owner and a fix date. Confidence: 0.80
Opinionated preferences for building accessible web interfaces that work for keyboard and screen reader users.
# Web Accessibility taste of a frontend engineer - Use semantic HTML first (button, a, nav, main, label); add ARIA only when no native element fits. Confidence: 0.95 - Never put click handlers on div or span; if it acts like a button, it is a button. Confidence: 0.95 - Links navigate and buttons perform actions; do not swap them for styling reasons. Confidence: 0.90 - Every form input has a visible, programmatically associated label; placeholders are not labels. Confidence: 0.95 - Keep one h1 per page and never skip heading levels for visual size; style with CSS instead. Confidence: 0.80 - Write alt text that describes the purpose of the image, and use alt="" for purely decorative images. Confidence: 0.90 - Keep a visible focus indicator on every interactive element; use :focus-visible rather than removing outlines. Confidence: 0.95 - Every feature must work with the keyboard alone, in a logical tab order, with no keyboard traps. Confidence: 0.95 - Avoid positive tabindex values; fix the DOM order instead. Confidence: 0.90 - Meet WCAG AA contrast: 4.5:1 for body text and 3:1 for large text and UI components. Confidence: 0.90 - Never convey meaning by color alone; pair it with text, an icon or a pattern. Confidence: 0.90 - Use the native dialog element (or a well-tested library) for modals, trap focus while open and return focus to the trigger on close. Confidence: 0.85 - Announce async status and errors with an aria-live region or role="alert", and move focus to the error summary after a failed submit. Confidence: 0.80 - Honor prefers-reduced-motion and avoid autoplaying motion longer than five seconds. Confidence: 0.85 - Make touch targets at least 24x24 CSS pixels, ideally 44x44. Confidence: 0.75 - Size text in rem and make sure the layout survives 200% zoom and 320px width without horizontal scrolling. Confidence: 0.85 - Add a "Skip to main content" link as the first focusable element. Confidence: 0.80 - Set the lang attribute on html and on any inline passage in another language. Confidence: 0.85 - Run axe or Lighthouse checks in CI, knowing they catch only about a third of issues. Confidence: 0.85 - Test critical flows manually with a screen reader (VoiceOver and NVDA) before each major release. Confidence: 0.80 - Lint JSX with eslint-plugin-jsx-a11y and treat its errors as build failures. Confidence: 0.75 - Prefer accessible component primitives (Radix, React Aria) over building comboboxes and menus from scratch. Confidence: 0.80