component-design

component-design is a skill for Claude Code, Codex from sawrus/agent-guides. It costs 61 tokens per session (1,514 once invoked), scanned A, original, MIT.

React component design patterns are ways to build reusable interface pieces with clear inputs, shared state, asynchronous states, and accessibility behavior. React is a JavaScript library for building user interfaces, and props are the inputs passed into its components.

In plain words
What is it for?
Use them when creating or refactoring React components, designing typed props, choosing between shared or externally controlled state, building interactive widgets, or checking accessibility and TypeScript behavior.
Why use it?
They help components remain predictable when reused or connected to forms and other code. They also ensure loading, error, empty, success, keyboard, and screen-reader states are considered.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sawrus/agent-guides/component-design
Any agent
npx skills add sawrus/agent-guides --skill component-design
Clone the repo
git clone --depth 1 https://github.com/sawrus/agent-guides

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for component-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/sawrus/agent-guides/component-design.svg)](https://agentmods.dev/skills/sawrus/agent-guides/component-design)
Your own site
<a href="https://agentmods.dev/skills/sawrus/agent-guides/component-design"><img src="https://agentmods.dev/badge/skills/sawrus/agent-guides/component-design.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,514 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00061 $0.01514
Opus 5 $0.00030 $0.00757
Sonnet 5 $0.00012 $0.00303
Haiku 4.5 $0.00006 $0.00151

Measured 4d ago against content hash c9bff1cd0d25, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

component-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

areas/software/frontend/skills/component-design/SKILL.md · 184 lines

How it starts

The opening of the file, as written. The whole thing — 184 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Component Design Patterns Skill

Expertise: Compound components, controlled/uncontrolled, render props, component API design, accessibility requirements.

When to load

When creating, refactoring, or reviewing React components — especially when choosing between compound, controlled/uncontrolled, or headless patterns, designing typed prop APIs, or implementing accessible interactive widgets.

Component Design Workflow

  1. Choose pattern — use the decision tree below to select the right component pattern
  2. Define typed props — follow the Props API Design Rules (explicit variants, no boolean explosion)
  3. Implement all states — loading, error, empty, success for any async data
  4. Add accessibility — use the ARIA requirements table to add correct roles and keyboard support
  5. Verify — confirm keyboard navigation works, screen reader announces states, and TypeScript compiles with --strict

Pattern Selection Guide

Multiple visual zones in one component?         → Slot / Children Props
Coordinated subcomponents sharing state?        → Compound Components
Works with react-hook-form / external control?  → Controlled/Uncontrolled Hybrid
Self-contained widget with internal state?      → Uncontrolled with defaults
Highly customizable rendering?                  → Render Props / Headless

Pattern 1: Compound Components

Use when: a component has multiple coordinated parts sharing implicit state.

// Context shared between sub-components
const MenuContext = createContext<{ open: boolean; toggle: () => void } | null>(null);

const Menu = ({ children }: { children: React.ReactNode }) => {
  const [open, setOpen] = useState(false);
  return (
    <MenuContext.Provider value={{ open, toggle: () => setOpen(o => !o) }}>
      <div role="menu" aria-expanded={open}>{children}</div>
    </MenuContext.Provider>
  );
};

Menu.Trigger = function MenuTrigger({ children }: { children: React.ReactNode }) {
  const ctx = useContext(MenuContext)!;
  return (
    <button onClick={ctx.toggle} aria-haspopup="true" aria-expanded={ctx.open}>
      {children}
    </button>
  );
};

Menu.Items = function MenuItems({ children }: { children: React.ReactNode }) {
  const { open } = useContext(MenuContext)!;
  if (!open) return null;
  return <ul role="listbox">{children}</ul>;
};

// Usage — caller controls structure
<Menu>
  <Menu.Trigger>Options</Menu.Trigger>
  <Menu.Items>
    <li role="option">Edit</li>
    <li role="option">Delete</li>
  </Menu.Items>
</Menu>

Read the full file on GitHub · 184 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 184 lines · 61 tokens per session scan A c9bff1cd0d25

Subscribe to this mod's changes

component-design is a skill published in the GitHub repository sawrus/agent-guides (17 stars, last pushed 4d ago), licensed MIT. It adds 61 tokens to every session and 1,514 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

frontend-ui-engineering

Builds production-quality, accessible, responsive user-facing UIs. Use when building or modifying interfaces and pages, creating components, implementing layouts, meeting WCAG accessibility requirements, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

addyosmani/agent-skills · 58 tokens

3d-web-experience

Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences.

sickn33/agentic-awesome-skills · 57 tokens

accesslint-scan

Audit a live page for accessibility issues, locate each WCAG violation precisely, and return a selector-grounded fix worklist without editing.

sickn33/agentic-awesome-skills · 32 tokens

accessibility-compliance-accessibility-audit

You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.

sickn33/agentic-awesome-skills · 40 tokens

excalidraw-architect

Choose and compose the right Excalidraw diagram - architecture, flowchart, sequence, state, ER, swimlane, process, timeline, quadrant, pyramid, venn, loop, gantt, bar, line, scatter, and more - using the excalidraw-architect-mcp server. Use whenever a reader would learn more from a picture than from prose, or when…

BV-Venky/excalidraw-architect-mcp · 101 tokens

excalidraw-diagram-design

Guide for structuring graph input (nodes and edges) for the Excalidraw Architect MCP tool to produce clean, readable diagrams. Use when generating architecture diagrams, flow diagrams, or any visual diagram via creatediagram or mermaidtoexcalidraw.

BV-Venky/excalidraw-architect-mcp · 61 tokens