UI Component Audit (DataConnect)
Scope
Use this skill to audit or refactor React components to align with:
- •
docs/260202-ui-implementation-typography.md - •
AGENTS.md(no comment overwrites; do not change styles/classes unless asked) - •Vercel React best practices + composition patterns
Quick Start (Audit)
- •Read target component(s).
- •Read
docs/260202-ui-implementation-typography.mdandAGENTS.md. - •List violations by file with terse bullets.
- •If asked to fix, apply minimal diff.
- •If you touched any
Textprops, run a scoped check on touched files for verbose color props (color="mutedForeground"andcolor="foregroundDim"), then replace with boolean props (mutedanddimrespectively) unless a specific semantic color token is required.
Primary principle
Read the component source, understand its API, then apply it correctly.
Before using any project component (Text, Button, etc.), read its source
to learn its props, variants, and default values. Do not hard-code assumptions
about component internals — verify them. Do not pass props that match defaults.
UI Implementation Rules (must enforce)
- •All user-visible text should use
Text(src/components/typography/text.tsx) where appropriate. Exceptions include button labels insideButton, form labels, and aria-only content. When unsure, read theTextsource to check if it fits. - •Buttons must use
Button; do not add custom focus rings. - •
Textusesintentfor type size/role (e.g.title,heading,subtitle,eyebrow). Read the component source to check default prop values and do not pass props that match the default (e.g. ifintentdefaults to"body", omit it for body text). - •Use
asto keep semantic HTML (h1,p,li, etc.). - •Prefer
muted/dimboolean props onTextfor muted/dim copy; avoid verbosecolor="mutedForeground"unless a specific semantic color token is required. - •
Texthas props for icon layout (withIcon) and link styling (link). Read the component source to understand how they work before using them — do not guess at prop values or manually replicate behavior the component already handles. - •For links, use
Text as="a"and pass link props (href,target,rel) directly; do not wrapTextin an<a>. - •Do not set
weightunless the Figma design explicitly shows non-normal weight. Models tend to over-applyfont-mediumandfont-bold— normal weight is almost always correct. - •No inline styles; use Tailwind classes + tokens.
- •Do not introduce
cnas a formatting tool. Usecnonly when class names are dynamic or need conditional logic. For static classes (even 5-7 of them), prefer a plain string literalclassName="...". Only group intocn(...)arrays when the element has 8+ classes (per Tailwind sort rule) or when classes are extracted into a reusable constant. - •Use tokenized colors (
text-foreground,bg-muted, etc.), not hex. - •No raw colors anywhere outside
src/styles/vars.css(no hex/rgb/hsl/oklch in components or CSS). - •No palette classes like
text-gray-*,bg-slate-*, etc. Use tokens only. - •Prefer layout spacing via
gap-*,space-*; avoid margins on text. - •Defer to base component styles (padding, radius, borders) unless the UI markup explicitly specifies an override.
- •Use semantic radius/color tokens (e.g.,
rounded-button, tokenized color classes) instead of raw Tailwind radius/color classes. - •Icon sizing: use
size-*for square icons instead of pairedw-*/h-*. - •Icons inside
Button: do not set explicit icon sizing classes by default.Buttonalready sizes nested SVGs via its base styles; only addsize-*when the design explicitly requires an override. - •SVG sizing:
useBoxSizesets inlinewidth/height(1emby default). Use it when icons should scale with text; avoid mixing withsize-*in the same element. - •Lucide icon imports must end with
Iconsuffix (e.g.,DownloadIcon). - •Component filenames are kebab-case.
Typography Notes
- •
Textruns formatting on string children (smart quotes). Pass a ReactNode if you need raw text. - •Display typography uses Inter Variable optical sizing:
title,display, andheroauto-apply display opsz; override withoptical="auto"or force withoptical="display". - •The typography system is defined in
textVariantsinsidesrc/components/typography/text.tsx. - •When introducing new theme tokens (spacing, text, color, radius), update the custom Tailwind merge in
src/lib/classes.tssocnhandles them correctly. - •Lucide stroke width is globally set to
1.5via.lucideinsrc/styles/index.css.
React + Composition Rules
For React architecture, composition patterns, and performance (memoization, barrel imports, etc.), defer to the vercel-react-best-practices and vercel-composition-patterns skills when available. This skill focuses on UI implementation correctness, not general React guidance.
- •Barrel files are a tool, not a default. Follow
vercel-react-best-practicesrule 2.1 (anti-barrel by default): prefer direct imports, especially for third-party packages. - •Exception: allow tiny, explicit, feature-local curated barrels (no
export *) when they define a stable boundary (for example, section -> shared settings components) and reduce fragile relative paths. - •Never create broad catch-all barrels for large folders or app-wide UI exports as part of UI audit refactors.
Fix Workflow (when asked to refactor)
- •Convert inline styles → Tailwind classes + tokens.
- •Replace raw text nodes with
Text(skip button labels insideButton). - •Convert raw
<button>toButtonand drop custom focus rings. - •If a file is not kebab-case, flag it and suggest the new name — do not rename automatically. Wait for confirmation before renaming and updating imports.
- •Enforce icon suffix and direct imports.
- •If import ergonomics are poor, prefer alias-based direct imports; only introduce a curated local barrel when it is intentionally tiny and boundary-scoped.
- •For icon + text rows, use
TextwithwithIcon; remove manual layout classes where possible. - •Add
type="button"to non-submit buttons. - •Verify null-safe rendering for optional fields.
- •Run lints for touched files.
Output Format
Group findings by file.
## src/components/example.tsx src/components/example.tsx:12 - inline style; use Tailwind tokens src/components/example.tsx:21 - raw text; use Text
Notes
- •Do not overwrite comments.
- •Do not change styles/classes unless user asks for refactor.