New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Frontend app development plugin for PolicyEngine's React apps, standalone tools, and Vercel deployment.

version
4.2.0
GitHub stars
31
View on GitHub

What it does

  • Adds commands like /create-new-component, /new-tool, /create-dashboard, and /deploy-dashboard for building PolicyEngine interfaces
  • Covers the policyengine-app and policyengine-tools skills, plus policyengine-api-access guidance for calling the Public API safely
  • Includes a review-program skill and fix-pr skill that apply review findings and CI failures to pull requests
  • Designed for teams building PolicyEngine-specific React apps, dashboards, and tools that run on Vercel

React app development - app-v2, standalone tools, Vercel deployment, and PolicyEngine-specific patterns

Add marketplace

/plugin marketplace add PolicyEngine/policyengine-claude

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install app-development@policyengine-claude

Run it inside Claude Code after adding the marketplace.

Files

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)

File structure for each component:

src/<category>/ComponentName.tsx

Component template:

import { cva, type VariantProps } from 'class-variance-authority';
import { forwardRef, type HTMLAttributes } from 'react';
import { cn } from '../utils/cn';

const componentVariants = cva(
  'base-classes-here',
  {
    variants: {
      variant: {
        default: 'variant-classes',
        // ... more variants
      },
      size: {
        sm: 'size-classes',
        md: 'size-classes',
        lg: 'size-classes',
      },
    },
    defaultVariants: { variant: 'default', size: 'md' },
  },
);

export interface ComponentNameProps
  extends HTMLAttributes<HTMLDivElement>,
    VariantProps<typeof componentVariants> {
  // Additional props here
}

export const ComponentName = forwardRef<HTMLDivElement, ComponentNameProps>(
  ({ variant, size, className, children, ...props }, ref) => (
    <div
      ref={ref}
      className={cn(componentVariants({ variant, size }), className)}
      {...props}
    >
      {children}
    </div>
  ),
);
ComponentName.displayName = 'ComponentName';

Rules:

  • ALL colors, spacing, font sizes, and radii must reference design tokens — no hardcoded hex values, no arbitrary pixel values
  • Use semantic classes (bg-primary, text-foreground) or brand palette classes (bg-teal-500, text-gray-600)
  • Export the component and its props interface from the category barrel (src/<category>/index.ts)
  • Export from the main barrel (src/index.ts)
  • Build ALL components the user requested — do not skip any

Step 4: Design token validation agent

Launch the Dashboard Design Validator Agent (agents/dashboard/dashboard-design-validator.md) to audit every component file created in Step 3.

The agent will:

  1. Scan all new component files for hardcoded values
  2. Replace hardcoded colors, spacing, font sizes, and radii with token-based Tailwind classes
  3. Report what was replaced and what was kept

Review the agent's output. If it made changes, verify they look correct.

Step 5: Add components to a preview page

Create or update demo/Demo.tsx to include a new section showcasing ALL new components with realistic example data.

// Add a new section for each component
<section>
  <h2 className="text-2xl font-bold mb-4">ComponentName</h2>
  <div className="flex flex-wrap gap-3">
    {/* Render every variant, size, and state */}
    <ComponentName variant="default">Example</ComponentName>
    <ComponentName variant="primary" size="lg">Large primary</ComponentName>
    {/* ... all combinations */}
  </div>
</section>

Important: Include ALL new components on the preview page, not just some.

Step 6: Launch preview and iterate with user

Start the demo dev server:

cd /path/to/policyengine-ui-kit
bun run dev:demo

Tell the user:

The demo server is running at http://localhost:5173/demo/index.html — scroll to the new component section to preview your components.

Then use AskUserQuestion to ask:

Do the components look correct? Please review and either approve or describe changes you'd like.

This is iterative. If the user requests changes:

  1. Apply the requested modifications
  2. The dev server will hot-reload automatically
  3. Ask the user to review again
  4. Repeat until the user approves

