ai-app
Full-stack AI application generator with Next.js, AI SDK, and ai-elements. Use when creating chatbots, agent dashboards, or custom AI applications. Triggers: chatbot, chat app, agent dashboard, AI application, Next.js AI, useChat, streamText, ai-elements, build AI app, create chatbot
What this skill does
# AI App Generator
Build full-stack AI applications with Next.js, AI SDK, and ai-elements.
## Quick Start
### 1. Scaffold Project
```bash
bunx --bun shadcn@latest create --preset "https://ui.shadcn.com/init?base=radix&style=nova&baseColor=neutral&theme=neutral&iconLibrary=lucide&font=geist-sans&menuAccent=subtle&menuColor=default&radius=default" --template next my-ai-app
cd my-ai-app
```
### 2. Install Dependencies
```bash
bun add ai @ai-sdk/react @ai-sdk/anthropic zod
bunx --bun ai-elements@latest
```
### 3. Configure Environment
```bash
# .env.local - Choose your provider
ANTHROPIC_API_KEY=sk-ant-...
# OPENAI_API_KEY=sk-...
# GOOGLE_GENERATIVE_AI_API_KEY=...
```
### 4. Generate Application
Based on user requirements, generate:
- **Chatbot**: See [references/chatbot.md](references/chatbot.md)
- **Agent Dashboard**: See [references/agent-dashboard.md](references/agent-dashboard.md)
- **Custom**: Combine patterns as needed
## Application Types
### Chatbot
Simple conversational AI with streaming responses.
| Feature | Implementation |
|---------|----------------|
| Chat UI | Conversation + Message + PromptInput |
| API | streamText + toUIMessageStreamResponse |
| Extras | Reasoning, Sources, File attachments |
### Agent Dashboard
Multi-agent interface with tool visualization.
| Feature | Implementation |
|---------|----------------|
| Agents | ToolLoopAgent with tools |
| UI | Dashboard layout + Tool components |
| API | createAgentUIStreamResponse |
| Extras | Status monitoring, tool approval |
### Custom AI App
Mix and match based on user needs:
- Web search chatbot
- Code generation assistant
- Document analyzer
- Multi-modal chat
## Project Structure
```
my-ai-app/
├── app/
│ ├── page.tsx # Main UI
│ ├── layout.tsx # Root layout
│ ├── globals.css # Theme
│ └── api/
│ └── chat/
│ └── route.ts # AI endpoint
├── components/
│ ├── ai-elements/ # AI Elements components
│ ├── ui/ # shadcn/ui components
│ └── chat.tsx # Chat component (if extracted)
├── lib/
│ ├── utils.ts # Utilities
│ └── ai.ts # AI configuration (optional)
├── ai/ # Agent definitions (if needed)
│ └── assistant.ts
└── .env.local # API keys
```
See [references/project-structure.md](references/project-structure.md) for details.
## Core Patterns
### API Route
```typescript
// app/api/chat/route.ts
import { streamText, UIMessage, convertToModelMessages } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
export const maxDuration = 30;
export async function POST(req: Request) {
const { messages }: { messages: UIMessage[] } = await req.json();
const result = streamText({
model: anthropic('claude-sonnet-4-6'),
messages: await convertToModelMessages(messages),
system: 'You are a helpful assistant.',
});
return result.toUIMessageStreamResponse({
sendSources: true,
sendReasoning: true,
});
}
```
### Chat Page
```tsx
// app/page.tsx
'use client';
import { useChat } from '@ai-sdk/react';
import { DefaultChatTransport } from 'ai';
import {
Conversation,
ConversationContent,
ConversationScrollButton,
} from '@/components/ai-elements/conversation';
import {
Message,
MessageContent,
MessageResponse,
} from '@/components/ai-elements/message';
import {
PromptInput,
PromptInputBody,
PromptInputTextarea,
PromptInputFooter,
PromptInputSubmit,
type PromptInputMessage,
} from '@/components/ai-elements/prompt-input';
import { Loader } from '@/components/ai-elements/loader';
import { useState } from 'react';
export default function ChatPage() {
const [input, setInput] = useState('');
const { messages, sendMessage, status } = useChat({
transport: new DefaultChatTransport({ api: '/api/chat' }),
});
const handleSubmit = (message: PromptInputMessage) => {
if (!message.text.trim()) return;
sendMessage({ text: message.text, files: message.files });
setInput('');
};
return (
<div className="flex h-screen flex-col p-4">
<Conversation className="flex-1">
<ConversationContent>
{messages.map((message) => (
<div key={message.id}>
{message.parts.map((part, i) => {
if (part.type === 'text') {
return (
<Message key={i} from={message.role}>
<MessageContent>
<MessageResponse>{part.text}</MessageResponse>
</MessageContent>
</Message>
);
}
return null;
})}
</div>
))}
{status === 'submitted' && <Loader />}
</ConversationContent>
<ConversationScrollButton />
</Conversation>
<PromptInput onSubmit={handleSubmit} className="mt-4">
<PromptInputBody>
<PromptInputTextarea
value={input}
onChange={(e) => setInput(e.target.value)}
/>
</PromptInputBody>
<PromptInputFooter>
<div />
<PromptInputSubmit status={status} />
</PromptInputFooter>
</PromptInput>
</div>
);
}
```
## Skill References
For detailed patterns, see:
| Need | Skill | Reference |
|------|-------|-----------|
| Chat UI components | `/ai-elements` | [chatbot.md](references/chatbot.md) |
| Next.js patterns | `/nextjs-shadcn` | [architecture.md](../nextjs-shadcn/references/architecture.md) |
| AI SDK functions | `/ai-sdk-6` | [core-functions.md](../ai-sdk-6/references/core-functions.md) |
| Agents & tools | `/ai-sdk-6` | [agents.md](../ai-sdk-6/references/agents.md) |
| Caching | `/cache-components` | [REFERENCE.md](../cache-components/REFERENCE.md) |
| Production patterns | `/nextjs-chatbot` | DB persistence, HITL approval, consent, feedback, search |
| Code review & cleanup | `code-simplifier` agent | DRY/KISS/YAGNI validation |
## Workflow
### Phase 1: Understand Requirements
Ask user:
- What type of AI app? (chatbot, agent, custom)
- What features? (reasoning, sources, tools, file upload)
- What style? (vega=classic, nova=compact, maia=soft/rounded, lyra=boxy/sharp, mira=dense) — default: nova
- What font? (geist-sans, inter, jetbrains-mono, figtree, dm-sans, outfit, noto-sans, nunito-sans, roboto, raleway, public-sans) — default: geist-sans
- What base color? (neutral, zinc, slate, gray, stone) — default: neutral
- What theme accent? (neutral, blue, green, orange, red, rose, violet) — default: neutral
- What border radius style? (default, sm, md, lg, xl)
- Component library? (radix=default, base-ui)
### Phase 2: Scaffold Project
Run scaffolding commands based on requirements.
### Phase 3: Generate Files
Create files based on application type:
- API route (`app/api/chat/route.ts`)
- Main page (`app/page.tsx`)
- Components (if needed)
- Agents (if needed)
### Phase 4: Configure
- Set up `.env.local`
- Configure `next.config.ts` if needed
- Add any additional dependencies
### Phase 5: Verify
```bash
bun dev
```
Test the application works correctly.
## References
- [Chatbot Templates](references/chatbot.md) - Full chatbot implementation
- [Agent Dashboard Templates](references/agent-dashboard.md) - Agent-based apps
- [Project Structure](references/project-structure.md) - Directory layout
- [Examples](references/examples.md) - Copy-paste examples
## Package Manager
**Always use bun**, never npm:
- `bun add` (not npm install)
- `bunx --bun` (not npx)
- `bun dev` (not npm run dev)
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.