component-patterns

Enforces UI component rules for type safety, styling tokens, icons, and context providers in React.

3|1|Updated Jan 12, 2026
One-click install
npx skills add https://github.com/nghyane/VSTEP --skill component-patterns-nghyane
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: component-patterns
Source: https://github.com/nghyane/VSTEP/tree/main/apps/frontend-v3/.agents/skills/component-patterns
Command: npx skills add https://github.com/nghyane/VSTEP --skill component-patterns-nghyane

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend codebases drift into inconsistent styling, unsafe type casts, and ad-hoc component patterns as they grow. This Skill gives an AI assistant the project's exact UI conventions so every generated component follows the same design tokens, type-safety rules, and gamification patterns. ## Core Features & Use Cases - Design token enforcement: Components use semantic tokens from the @theme block in src/styles.css (primary, destructive, skill-*, streak, coin) instead of hardcoded hex values. - Type-safety rules: No as casts in business logic, discriminated unions with exhaustive switch, no non-null assertions, and validated URL search params. - Icon and context conventions: SVG icons imported via ?react with currentColor coloring, and strict context providers built with createStrictContext. - Gamification UI guidance: Chip depth styling, success popups, coin-gain animations, and DuoProgressBar usage for XP, streak, and goal progress. - Use Case: When asked to build a new streak-reward card, the assistant produces a component using border-2 border-b-4 tint styling, token-based colors, and the coin-gain store instead of inventing one-off styles. ## Quick Start Create a new React component for the learner dashboard following the component-patterns rules for tokens, icons, and type safety.

Frequently Asked Questions about component-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a type-safe React component without TypeScript casts?▼

Use discriminated unions for variant data and handle them with exhaustive `switch (x.kind)` statements. Reserve `as` casts for DOM or React boundaries only, and replace non-null assertions with early returns or conditional rendering like `{value && <Comp />}`.

How to use design tokens instead of hardcoded colors in Tailwind?▼

Reference semantic token classes like `bg-primary` or `text-muted` defined in the `@theme` block of `src/styles.css`. For dynamic colors, pass them via `style={{ color: config.color }}` rather than constructing Tailwind class strings.

How do I import SVG icons as React components in Vite?▼

Import SVGs with the `?react` suffix, for example `import Icon from "#/assets/icons/name.svg?react"`. Mono icons use `currentColor` so you can color them via the `style` prop or className.

When should I use a popup instead of a toast notification?▼

Use a popup for major reward events like coin top-ups or level-ups, and reserve toasts for minor feedback. Success popups combine a gradient banner, pulse ring, coin burst, and a tilted "+N" badge without emojis next to the headline.

Why avoid mapping over config arrays for small fixed UI sets?▼

Explicitly written UI elements are easier to read, type-check, and modify than `.map()` over configuration arrays when the set is small and fixed. The indirection adds complexity without payoff and obscures per-element differences.