agentleFS
dariopalminiodariopalminio/agile-sddf-extension/skills/code-frontend-library-react/SKILL.md

code-frontend-library-react

Skill0 starsChanged 2 months agoMITView on GitHub

Implement React components for React UI Library: CSS pure + BEM + design tokens, TypeScript strict, tsup build, Turborepo monorepo. Use when creating new components, adding variants, or integrating with demo/storybook apps.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 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.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 30

≈ “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

Code Front-end Library-React Components (React UI Library)

Overview

Implement production-ready components for packages/ui following the project's strict conventions: plain CSS + CSS variables, BEM naming, two-layer token system, TypeScript strict, and Next.js App Router compatibility.

Capabilities:

  • Creates new UI components and composite subparts (for example in packages/ui/src/components/ or in specified component path).
  • Adds variants or sizes to existing components.
  • Adds Storybook stories (to apps/storybook or in specified storybook path).
  • Adds demo pages (to apps/demo or in specified demo path if a demonstration application exists).
  • Refactors components to the --ui-* token system and makes them Next.js App Router compatible.
  • Implements the GREEN and REFACTOR phases of TDD.

Limitations:

  • Testing is out of scope for this skill..

Prerequisites

Use this skill when:

  • Creating a new UI component in packages/ui/src/components/
  • Adding a new variant or size to an existing component
  • IMPLEMENT compound component sub-parts (e.g., CardHeader, CardBody)
  • Adding a component page/demo to apps/demo
  • Adding Storybook stories to apps/storybook
  • Refactoring a component to use the --ui-* token system
  • Making a component Next.js App Router compatible ("use client")

Stack & Architecture

ConcernTechnology
FrameworkReact 18.2+ (plain functions, no React.FC)
LanguageTypeScript strict mode — no any
StylingPlain CSS + CSS Variables (--ui-* prefix)
Class namingBEM: .ui-component, .ui-component--modifier, .ui-component__element
Buildtsup → ESM + CJS + DTS + styles.css
MonorepoTurborepo with packages/ui, apps/demo, apps/storybook
ThemingThemeProvider + useTheme() + data-theme="dark"
Next.jsApp Router compatible, "use client" on interactive components

Non-Negotiable Rules

  1. No CSS-in-JS, no Tailwind, no CSS Modules — plain .css files only
  2. Only semantic tokens in component CSS (--ui-action-primary, not --ui-palette-brand-500)
  3. No external runtime dependencies in packages/ui (only exception: focus-trap-react)
  4. TypeScript strict — export all public types, JSDoc on public props, no any
  5. "use client" directive required on interactive components in index.ts
  6. testId prop is part of the public API — render data-testid={testId ?? "ui-{name}-{variant}"}
  7. Validate prop values at runtime with VALID_* const arrays + console.warn in dev

Checklist for a New Component

  • ComponentName/ComponentName.tsx — component function with typed props
  • ComponentName/ComponentName.css — BEM classes using --ui-* semantic tokens
  • ComponentName/ComponentName.stories.tsx — Storybook v8 stories
  • ComponentName/ComponentName.test.tsx — Vitest unit tests (separate skill)
  • ComponentName/index.ts — re-export with "use client" if interactive
  • ComponentName/types.ts — if props are complex (optional)
  • Export added to packages/ui/src/index.ts
  • ComponentNameDemo.tsx in apps/demo/src/components/
  • ComponentNamePage.tsx in apps/demo/src/pages/
  • Route added in apps/demo/src/App.tsx
  • Entry added in apps/demo/src/components/SidebarDemo.tsx

Resources

  • Constitution: .specify/memory/constitution.md
  • Design tokens: packages/ui/src/tokens/
  • CSS entry: packages/ui/src/styles.css
  • Public API: packages/ui/src/index.ts
  • Button reference implementation: packages/ui/src/components/Button/
  • Input reference implementation: packages/ui/src/components/Input/
  • Card reference implementation: packages/ui/src/components/Card/

References

For more details, consult these reference files (loaded on demand):

TopicReferenceLoad When
Component Structurereferences/component-structure.mdCreating or scaffolding any component
Design Tokensreferences/design-tokens.mdWriting CSS, choosing colors, spacing, radius
Component Patternsreferences/component-patterns.mdCompound components, forwardRef, controlled/uncontrolled
Storybook Patternsreferences/storybook-patterns.mdWriting .stories.tsx files
Accessibilityreferences/accessibility-patterns.mdARIA, keyboard nav, focus management
CSS Stylingreferences/css-styling-approaches.mdCSS conventions, BEM, CSS variable usage
Web Component Designreferences/web-component-design.mdComponent API design, composition, TypeScript typing
Responsive Designreferences/responsive-design.mdAdaptive components (container queries), demo layouts, touch targets, fluid values
Visual Design Principlesreferences/visual-design-principles.mdDesign decisions: spacing grid, color philosophy, typography hierarchy, shadows, border radius, anti-patterns
Animation & Transitionsreferences/animation-transitions.mdCSS transition standards, prefers-reduced-motion, spinner, hover/press patterns
Theming & Dark Modereferences/theming-dark-mode.mdThemeProvider, useTheme(), themeScript, dark mode integration
Icons & SVGreferences/icons-svg.mdIcon components, inline SVG, aria-hidden, decorative vs semantic

These files are only loaded if the agent needs additional context.

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.