| name | swe-developing-frontend-ui |
| description | UI development skill covering design token usage, shadcn/ui + Radix composition patterns, accessibility requirements, anti-patterns catalog, and brand context for OrganicLever and OSE Platform. Auto-loads when working on TSX components, CSS, or UI design tasks. |
Frontend UI Development Skill
This skill provides repo-specific guidance for building UI components in the open-sharia-enterprise monorepo. It covers design tokens, component patterns, accessibility, anti-patterns, and per-app brand context.
When This Skill Triggers
- Editing
.tsx component files in apps/*/src/components/
- Editing
globals.css or Tailwind configuration
- Creating or modifying shared UI components in
libs/web-ui/
- Working on design tokens in
libs/web-ui-token/
Reference Modules
Consult these reference docs for detailed guidance on specific topics:
Quick Reference: Top Rules
Do
- Use semantic tokens —
bg-primary, text-muted-foreground, border-border (not hardcoded colors)
- Use
React.ComponentProps<"element"> — not React.forwardRef
- Use
radix-ui unified package — not @radix-ui/react-slot individual packages; use Slot.Root from unified
- Add
data-slot="component-name" on every component root element
- Use
focus-visible: — not focus: (keyboard-only focus rings)
- Use
cn() from shared lib — clsx + tailwind-merge for class composition
- Define variants with CVA — export from
.variants.ts for reuse
- Every visual token needs a
.dark counterpart — verify contrast in both modes
- Mobile-first responsive — start with base styles, add
md:, lg: prefixes
- Minimum hit targets — 24px desktop, 44px mobile
Do Not
- No hardcoded hex/rgb/hsl in className or style props — use design tokens
- No
!important — use @layer specificity or Tailwind modifiers
- No
@apply outside @layer base — defeats utility-first purpose
- No inline
style={{}} in production — use Tailwind utilities
- No
focus: without visible — always focus-visible: for keyboard users
- No color-only status indicators — include text labels and/or shapes
- No
transition-all — specify explicit properties: transition-colors, transition-opacity
- No bounce/elastic easing — use
ease-out or custom cubic-bezier
- No nested Card inside Card — use spacing/dividers for visual hierarchy
- No font via CSS
font-family — use next/font for optimization
Test-Driven Development for UI
TDD applies to UI component and page work. Write the failing check before writing the component:
- Vitest unit test (
component-name.test.tsx): failing assertion on render, variant output,
or toHaveNoViolations() (vitest-axe) — write this first.
- Visual snapshot (Playwright visual diff): failing screenshot comparison — write before
finalizing visual styles.
- Accessibility check (axe): failing
toHaveNoViolations() in unit test or Playwright — write
before adding interactive states or ARIA markup.
- E2E Playwright spec: failing user-flow assertion — write before implementing flows that cross
component boundaries.
Mini-TDD passes work well for UI: one Red→Green→Refactor cycle per variant, state, or interaction.
Canonical reference:
Test-Driven Development Convention
— covers all test levels (unit, snapshot/visual, a11y, E2E, manual verification) and the full
Red→Green→Refactor cycle.
Governance References