Skip to content
Back to skills

Ai Ui Generation

ASecurity

Prompt-to-UI, JSON-to-UI and generative-interface patterns — component registries, schema validation, and the guardrails generated markup must pass. Use when building or consuming AI-generated UI — prompt-to-component scaffolding, schema-driven or server-driven rendering, a chat surface that renders components rather than prose — or when reviewing model-generated markup before it ships.

  • 11 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added October 22, 2026
ai-agentstypescriptrustgoreactrailsapi

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned October 22, 2026

npx -y skills add Krishna-Modi12/frontend-design-pro --skill ai-ui-generation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ai Ui Generation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ai Ui Generation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/krishna-modi12-ai-ui-generation/badge)](https://www.skillsdirectory.com/skills/krishna-modi12-ai-ui-generation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ai-ui-generation
description: Prompt-to-UI, JSON-to-UI and generative-interface patterns — component registries, schema validation, and the guardrails generated markup must pass. Use when building or consuming AI-generated UI — prompt-to-component scaffolding, schema-driven or server-driven rendering, a chat surface that renders components rather than prose — or when reviewing model-generated markup before it ships.
metadata:
  version: "15.0.0"
  core-deps:
    - core/component-api.md
    - core/validate-checklist.md
---

# AI UI Generation

## When to Use
Building or consuming AI-generated UI: prompt-to-component scaffolding, JSON/schema-driven rendering, server-driven UI, or a chat surface that renders components instead of prose. Also when reviewing model-generated markup before it ships.

## Stack
React 19 · TypeScript strict · Zod for boundary validation · Tailwind v4

## Core Rules
1. **Generated code is untrusted input.** It passes the same gate as hand-written code — no exemptions, ever.
2. **Never render model output as raw HTML.** No `dangerouslySetInnerHTML` on generated strings; that is the injection surface.
3. **Constrain by registry, not by prompt.** For generative interfaces, expose a closed set of typed components the model selects from. The registry is the safety boundary — a prompt is not.
4. **Validate props at the boundary with a schema**, before render. Failure renders the component's error state, never a blank.
5. **Unknown component → documented fallback.** Never improvise markup for a name you don't recognise.
6. **Keep the registry small.** Every entry is misuse surface, and selection accuracy degrades as it grows.
7. **Rewrite colours to OKLCH on arrival** — generators emit hex by default.
8. **Add what generators always omit:** loading/empty/error states, `prefers-reduced-motion`, `aria-label` on icon-only controls, real prop interfaces.
9. **Put the tokens in the prompt.** Given a token, a model uses it; given "our brand colour", it invents indigo.
10. **Constraints as bans beat adjectives.** "No gradients, no card grid, OKLCH only, TS strict" shapes output far better than "modern and clean".

## Patterns
- **Prompt → component** — first-draft scaffold, always rewritten. Never a final artifact.
- **JSON → UI** — schema-validated tree rendered through owned components.
- **Component registry** — closed, typed, Zod-validated; the model selects and fills props, never emits markup.
- **AI design review** — model critiques against the anti-slop wall and `core/validate-checklist.md` rather than generating.

## Reference Index
Load only for the specific task:

| Task | Load |
|---|---|
| Generation shapes, registry pattern, guardrails, prompt shape, when to avoid | `references/generation-patterns.md` |
| Registry/catalog mechanics, Zod-as-tool-definitions, streamed spec shape, partial-prop rendering | `references/generative-ui-runtimes.md` |
| The constraint list generated output must satisfy | `core/validate-checklist.md` |
| Prop/schema design for registered components | `core/component-api.md` |
| Behavioural discipline when accepting generated work | `core/agent-behavior.md` |

## Constraints
No `dangerouslySetInnerHTML` on model output · schema validation at every boundary · OKLCH tokens, no raw hex (`COL-04`) · TypeScript strict with real prop interfaces (`TS-01-AST`) · four states present · `prefers-reduced-motion` handled (`MOTION-01`) · axe-clean before ship. Generated output that cannot pass the parser gate is fixed at the prompt or the registry — never exempted.

Files in this skill

  • SKILL.md3.5 KB
  • examples/_r3f-jsx.d.ts1.6 KB
  • examples/_stubs.d.ts3.6 KB
  • examples/good-registry-renderer.test.tsx3.5 KB
  • examples/good-registry-renderer.tsx8 KB
  • references/generation-patterns.md3.9 KB
  • references/generative-ui-runtimes.md6.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.