component-gen

component-gen is a command for coding agents from halflength-ampleness75/claude-code-recipes. It costs 15 tokens per session (1,318 once invoked), scanned A, original, MIT.

A command that creates React or Vue user-interface components from a written description, including prop types, styling, accessibility features, and tests.

In plain words
What is it for?
Use it to create components such as data tables, modals, and search bars, including states like loading, errors, and empty results.
Why use it?
It removes the need to start each component from an empty file and helps fit the result to the project's existing framework and coding patterns.

Command

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/halflength-ampleness75/claude-code-recipes/component-gen
Clone the repo
git clone --depth 1 https://github.com/halflength-ampleness75/claude-code-recipes

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-gen

README.md
[![agentmods](https://agentmods.dev/badge/commands/halflength-ampleness75/claude-code-recipes/component-gen.svg)](https://agentmods.dev/commands/halflength-ampleness75/claude-code-recipes/component-gen)
Your own site
<a href="https://agentmods.dev/commands/halflength-ampleness75/claude-code-recipes/component-gen"><img src="https://agentmods.dev/badge/commands/halflength-ampleness75/claude-code-recipes/component-gen.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,318 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.00015 $0.01318
Opus 5 $0.00008 $0.00659
Sonnet 5 $0.00003 $0.00264
Haiku 4.5 $0.00002 $0.00132

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

Security

Grade A, and why

component-gen 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 5d 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.

commands/component-gen.md · 164 lines

How it starts

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

Generate a production-quality UI component from the description provided in $ARGUMENTS.

Step 1 — Parse the Request

Extract from $ARGUMENTS:

  • Component name (e.g., "DataTable", "Modal", "SearchBar")
  • Feature requirements (what the component should do)
  • Framework preference (React or Vue — detect from project if not stated)
  • Variants or states (e.g., "loading, error, empty states")

If the description is minimal (e.g., just "Modal"), generate a fully-featured, accessible version with sensible defaults.

Step 2 — Detect Project Conventions

Search the project to determine:

  1. Framework: React (JSX/TSX) or Vue (SFC .vue files). Check package.json for react, vue, next, nuxt, etc.
  2. Language: TypeScript or JavaScript. Check for tsconfig.json, existing file extensions.
  3. Styling approach: CSS Modules, Tailwind CSS, styled-components, Emotion, SCSS, plain CSS, or a UI library (shadcn/ui, MUI, Chakra, Vuetify, etc.). Check existing components.
  4. State management: React hooks, Zustand, Redux, Pinia, Vuex.
  5. Component patterns: Read 1-2 existing components to match:
    • File naming convention (PascalCase.tsx, kebab-case.vue)
    • Directory structure (flat, feature-based, atomic design)
    • Export patterns (default export vs named export)
    • Props definition pattern (interface, type, defineProps)

Step 3 — Design the Component API

Before writing code, define the component's public interface:

## Component Design: [Name]

### Props
| Prop | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| ...  | ...  | ...     | ...      | ...         |

### Events / Callbacks
| Event | Payload | Description |
|-------|---------|-------------|
| ...   | ...     | ...         |

### Slots / Children (if applicable)
| Slot | Description |
|------|-------------|
| ...  | ...         |

### States
- Default, Loading, Error, Empty, Disabled (as applicable)

Step 4 — Generate the Component

Read the full file on GitHub · 164 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. 5d ago First seen · 164 lines · 15 tokens per session scan A b7171a17889d

Subscribe to this mod's changes

component-gen is a command published in the GitHub repository halflength-ampleness75/claude-code-recipes (2 stars, last pushed today), licensed MIT. It adds 15 tokens to every session and 1,318 once invoked, about $0.0001 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-31.