ai-generative-ui
Data-driven generative UI — tool results render as rich React components in chat instead of raw JSON. Uses a registry pattern with _ui field, not createStreamableUI(). Use this skill when the user says "generative ui", "rich tool cards", "custom tool rendering", or "tool components".
What this skill does
# AI Generative UI
Experience layer that renders tool results as interactive React components inside the chat stream instead of raw JSON. Uses a data-driven approach: tool `execute` functions return a `_ui` field that names a registered component, and the client-side renderer looks it up in a registry.
This does **not** use `createStreamableUI()` (that is an older RSC pattern incompatible with the current architecture). Instead, tool results are plain data objects with a `_ui` type hint that the client uses to select the appropriate React component.
## Prerequisites
- Next.js app with `src/` directory and App Router
- `ai-core` skill installed (provides `getModel()`)
- `ai-chat` skill installed (provides chat UI, route pipeline, message renderer)
- `ai-tools` skill installed (provides tool calling framework and `tool-invocation` rendering)
## Installation
No additional packages required. Uses `ai`, `zod`, and `@ai-sdk/react` already installed by prerequisite skills.
## What Gets Created
```
src/
├── lib/
│ └── ai/
│ └── ui-registry.ts # Component registry — maps tool _ui values to React components
└── components/
└── ai/
└── gen-ui/
├── weather-card.tsx # Example: weather display with temperature + conditions
├── data-card.tsx # Example: structured key-value display card
└── confirmation.tsx # Example: interactive yes/no confirmation card
```
## What Gets Modified
```
src/
├── app/
│ └── api/
│ └── ai/
│ └── chat/
│ └── route.ts # Tool execute functions return _ui field
└── components/
└── ai/
└── message.tsx # Check tool-result for _ui field, render registered component
```
## Comment Slots
- **message.tsx**: `// [ai-generative-ui]: check for _ui field` — checks tool results for `_ui` field and renders registered component
- **message.tsx**: `// [ai-generative-ui]: import gen-ui components to trigger registration` — side-effect imports that register components
## Setup Steps
### Step 1: Create `src/lib/ai/ui-registry.ts`
```typescript
import { type ComponentType } from "react";
/**
* Registry mapping `_ui` field values from tool results to React components.
*
* When a tool's `execute` function returns `{ ...data, _ui: "WeatherCard" }`,
* the message renderer looks up "WeatherCard" in this registry and renders
* the matched component with the tool result as the `data` prop.
*
* If no component is found, the renderer falls back to the default JSON
* tool result card from ai-tools.
*/
type GenUIProps<T = Record<string, unknown>> = {
data: T;
};
type GenUIComponent = ComponentType<GenUIProps>;
const registry = new Map<string, GenUIComponent>();
/**
* Register a component for a given _ui key.
* Call this at module scope in your component files.
*/
export function registerUIComponent(
key: string,
component: GenUIComponent
): void {
registry.set(key, component);
}
/**
* Look up a component by _ui key.
* Returns undefined if no component is registered.
*/
export function getUIComponent(
key: string
): GenUIComponent | undefined {
return registry.get(key);
}
/**
* Check if a tool result has a _ui field that maps to a registered component.
*/
export function hasUIComponent(result: unknown): result is {
_ui: string;
[key: string]: unknown;
} {
return (
typeof result === "object" &&
result !== null &&
"_ui" in result &&
typeof (result as Record<string, unknown>)._ui === "string" &&
registry.has((result as Record<string, unknown>)._ui as string)
);
}
export type { GenUIProps, GenUIComponent };
```
### Step 2: Create `src/components/ai/gen-ui/weather-card.tsx`
```tsx
"use client";
import { memo } from "react";
import { registerUIComponent, type GenUIProps } from "@/lib/ai/ui-registry";
type WeatherData = {
location: string;
temperature: number;
unit: string;
conditions: string;
humidity: number;
windSpeed: number;
windUnit: string;
feelsLike: number;
_ui: string;
};
function getWeatherIcon(conditions: string): string {
const lower = conditions.toLowerCase();
if (lower.includes("sun") || lower.includes("clear")) return "sun";
if (lower.includes("cloud") && lower.includes("part"))
return "cloud-sun";
if (lower.includes("cloud")) return "cloud";
if (lower.includes("rain") || lower.includes("drizzle"))
return "cloud-rain";
if (lower.includes("snow")) return "snowflake";
if (lower.includes("thunder") || lower.includes("storm"))
return "cloud-lightning";
if (lower.includes("fog") || lower.includes("mist")) return "cloud-fog";
return "thermometer";
}
function WeatherIcon({ conditions }: { conditions: string }) {
const icon = getWeatherIcon(conditions);
const icons: Record<string, React.ReactNode> = {
sun: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="text-yellow-500"
>
<circle cx="12" cy="12" r="4" />
<path d="M12 2v2" />
<path d="M12 20v2" />
<path d="m4.93 4.93 1.41 1.41" />
<path d="m17.66 17.66 1.41 1.41" />
<path d="M2 12h2" />
<path d="M20 12h2" />
<path d="m6.34 17.66-1.41 1.41" />
<path d="m19.07 4.93-1.41 1.41" />
</svg>
),
cloud: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="text-gray-400"
>
<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" />
</svg>
),
"cloud-rain": (
<svg
xmlns="http://www.w3.org/2000/svg"
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="text-blue-400"
>
<path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" />
<path d="M16 14v6" />
<path d="M8 14v6" />
<path d="M12 16v6" />
</svg>
),
thermometer: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="text-orange-400"
>
<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z" />
</svg>
),
};
return <>{icons[icon] ?? icons.thermometer}</>;
}
const WeatherCard = memo(function WeatherCard({ data }: GenUIProps<WeatherData>) {
return (
<div className="overflow-hidden rounded-xl border bg-gradient-to-br from-blue-50 to-sky-50 dark:from-blue-950 dark:to-sky-950">
<div className="p-4">
{/* Location + Icon row */}
<div className="flex items-start justify-between">
<div>
<p className="text-sm font-medium text-muted-foreground">
{data.location}
</p>
<p className="mt-1 text-3xl font-bold tracking-tight">
{Math.round(data.temperature)}{data.unit === "celsius" ? "\u00B0C" : "\u00B0F"}
</p>
</div>
<WeatherIcon conditions={data.conditions} />
</div>
{/* Conditions */}
<p className="mt-1 text-sm capitalize text-muted-foreground">
{data.conditions}
</p>
{/* Details row */}
<div className="mt-4 grid grid-cols-3 gap-3 border-t pt-3">
<div>
<p className="text-xs text-muted-foreground">Feels like</p>
<p className="teRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.