Do NOT proceed to Step 7 until the user explicitly approves the components.

Step 7: Component test writer agent

After user approval, launch the Component Test Writer Agent (agents/app/component-test-writer.md) to write unit tests for ALL new components.

The agent will:

  1. Read each new component file
  2. Write comprehensive test files (rendering, props, variants, interaction, ref forwarding)
  3. Place tests next to components (src/<category>/ComponentName.test.tsx)
  4. Run bun run test and fix any failures

Verify all tests pass:

cd /path/to/policyengine-ui-kit
bun run test

If tests fail, fix them before proceeding.

Step 8: Create changelog fragment

Add a towncrier changelog fragment:

echo "Add <ComponentName>, <ComponentName2>, ... components." > changelog.d/add-COMPONENT_NAME.added.md

Step 9: Commit, push, and open PR

# Create feature branch
git checkout -b add-COMPONENT_NAME-component

# Stage all new and modified files
git add src/<category>/ComponentName.tsx
git add src/<category>/ComponentName.test.tsx
git add src/<category>/index.ts
git add src/index.ts
git add demo/Demo.tsx
git add changelog.d/add-COMPONENT_NAME.added.md

# Commit
git commit -m "Add ComponentName component with tests"

# Push
git push -u origin add-COMPONENT_NAME-component

Create a PR with details about the new components and their test coverage:

gh pr create --repo PolicyEngine/policyengine-ui-kit \
  --title "Add ComponentName component" \
  --body "$(cat <<'EOF'
## Summary
- Add `ComponentName` component to `@policyengine/ui-kit`
- <Describe each component, its variants, and purpose>

## Components added
- `ComponentName` — <brief description>
  - Variants: <list variants>
  - Props: <list key props>

## Testing
- Unit tests written with Vitest + React Testing Library
- Tests cover: rendering, all variants, props, interaction, ref forwarding
- All tests passing

## Design token compliance
- All colors reference design tokens (no hardcoded hex)
- All spacing uses standard Tailwind classes
- All typography uses token scale
- Validated by dashboard-design-validator agent

## Test plan
- [ ] Run `bun run dev:demo` and verify components render correctly
- [ ] Run `bun run test` and verify all tests pass
- [ ] Review component API matches existing ui-kit conventions

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

Report the PR URL to the user.

Reference

See these skills and agents for detailed guidance:

  • policyengine-design — Design token values and usage
  • policyengine-app — app-v2 component patterns to reference
  • agents/dashboard/dashboard-design-validator.md — Automated design token compliance
  • agents/app/component-test-writer.md — Automated test writing

From the PolicyEngine/policyengine-claude README

PolicyEngine Claude

Generated Claude Code wrapper for PolicyEngine.

This repository is built from PolicyEngine/policyengine-skills. Do not edit it directly unless you are fixing a sync emergency.

encode-policy-v2, review-program and fix-pr are skill entrypoints and retain their namespaced slash commands. They have no same-named command stubs: duplicate registration can resolve to the stub instead of the skill. The wrapper builder rejects such collisions.

Install

/plugin marketplace add PolicyEngine/policyengine-claude
/plugin install complete@policyengine-claude

Other bundles:

/plugin install essential@policyengine-claude
/plugin install country-models@policyengine-claude
/plugin install api-development@policyengine-claude
/plugin install app-development@policyengine-claude
/plugin install analysis-tools@policyengine-claude
/plugin install data-science@policyengine-claude
/plugin install dashboard-builder@policyengine-claude
/plugin install content@policyengine-claude

Details

Marketplace
PolicyEngine/policyengine-claude
Author
PolicyEngine
Category
Development
License
MIT
Keywords
react, frontend, app, ui, components, vercel, interactive-tools
Listed since
Apr 7, 2026

More from PolicyEngine/policyengine-claude

All 8

Similar to app-development

More Frontend & UI Code