create-new-component

A workflow for adding new components to the PolicyEngine UI kit, a reusable library of interface elements.

In plain words
What is it for?
Use it to research similar components, build variants and states, validate styling tokens, write tests, create a visual preview, and open a pull request.
Why use it?
It helps ensure a new component follows existing designs, uses the project's design tokens, has tests, and is reviewed before merging.

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/policyengine/policyengine-claude/create-new-component
Clone the repo
git clone --depth 1 https://github.com/PolicyEngine/policyengine-claude
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,033 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.00024 $0.02033
Opus 5 $0.00012 $0.01017
Sonnet 5 $0.00005 $0.00407
Haiku 4.5 $0.00002 $0.00203

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

Security

Grade A, and why

create-new-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.

commands/create-new-component.md · 258 lines

How it starts

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

Create new component

Builds one or more new components for the @policyengine/ui-kit library. Handles the full lifecycle: research existing patterns, build with design tokens, validate token usage, write tests, preview visually, and open a PR.

Prerequisites

The policyengine-ui-kit repo must be cloned locally. If not found, clone it:

gh repo clone PolicyEngine/policyengine-ui-kit

All work happens in the policyengine-ui-kit repo directory.

Step 1: Gather requirements

Use AskUserQuestion to ask the user:

  1. Component description — What component(s) do you need? Describe their purpose, behavior, and any variants.

Parse the description to identify:

  • Component names (PascalCase, e.g., Tooltip, ProgressBar, Accordion)
  • Which category they belong to: primitives, layout, inputs, display, or charts
  • Expected props, variants, and states

Step 2: Research app-v2 for similar components

Before building from scratch, search PolicyEngine/policyengine-app-v2 for similar implementations:

# Search app-v2 for components with similar names or purposes
find /path/to/policyengine-app-v2/app/src -name "*.tsx" | xargs grep -li "COMPONENT_NAME_PATTERN"

# Check how app-v2 composes the same component type (radix-ui + Tailwind + CVA)
grep -r "COMPONENT_TYPE" /path/to/policyengine-app-v2/app/src --include="*.tsx" -l
grep -r "COMPONENT_TYPE" /path/to/policyengine-app-v2/website/src --include="*.tsx" -l

If similar components exist in app-v2:

  • Study their props interface, variant patterns, and behavior
  • Adapt the design and UX, rebuilt on the ui-kit's Tailwind v4 + CVA stack

If nothing similar exists in app-v2:

  • Research common patterns for that component type
  • Design props and variants that are consistent with existing ui-kit components

Step 3: Build the component(s)

Tech stack (mandatory):

  • React 19 with forwardRef
  • TypeScript with strict types
  • Tailwind CSS v4 with standard class names (no prefix)
  • CVA (class-variance-authority) for variant management
  • cn() utility from @/utils/cn for class merging
  • Design tokens from ui-kit's theme.css (colors, spacing, typography, radius)

Read the full file on GitHub · 258 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 · 258 lines · 24 tokens per session scan A 6e4e0ee03e0a

Subscribe to this mod's changes

create-new-component is a command published in the GitHub repository PolicyEngine/policyengine-claude (31 stars, last pushed 7d ago), licensed MIT. It adds 24 tokens to every session and 2,033 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-30.