agentleFS
RuneStone-TechRuneStone-Tech/optimize-anything/skills/web/_components/SKILL.md

ui-components-optimizer

Skill1 starsChanged 8 days agoMITView on GitHub

Audit and optimize any UI component library or design system in a web app -- MUI, Mantine, Chakra, Ant Design, HeroUI, Fluent UI, Carbon, Blueprint, Radix, Base UI, React Aria, Headless UI, Ark UI, shadcn/ui, Vuetify, PrimeVue, Nuxt UI, Reka UI, Bits UI, Kobalte, Angular Material, PrimeNG, Shoelace/Web Awesome, Lit, Bootstrap, DaisyUI, Flowbite and Tailwind-based kits -- for bundle and import cost, runtime CSS-in-JS and SSR/hydration, theming and dark-mode flash, accessibility and forms, large lists/tables, and major-version migrations, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions a UI library, component kit, design system, shadcn, MUI/Chakra/Mantine/AntD, Radix/Base UI/React Aria, Vuetify/PrimeVue/Nuxt UI, Angular Material, Web Components, component bundle size, theme provider/SSR style flash, form/table components, or upgrading a UI library -- even if they never say "audit" or "optimize". For framework internals (React/Next/Vue/Nuxt/Svelte/Solid), hand off to the matching optimizer.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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. Very specific:

    Run python <skill-dir>/scripts/audit.py <project-root> -- static scan of package.json, config, components/pages and styles for …

    line 15
  2. Very specific:

    Read references/tooling.md once: what can be measured here (bundle analyzer, framework profiler, SSR HTML, axe, Storybook).

    line 17
  3. Very specific:

    Use plan mode: EnterPlanMode (load with ToolSearch if deferred), write the plan, present with ExitPlanMode.

    line 48
  4. Distinctive:

    Accessibility is part of the component contract: Prefer the kit's accessible primitives.

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

UI Components Optimizer

Audit the component-library layer of a web app, report what is slow, inaccessible or fragile and why, agree a plan, then fix it. Order: evidence, approval, edits. UI kits decide a large share of bundle size, SSR styling, accessibility and upgrade risk, but changing providers, imports or component APIs can alter behavior and appearance, so nothing is edited before approval.

Workflow

1. Scope (quick)

  • Find the app root (package.json). Record: framework (React/Next, Vue/Nuxt, Svelte/SvelteKit, Solid/SolidStart, Angular, Lit/Web Components), UI library (or libraries) and version, styling approach (runtime CSS-in-JS, CSS modules, Tailwind, plain CSS, web components), SSR/RSC mode, and whether components are dependency-based, headless, copy-in (shadcn-style) or CSS-only.
  • Run python <skill-dir>/scripts/audit.py <project-root> -- static scan of package.json, config, components/pages and styles for library/version issues, whole-library imports, runtime styling, SSR provider gaps, accessibility mistakes and large-list patterns, with file:line evidence. Use --json to post-process.
  • Classify the pain: bundle/load, runtime style/SSR flash, accessibility/forms, large tables/lists, visual inconsistency, or upgrade risk. Ask which hurts if unclear.
  • Read references/tooling.md once: what can be measured here (bundle analyzer, framework profiler, SSR HTML, axe, Storybook).

2. Audit

The script finds cheap leads; you find the rest by reading. Read package.json, the root provider/layout, the 3-5 screens with the most UI, and the component wrappers/design-system layer. Load only what applies:

AreaReference
Library landscape, categories, current majors, trade-offsreferences/library-map.md
Imports, tree-shaking, CSS extraction, icons, bundlereferences/imports-bundle.md
Theme providers, CSS-in-JS, SSR/RSC, dark-mode flash, tokensreferences/theming-ssr.md
Accessibility, dialogs/menus, forms, tables, keyboardreferences/a11y-forms.md
Large lists/tables, virtualization, re-render hotspotsreferences/performance-patterns.md
Major-version migrations and breaking changesreferences/migrations.md
Per-stack guides (React, Vue, Svelte, Solid, Angular, Web Components, CSS-only)stacks/<stack>/optimizations.md
Measurement and honest reportingreferences/tooling.md

