dev-component

A development aid for creating a complete React user-interface component or reusable custom hook. It includes types, tests, implementation, documentation, and Storybook where applicable.

In plain words
What is it for?
Use it to build tested React components or hooks, define their inputs and outputs, cover states and interactions, clean up side effects, and provide exports and usage documentation.
Why use it?
It gives UI work a defined sequence—types, tests, implementation, and cleanup—so behaviour, errors, and reusable interfaces are checked before delivery.

Command for Claude Code

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 commands/christopherlouet/claude-base/dev-component
Clone the repo
git clone --depth 1 https://github.com/christopherlouet/claude-base

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 512 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.00000 $0.00512
Opus 5 $0.00000 $0.00256
Sonnet 5 $0.00000 $0.00102
Haiku 4.5 $0.00000 $0.00051

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

Security

Grade A, and why

dev-component 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 2d 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.

.claude/commands/dev/dev-component.md · 56 lines

How it starts

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

Agent DEV-COMPONENT

Generate a complete UI component — or a custom React hook — with tests, types and documentation.

Request context

$ARGUMENTS

Objective

Create a complete React component (or a reusable custom hook) following the TDD approach: types first, then tests (RED), implementation (GREEN), refactoring and Storybook.

Custom hook mode

When the request is a hook rather than a component:

  • Define the hook (problem, parameters, return, side effects) and its types (Options, Return) with JSDoc.
  • Write tests with renderHook (initial state, success, errors, refetch, options change).
  • Implement (useState/useEffect/useCallback/useMemo); clean up side effects (AbortController, clearTimeout, removeEventListener) — no memory leaks.
  • Output: use[HookName].ts + use[HookName].test.ts + export in index.ts + usage docs.

Workflow

  • Define the component: name, framework, props/API, internal state, variants
  • Create the types ([ComponentName].types.ts) with JSDoc
  • Write the tests ([ComponentName].test.tsx): render, variants, click, disabled, className
  • Implement the component ([ComponentName].tsx) with forwardRef, clsx, CSS modules
  • Create the Storybook stories ([ComponentName].stories.tsx) with argTypes
  • Verify: typed props, disabled handling, modular CSS, tests >80%, accessibility (aria-*, role, tabIndex)

Expected output

  • [ComponentName].tsx - Main component
  • [ComponentName].types.ts - TypeScript types
  • [ComponentName].test.tsx - Unit tests
  • [ComponentName].stories.tsx - Storybook documentation
  • [ComponentName].module.css - Styles
  • index.ts - Export
Agent When to use it
/dev:dev-tdd Complementary tests / TDD cycle
/qa:wcag-audit Component accessibility audit
/qa:qa-design Verify responsive/UI design

IMPORTANT: Always type props with explicit interfaces.

YOU MUST add tests for each prop and behavior.

NEVER forget accessibility (aria-label, role, keyboard navigation).

Read the full file on GitHub · 56 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. 2d ago First seen · 56 lines · 0 tokens per session scan A 9cd4774a17ec

Subscribe to this mod's changes

dev-component is a command published in the GitHub repository christopherlouet/claude-base (5 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 512 tokens. 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-31.