Patterns are production-ready AI implementations you can copy into your Next.js project. Each pattern solves a specific problem — generating text, building chat UIs, orchestrating agents, integrating tools.
How Patterns Work
Every pattern is a self-contained implementation with:
- Preview — live interactive demo in the browser
- Source code — all files needed (components, API routes, utilities)
- CLI install — one command to scaffold it into your project
Install via CLI
pnpm dlx shadcn add https://shadcnagents.com/r/{pattern-slug}
For example:
# Add a basic chat interface
npx shadcn add https://shadcnagents.com/r/ai-elements-chat
# Add text streaming
npx shadcn add https://shadcnagents.com/r/basics-stream-text
# Add web search tool
npx shadcn add https://shadcnagents.com/r/tool-websearch-claudeManual Installation
- Visit any pattern page at /patterns
- Switch to the Code tab
- Copy the source files into your project
- Install dependencies listed in the pattern
Categories
Patterns are organized into 9 categories based on what you're building.
Getting Started
The fundamentals. Text generation, streaming, image generation, speech, transcription, tool calling, and agent setup.
| Pattern | Description |
|---|---|
| Generate Text | Basic text generation with AI models |
| Stream Text | Real-time token streaming |
| Generate Image | AI image creation |
| Generate Speech | Text to speech synthesis |
| Transcribe Audio | Speech to text transcription |
| Tool Calling | Function and tool invocation |
| Agent Setup | Create an AI agent |
Chat & Conversations
Chat interfaces and display elements for building conversational AI products.
| Pattern | Description | Tier |
|---|---|---|
| Basic Chat | Simple chat interface | Free |
| ChatGPT Clone | OpenAI-style chat UI | Pro |
| Claude Clone | Anthropic-style chat UI | Pro |
| Grok Clone | xAI-style chat UI | Pro |
| Reasoning Display | Show model thinking process | Free |
| Sources & Citations | Reference and source display | Free |
| Plan Display | Step-by-step plan rendering | Free |
| Tool Approval | Confirm tool actions inline | Free |
| Queue Display | Task queue visualization | Free |
Agents & Orchestration
Multi-agent patterns for routing, orchestration, and parallel execution.
| Pattern | Description | Tier |
|---|---|---|
| Routing Pattern | Route requests to specialized agents | Free |
| Parallel Processing | Concurrent agent execution | Free |
| Orchestrator-Worker | Delegate subtasks to workers | Pro |
| Evaluator-Optimizer | Self-improving feedback loops | Pro |
Human in the Loop
Patterns for human oversight, approval flows, and user input gathering.
| Pattern | Description | Tier |
|---|---|---|
| Tool Approval Basic | Simple approval flow | Free |
| Context Builder | Agent-guided context gathering | Pro |
| Needs Approval | Gated tool execution | Pro |
Tools & Integrations
Web search, scraping, and file processing integrations.
| Pattern | Description | Tier |
|---|---|---|
| Claude Web Search | Anthropic search integration | Free |
| Exa Web Search | Exa neural search | Free |
| Cheerio Scraper | HTML DOM parsing | Free |
| Jina AI Scraper | AI-powered web scraping | Free |
| Markdown Scraper | URL to markdown conversion | Free |
| PDF Analysis | PDF file processing | Free |
Workflows & Pipelines
Sequential, parallel, and durable workflow patterns.
| Pattern | Description | Tier |
|---|---|---|
| URL Analysis | Basic URL analysis workflow | Free |
| Sequential Workflow | Step-by-step execution flow | Pro |
| Evaluator Workflow | Quality assessment pipeline | Pro |
| Orchestrator Workflow | Managed task delegation | Pro |
Artifacts & Generation
Structured output generation — tables, charts, JSON rendering.
| Pattern | Description | Tier |
|---|---|---|
| Table Editor | Editable data tables | Free |
| Chart Generation | Data visualization | Free |
| JSON Render Shadcn | UI generation from JSON | Pro |
Marketing & Landing
Pre-built sections for AI product landing pages.
| Pattern | Description | Tier |
|---|---|---|
| Code Block 1 | Code feature showcase | Free |
| Code Block 2 | Alternative code showcase | Free |
| Code Block 3 | Dark code showcase | Free |
| Feature Grid | Grid feature layout | Free |
| Bento Layout | Bento grid composition | Free |
| Model Comparison | Side-by-side model compare | Pro |
Full Examples
Complete applications combining multiple patterns.
| Pattern | Description | Tier |
|---|---|---|
| Chat-Base Clone | Full-stack chat application | Pro |
| Form Generator | Dynamic form builder | Pro |
| Data Analysis Agent | Data insight extraction | Pro |
Architecture
Every AI pattern follows the same structure:
components/stacks/{pattern-name}/
├── {pattern-name}.tsx # Main component (client-side)
├── actions.ts # Server actions (AI SDK calls)
└── types.ts # TypeScript types (optional)
Client component — handles UI, state, user interaction. Uses useChat, useCompletion, or custom hooks from the AI SDK.
Server actions — makes the actual AI API calls using generateText, streamText, tool, or agent from the Vercel AI SDK. Runs server-side, keeps API keys secure.
Switching Providers
All patterns use the Vercel AI SDK's provider abstraction. Swap models in one line:
// Anthropic
import { anthropic } from "@ai-sdk/anthropic"
const model = anthropic("claude-sonnet-4-20250514")
// OpenAI
import { openai } from "@ai-sdk/openai"
const model = openai("gpt-4o")
// Google
import { google } from "@ai-sdk/google"
const model = google("gemini-2.0-flash")Every pattern that calls an AI model accepts a model parameter. Change the import and model string — everything else stays the same.