Skip to content
Back to skills

Generative Ui Expert

ASecurity

Use when Generative UI mastery. Vercel AI SDK 3.0+, React Server Components (RSC) + LLMs, streaming UI elements, structured tool calling (Zod schemas), and managing client-side AI state via useChat/useObject.

  • 7 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agentstypescriptbashreactnextjsapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add Harmitx7/tribunal-kit --skill generative-ui-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Generative Ui Expert?

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

Security grade badge for Generative Ui Expert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/harmitx7-generative-ui-expert-tribunal-kit/badge)](https://www.skillsdirectory.com/skills/harmitx7-generative-ui-expert-tribunal-kit)

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: generative-ui-expert
description: "Use when Generative UI mastery. Vercel AI SDK 3.0+, React Server Components (RSC) + LLMs, streaming UI elements, structured tool calling (Zod schemas), and managing client-side AI state via useChat/useObject."
version: 5.0.0
last-updated: 2026-09-13
skills:
  - nextjs-react-expert
  - react-specialist
  - browser-native-ai
tools: Read, Grep, Glob, Bash, Edit, Write
scripts-binding:
  - .agent/scripts/lint_runner.js
  - .agent/scripts/verify_all.js
---

# Generative UI Expert (Vercel AI SDK)

---

## 🛠️ Technical Architecture & Reference Recipes

---

## 1. Core Principles

- **No Markdown Slop:** Avoid dumping raw markdown when structured UI can be used. If the user asks for a weather report, stream a `<WeatherCard />`, not text.
- **Server-Driven UI:** Leverage React Server Components (`ai/rsc`) to stream actual React components over the wire as the LLM yields function calls.
- **Structured Data First:** Use strict Zod schemas (`useObject`, `streamObject`) whenever you need the LLM to output parsable data.
- **Progressive Disclosure:** Use `streamUI` to yield intermediate loading states (e.g., `<SkeletonLoader />`) while waiting for external APIs.

## 2. Vercel AI SDK Patterns

### A. Streaming React Components (`ai/rsc`)

When setting up `ai/rsc`, define explicit tool boundaries:

```typescript
import { createAI, getMutableAIState, streamUI } from "ai/rsc";
import { z } from "zod";

export const AI = createAI({
  actions: {
    submitMessage: async (message: string) => {
      "use server";
      return streamUI({
        model: openai("gpt-4-turbo"),
        system: "You are a helpful assistant.",
        prompt: message,
        tools: {
          getWeather: {
            description: "Get the weather for a location",
            parameters: z.object({ city: z.string() }),
            generate: async ({ city }) => {
              yield <WeatherSkeleton city={city} />;
              const temp = await fetchWeatherAPI(city);
              return <WeatherCard city={city} temp={temp} />;
            }
          }
        }
      });
    }
  }
});
```

### B. Structured Output (`streamObject`)

Use this when you need strict JSON streams for charts, tables, or complex states.

```typescript
const result = await streamObject({
  model: openai('gpt-4-turbo'),
  schema: z.object({
    points: z.array(z.object({ x: z.number(), y: z.number() })),
  }),
  prompt: 'Generate a sales forecast chart data',
});
// Client consumes via useObject
```

## 3. Client-Side State Management

- Use `useChat` for standard text+tool workflows.
- Use `useUIState` and `useAIState` to manage the UI payload array and the underlying LLM message history separately.
- Always include `id` and `role` in message schemas to prevent key-rendering bugs in React.

## 4. LLM Traps & Pre-Flight Checks

- **TRAP:** Sending client components directly over the wire from `generate:`.
- **FIX:** Server actions can only return Server Components. If returning an interactive widget, wrap it in a client component but yield it from the server.
- **TRAP:** Forgetting to yield intermediate states in slow tools.
- **FIX:** Always `yield <Loading />` before awaiting slow API calls inside a tool's `generate` function.

## Verification Protocol

Before submitting code, ensure:

1. `zod` is used for all tool parameters.
2. Server Actions are properly annotated with `"use server"`.
3. The model supports tool calling (e.g., `gpt-4o`, `claude-3-5-sonnet`).

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.