For a single library, use the matching focused optimizer in skills/: Aceternity UI, Base UI, Bulma, coss ui, Create UI, DaisyUI, Float UI, Flowbite, Franken UI, Headless UI, HeroUI, Mantine, MUI, Park UI, Preline UI, Radix UI, ReUI, shadcn, TailGrids, tweakcn or Untitled UI. Use this generic guide when comparing libraries or when no per-library skill matches.

Measure, never guess. Build for production and measure the real bundle/route; inspect SSR HTML for style tags and dark-mode flash; run axe/Playwright on the UI states that matter. Component count, bundle bytes and a11y violations are evidence; "feels heavy" is not.

Per-stack guides live in stacks/: react, vue, svelte, solid, angular, web-components, css-only. Read the one matching the project before applying generic advice.

Mark each finding Confirmed (build/analyzer/axe/code evidence) or Suspected (needs measuring).

3. Report

Fill assets/report-template.md, save it as UI_COMPONENTS_OPTIMIZATION_REPORT.md in the project root, and show the user. Five-line summary, findings table by impact/effort, then per-finding detail (evidence, why it hurts, fix, risk, visual/behavior impact). Group related findings.

4. Plan -- then stop for approval

Use plan mode: EnterPlanMode (load with ToolSearch if deferred), write the plan, present with ExitPlanMode; if unavailable show it in chat and wait for an explicit "go". Structure:

  1. Quick wins -- per-component imports, drop duplicate icon/UI libs, lazy-load heavy widgets, fix missing alt/labels/keys, replace index keys, add SSR provider/cache, preload the theme script, remove unused kit CSS. Low risk.
  2. Structural -- one styled kit, headless primitive layer, virtualize large tables/lists, split provider boundaries, replace runtime CSS-in-JS with CSS modules/Tailwind where measured, consolidate design tokens/wrappers. Name each visual/behavior change.
  3. Heavy -- major-version upgrades (MUI 9, Chakra 3, Mantine 9, AntD 6, HeroUI 3, Vuetify 4, PrimeVue 5, Nuxt UI 4, Angular Material 22), library swap, headless/rebuild design system. Separately approved. Each step: files touched, expected effect, how to verify, how to roll back.

5. Fix

Only approved items, in small groups. After each: typecheck, lint, tests, production build, and a visual/axe check on the affected screens. A break must trace to one change. Do not mix a library major upgrade with optimization edits. If a change alters public component APIs, theme tokens or SSR output, stop and ask.

6. Verify and wrap up

Re-measure the same routes and states: route JS (raw/gzip), CSS bytes, SSR style/flash behavior, axe violations, table/list interaction cost, LCP/INP/CLS. State plainly what could not be measured. End with deferred items and one suggested next step.

Principles

  • One styled kit, one primitive layer. Mixing MUI + Chakra + Ant Design (or two headless layers) multiplies bundle, theming and a11y surface.
  • Imports decide the bundle. Namespace imports, barrel files and every-icon imports can ship the whole library; use per-component paths and package-import optimization.
  • Runtime CSS-in-JS is a tax. Emotion/styled-components need SSR caches and client style work; measure before choosing, and prefer CSS modules/Tailwind for new work when it fits.
  • SSR needs a provider and a cache. MUI/Chakra/AntD/Mantine/HeroUI each have a server story; missing it means style flash, hydration mismatches or client-only pages.
  • Accessibility is part of the component contract. Prefer the kit's accessible primitives; don't rebuild dialogs/menus with divs and click handlers.
  • Large lists need virtualization. Tooltips, menus and dialogs per row are the usual performance cliff.
  • Tokens before overrides. Theme tokens/CSS variables beat per-screen overrides and survive upgrades better.
  • Migrations are their own plan item. A UI major changes APIs, tokens and styling; never bundle it with performance edits.
  • Hand off framework internals. React re-renders, Next caching, Vue/Nuxt reactivity, Svelte runes, Solid signals: use the matching optimizer; this skill owns the kit layer.

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.