diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a3d174..6f01eed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Thank you for your interest in contributing to Agent Patterns! This document pro ## Getting Started 1. Fork the repository -2. Clone your fork: `git clone https://github.com/your-username/agent-patterns.git` +2. Clone your fork: `git clone https://github.com/harshmathurx/agent-patterns.git` 3. Install dependencies: `pnpm install` 4. Create a new branch: `git checkout -b feature/your-feature-name` diff --git a/PHASE-4-5-COMPLETE.md b/PHASE-4-5-COMPLETE.md new file mode 100644 index 0000000..97731c0 --- /dev/null +++ b/PHASE-4-5-COMPLETE.md @@ -0,0 +1,171 @@ +# Phase 4 & 5 Completion Summary + +## ✅ Phase 4: The Prompt Library (COMPLETE) + +Created a comprehensive prompt library in `/prompts` directory with 7 files: + +### 1. **system-prompt.md** ✅ +- Complete overview of all 15 patterns +- Pattern selection guidelines +- Code generation rules +- Response format templates +- Quick reference guide +- **Purpose**: Copy this into Cursor rules, Claude projects, or ChatGPT custom instructions + +### 2. **build-dashboard.md** ✅ +- Complete prompt for generating revenue/analytics dashboards +- Uses: StatsGrid + Charts + DataTable + InsightsList +- Includes realistic data examples +- Production-ready component template +- **Generates**: Full dashboard with 4 stats, 2 charts, data table, and AI insights + +### 3. **build-admin-panel.md** ✅ +- Complete prompt for generating admin/user management panels +- Uses: Sidebar + StatsGrid + DataTable + DetailCard + AgentForm + ConfirmDialog +- Full CRUD operations structure +- State management examples +- **Generates**: Complete admin panel with navigation, user table, forms, and confirmations + +### 4. **build-analytics-view.md** ✅ +- Complete prompt for generating comprehensive analytics pages +- Uses: StatsGrid + Charts (3 types) + InsightsList + DataTable + Timeline +- Professional analytics metrics and formatting +- AI-generated insights that sound real +- **Generates**: Full analytics page with 6 KPIs, multiple charts, insights, and events + +### 5. **build-chat-interface.md** ✅ +- Complete prompt for generating AI chat interfaces +- Uses: ChatMessage + StreamingIndicator + Sidebar + CommandPalette + CodeBlock + ConfirmDialog +- Complete chat state management +- Keyboard shortcuts (⌘K) +- **Generates**: Full chat UI with message history, streaming, commands, and conversation management + +### 6. **build-settings-page.md** ✅ +- Complete prompt for generating settings/configuration pages +- Uses: Sidebar + DetailCard + AgentForm + DataTable + StatsGrid + CodeBlock + ConfirmDialog +- Multiple settings sections (Profile, Security, Billing, API Keys, etc.) +- Section-based navigation +- **Generates**: Complete settings page with 6+ sections and full functionality + +### 7. **pattern-index.md** ✅ +- **Complete schema reference** for all 15 patterns +- Every Zod schema with descriptions +- Usage examples for each pattern +- Quick pattern selection guide +- Import paths and TypeScript types +- **Purpose**: Comprehensive reference for LLMs - copy this into context when needed + +## ✅ Phase 5: The README (COMPLETE) + +Completely rewrote `/README.md` with: + +### Structure (30 seconds to understand, 60 seconds to first use): +1. **Hero image placeholder** - Shows all patterns in one visual +2. **One-sentence pitch** - "Copy-paste UI patterns optimized for AI code generation" +3. **Quick start** - 3 lines of code to get started +4. **Pattern table** - All 15 patterns with descriptions and use cases +5. **Live demo link** - Link to playground site +6. **Built for AI section** - Explains LLM-first design with prompt links +7. **Why Agent Patterns** - 5 key benefits (Zero deps, LLM-first, Production ready, Theme compatible, Copy-paste model) +8. **Works with badges** - Next.js, React, TypeScript, Tailwind, shadcn/ui, Cursor, Claude, ChatGPT, v0, Vercel AI SDK, CopilotKit +9. **Example: Dashboard in 60 seconds** - Complete working code example +10. **Documentation links** - Links to prompts directory +11. **Contributing section** +12. **License & Star button** + +### Key Features: +- ✅ Professional badges for all supported tools/frameworks +- ✅ Complete pattern table with use cases +- ✅ Links to all prompt files +- ✅ Working code example +- ✅ Clear value proposition +- ✅ No standards compliance section (as per Phase 0) +- ✅ No philosophy or strategy (as per Phase 0) +- ✅ Focus on practical usage + +## 🎯 What This Achieves + +### For Developers: +1. **Copy `system-prompt.md` into their Cursor rules** → Every UI request generates components using your patterns +2. **Use specific `build-*.md` prompts** → Generate complete layouts (dashboard, admin panel, chat, etc.) instantly +3. **Reference `pattern-index.md`** → Quick schema lookup without leaving their editor + +### For the Project: +1. **Differentiation** - No other component library has this. It's the "prompt library" that makes Agent Patterns unique. +2. **Lock-in through habit** - Once developers configure their LLM with your prompts, they'll naturally use your patterns +3. **Zero cost, infinite value** - These are just markdown files. No API costs, no tokens, but massive value add +4. **Growth engine** - Developers will share the prompts. "Just add this to your Cursor rules and you get instant dashboards" + +### For LLMs: +1. **Clear instructions** - LLMs know exactly what patterns exist and how to use them +2. **Validated schemas** - Zod schemas ensure generated props are valid +3. **Examples** - Every prompt includes realistic examples to guide generation +4. **Context** - Complete schema reference means LLMs can generate without guessing + +## 📁 File Structure Created + +``` +prompts/ +├── system-prompt.md # Master system prompt for LLMs (core) +├── build-dashboard.md # Generate dashboards +├── build-admin-panel.md # Generate admin panels +├── build-analytics-view.md # Generate analytics pages +├── build-chat-interface.md # Generate chat UIs +├── build-settings-page.md # Generate settings pages +└── pattern-index.md # Complete schema reference (critical) + +README.md # Completely rewritten +``` + +## 🚀 Next Steps (Phase 6: Distribution) + +The foundation is now complete. Ready for: +1. ✅ Patterns are production-grade (Phases 0-1) +2. ✅ Landing page looks incredible (Phase 2) +3. ✅ 15 patterns = critical mass (Phase 3) +4. ✅ Prompt library = differentiator (Phase 4) +5. ✅ README = billboard (Phase 5) + +**Now ready for Phase 6**: Distribution (Twitter, Reddit, HN, Dev.to, Discord) + +## 💡 How Users Will Use This + +### Scenario 1: Cursor User +``` +1. Copy prompts/system-prompt.md +2. Paste into .cursorrules file +3. Ask Cursor: "Build me a revenue dashboard" +4. Cursor generates using MetricCard, Chart, DataTable patterns +5. Works immediately, no configuration +``` + +### Scenario 2: Claude Projects +``` +1. Create new Claude project +2. Add prompts/system-prompt.md to project knowledge +3. Chat: "Create an admin panel for user management" +4. Claude generates using Sidebar, DataTable, AgentForm patterns +5. Copy-paste into codebase +``` + +### Scenario 3: Quick Reference +``` +1. Open prompts/pattern-index.md +2. Find schema for any pattern +3. Use schema to validate or generate props +4. No need to check documentation site +``` + +## 📊 Impact Metrics + +**Files Created**: 8 (7 in prompts/, 1 README rewrite) +**Lines of Documentation**: ~3,500 lines of comprehensive prompts and schemas +**Patterns Documented**: All 15 patterns with complete schemas +**Use Cases Covered**: 5 major application types (Dashboard, Admin, Analytics, Chat, Settings) +**Time to First Value**: < 2 minutes (copy system-prompt.md → ask LLM → get working code) + +--- + +**Status**: ✅ Phase 4 & 5 COMPLETE +**Ready for**: Phase 6 (Distribution) + diff --git a/README.md b/README.md index 629fb5f..b90e6e7 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,215 @@ # Agent Patterns -> Copy-paste UI patterns optimized for AI code generation +![Agent Patterns Hero](https://via.placeholder.com/1200x400/1a1a1a/ffffff?text=Agent+Patterns+%7C+15+Copy-Paste+UI+Components+for+AI+Apps) -Beautiful, production-ready React components with LLM-optimized Zod schemas. Built for shadcn/ui, works with any AI coding tool. +> Copy-paste UI patterns optimized for AI code generation. -## Quick Start +Beautiful, production-ready React components designed for LLM code generation. Each pattern has a Zod schema that AI models understand. No dependencies, just copy and paste. + +--- + +## 🚀 Quick Start ```bash -# Initialize -npx agent-patterns@latest init +# 1. Copy a pattern into your project +npx agent-patterns@latest add metric-card + +# 2. Use it in your code +import { MetricCard } from '@/patterns/metric-card/component' + + +``` + +That's it. No npm install, no version conflicts, no build config. + +--- + +## 📦 15 Production-Ready Patterns + +| Pattern | Use Case | Preview | +|---------|----------|---------| +| **[MetricCard](patterns/metric-card)** | KPIs, dashboards, stats | Metrics with trends & sparklines | +| **[Chart](patterns/chart)** | Analytics, data visualization | Bar, line, area, pie, donut charts | +| **[DataTable](patterns/data-table)** | Lists, tables, data management | Sort, filter, paginate, select rows | +| **[AgentForm](patterns/agent-form)** | User input, settings | 11 field types + Zod validation | +| **[DetailCard](patterns/detail-card)** | User profiles, record details | Structured info with edit mode | +| **[InsightsList](patterns/insights-list)** | AI insights, notifications | Prioritized insights with actions | +| **[StreamingIndicator](patterns/streaming-indicator)** | Loading, AI processing | 5 variants + progress steps | +| **[ChatMessage](patterns/chat-message)** | Chat interfaces, AI assistants | Bubbles with streaming text | +| **[CommandPalette](patterns/command-palette)** | Quick actions, ⌘K menus | Fuzzy search command menu | +| **[KanbanBoard](patterns/kanban-board)** | Project management, pipelines | Drag-and-drop task boards | +| **[Timeline](patterns/timeline)** | Activity feeds, audit logs | Event/activity timelines | +| **[Sidebar](patterns/sidebar)** | App navigation, menus | Collapsible nav with nesting | +| **[StatsGrid](patterns/stats-grid)** | Dashboard headers, overview | Responsive grid of metrics | +| **[ConfirmDialog](patterns/confirm-dialog)** | Confirmations, warnings | Modal confirmations | +| **[CodeBlock](patterns/code-block)** | Documentation, code display | Syntax highlighting + copy | + +→ **[View Live Demos](https://agent-patterns.vercel.app)** — Try all patterns, switch themes, copy code + +--- + +## 🤖 Built for AI Code Generation + +Every pattern has an LLM-optimized Zod schema: + +```typescript +import { metricCardSchema } from '@/patterns/metric-card/schema' + +// AI models understand this: +const props = metricCardSchema.parse({ + label: "Total Revenue", + value: "$45,231", + trend: { value: 12.5, direction: "up", label: "vs last month" } +}) +``` + +**Use our prompts** to make any LLM generate components using these patterns: + +- [`prompts/system-prompt.md`](prompts/system-prompt.md) — Add to your Cursor rules or Claude project +- [`prompts/build-dashboard.md`](prompts/build-dashboard.md) — Generate complete dashboards +- [`prompts/build-admin-panel.md`](prompts/build-admin-panel.md) — Generate admin interfaces +- [`prompts/build-chat-interface.md`](prompts/build-chat-interface.md) — Generate AI chat UIs +- [`prompts/pattern-index.md`](prompts/pattern-index.md) — Complete schema reference + +--- + +## ✨ Why Agent Patterns? + +### 1. **Zero Dependencies** +No npm install. No version conflicts. No build config. Just copy the component file and use it. + +### 2. **LLM-First Design** +Zod schemas with detailed descriptions that AI models understand. Your LLM generates valid props automatically. -# Add a pattern -npx agent-patterns@latest add data-table +### 3. **Production Ready** +Not toy examples. Real components with: +- Loading states +- Error handling +- Accessibility +- Responsive design +- TypeScript strict mode + +### 4. **Theme Compatible** +Works with all shadcn/ui themes. Change themes, components adapt instantly. + +### 5. **Copy-Paste Model** +Own your code. Modify freely. No black-box libraries. No "ejecting." + +--- + +## 🎨 Works With + +

+ Next.js + React + TypeScript + Tailwind CSS + shadcn/ui +

+ +

+ Cursor + Claude + ChatGPT + v0 + Vercel AI SDK + CopilotKit +

+ +--- + +## 🏗️ Example: Build a Dashboard in 60 Seconds + +```typescript +import { StatsGrid } from '@/patterns/stats-grid/component' +import { Chart } from '@/patterns/chart/component' +import { DataTable } from '@/patterns/data-table/component' + +export default function Dashboard() { + return ( +
+ {/* 4 Key Metrics */} + + + {/* Revenue Trend */} + + + {/* Transactions Table */} + +
+ ) +} ``` -## Patterns +--- + +## 📚 Documentation + +- **[Pattern Index](prompts/pattern-index.md)** — Complete schema reference for all 15 patterns +- **[System Prompt](prompts/system-prompt.md)** — Use with Cursor, Claude, ChatGPT +- **[Build Guides](prompts/)** — Example prompts for common layouts +- **[Live Playground](https://agent-patterns.vercel.app)** — Interactive demos with theme switcher + +--- + +## 🤝 Contributing + +We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. + +### What We Need + +- New patterns (submit via PR with component + schema + example + prompt) +- Bug fixes (especially theme compatibility issues) +- Documentation improvements +- Example use cases and prompts + +--- + +## 📄 License + +MIT © Agent Patterns -| Pattern | Description | -|---------|-------------| -| [MetricCard](patterns/metric-card) | Display metrics with trends and comparisons | -| [DataTable](patterns/data-table) | Interactive tables with sort, filter, pagination | -| [Chart](patterns/chart) | Data visualization with bar, line, area, pie charts | -| [AgentForm](patterns/agent-form) | Dynamic forms with validation | -| [StreamingIndicator](patterns/streaming-indicator) | Loading states for AI/streaming content | -| [InsightsList](patterns/insights-list) | Display AI-generated insights | -| [DetailCard](patterns/detail-card) | Structured detail views | +--- -## Why Agent Patterns? +## ⭐ Star This Repo -- **Copy-paste model** — No npm install, no version conflicts -- **LLM-optimized** — Zod schemas with descriptions AI models understand -- **Theme-compatible** — Works with all 20+ shadcn themes -- **TypeScript strict** — Fully typed, no `any` types -- **Zero dependencies** — Just React, Tailwind, and shadcn/ui +If you find Agent Patterns useful, give it a star! It helps others discover the project. -## Demo +[![GitHub stars](https://img.shields.io/github/stars/harshmathurx/agent-patterns?style=social)](https://github.com/harshmathurx/agent-patterns) -→ [**Live Playground**](https://agent-patterns-playground.vercel.app) — Try all patterns, switch themes, copy code +--- -## License +**Built with ❤️ for the AI code generation era.** -MIT +[Website](https://agent-patterns.vercel.app) • [GitHub](https://github.com/harshmathurx/agent-patterns) • [Issues](https://github.com/harshmathurx/agent-patterns/issues) diff --git a/prompts/README.md b/prompts/README.md new file mode 100644 index 0000000..f4dcc6c --- /dev/null +++ b/prompts/README.md @@ -0,0 +1,240 @@ +# Agent Patterns - Prompt Library + +This directory contains prompts designed to make LLMs generate UI using Agent Patterns. + +## 🎯 Quick Start + +### Option 1: Use with Cursor + +1. Copy [`system-prompt.md`](system-prompt.md) +2. Paste into `.cursorrules` in your project root +3. Ask Cursor to build UI → it will use Agent Patterns automatically + +### Option 2: Use with Claude Projects + +1. Create a new Claude Project +2. Add [`system-prompt.md`](system-prompt.md) to project knowledge +3. Chat with Claude about building UI → it will use Agent Patterns + +### Option 3: Use with ChatGPT Custom Instructions + +1. Open ChatGPT Settings → Custom Instructions +2. Paste [`system-prompt.md`](system-prompt.md) into "How would you like ChatGPT to respond?" +3. Start a new chat → ChatGPT will use Agent Patterns for UI generation + +--- + +## 📚 Files in This Directory + +### [`system-prompt.md`](system-prompt.md) ⭐ **START HERE** +**Purpose**: Master prompt that teaches LLMs about all 15 patterns + +**What it contains**: +- Overview of all patterns with use cases +- Pattern selection guidelines +- Code generation rules +- Import path conventions +- Response format templates + +**When to use**: +- Add to Cursor rules (`.cursorrules`) +- Add to Claude project knowledge +- Add to ChatGPT custom instructions +- Reference when you want LLM to use Agent Patterns + +--- + +### [`pattern-index.md`](pattern-index.md) 📖 **COMPLETE REFERENCE** +**Purpose**: Complete Zod schema reference for all 15 patterns + +**What it contains**: +- Every pattern's complete Zod schema +- Detailed prop descriptions +- Usage examples for each pattern +- Import paths +- Quick pattern selection guide + +**When to use**: +- Quick schema lookup +- Validate pattern props +- Check available options +- Copy exact schema into context + +--- + +### Build Guides (Complete Examples) + +These are prompts that generate complete application layouts: + +#### [`build-dashboard.md`](build-dashboard.md) +**Generates**: Revenue/analytics dashboard +**Patterns used**: StatsGrid + Chart + DataTable + InsightsList +**Time to generate**: ~30 seconds +**Best for**: Executive dashboards, analytics views, KPI tracking + +#### [`build-admin-panel.md`](build-admin-panel.md) +**Generates**: Complete admin panel with user management +**Patterns used**: Sidebar + DataTable + DetailCard + AgentForm + ConfirmDialog +**Time to generate**: ~45 seconds +**Best for**: Admin interfaces, user management, CRUD operations + +#### [`build-analytics-view.md`](build-analytics-view.md) +**Generates**: Comprehensive analytics page with insights +**Patterns used**: StatsGrid + Chart (3 types) + InsightsList + DataTable + Timeline +**Time to generate**: ~45 seconds +**Best for**: Data analytics, performance tracking, business intelligence + +#### [`build-chat-interface.md`](build-chat-interface.md) +**Generates**: AI chat interface +**Patterns used**: ChatMessage + StreamingIndicator + Sidebar + CommandPalette + CodeBlock +**Time to generate**: ~60 seconds +**Best for**: AI chatbots, support chat, conversational UIs + +#### [`build-settings-page.md`](build-settings-page.md) +**Generates**: Settings/configuration page with multiple sections +**Patterns used**: Sidebar + DetailCard + AgentForm + DataTable + CodeBlock +**Time to generate**: ~60 seconds +**Best for**: User settings, app configuration, account management + +--- + +## 🎨 How to Use These Prompts + +### Method 1: Copy the Entire Prompt +``` +1. Open a build-*.md file +2. Copy the entire "Prompt" section +3. Paste into your LLM chat +4. LLM generates complete component +5. Copy-paste into your codebase +``` + +### Method 2: Customize the Prompt +``` +1. Open a build-*.md file +2. Read the "Prompt" section +3. Modify for your needs (change metrics, data, etc.) +4. Paste modified prompt into LLM +5. Get customized component +``` + +### Method 3: Learn the Pattern +``` +1. Open a build-*.md file +2. Read the "Expected Output" section +3. See how patterns are combined +4. Use as template for your own layouts +``` + +--- + +## 💡 Examples + +### Example 1: Generate a Dashboard +``` +User: "I need a sales dashboard" +→ Uses build-dashboard.md as reference +→ LLM generates complete dashboard with stats, charts, table +→ Copy-paste into app +``` + +### Example 2: Generate Admin Panel +``` +User: "Create a product management admin panel" +→ Uses build-admin-panel.md as template +→ LLM generates sidebar, product table, forms +→ Copy-paste into app +``` + +### Example 3: Generate Custom Layout +``` +User: "Build a monitoring dashboard with alerts and logs" +→ LLM references system-prompt.md +→ Selects appropriate patterns: MetricCard, InsightsList, Timeline, DataTable +→ Generates custom layout +→ Copy-paste into app +``` + +--- + +## 🎯 Tips for Best Results + +### 1. **Be Specific** +❌ Bad: "Build me a dashboard" +✅ Good: "Build me a sales dashboard with revenue metrics, monthly chart, and recent transactions table" + +### 2. **Mention Patterns** +❌ Bad: "Show user data" +✅ Good: "Use DataTable to show user data with sorting and pagination" + +### 3. **Request Realistic Data** +❌ Bad: "Add some data" +✅ Good: "Add 15 rows of realistic user data with names, emails, and roles" + +### 4. **Use Build Guides as Templates** +Instead of asking from scratch, say: +"Use the build-dashboard.md approach but for an e-commerce store" + +--- + +## 🔧 Customization + +You can modify these prompts for your needs: + +### Change the Tech Stack +Currently assumes: Next.js + React + TypeScript + Tailwind + shadcn/ui + +To use with different stack: +1. Edit `system-prompt.md` +2. Update import paths +3. Adjust component conventions + +### Add Custom Patterns +If you create your own patterns: +1. Add schema to `pattern-index.md` +2. Add pattern description to `system-prompt.md` +3. Create example in a new `build-*.md` + +### Change Styling +The prompts generate shadcn/ui compatible code. + +To change styling: +1. Update `system-prompt.md` code generation rules +2. Replace Tailwind classes with your preferred system +3. Update examples in build guides + +--- + +## 📊 What Each File Does + +| File | Purpose | Use Case | +|------|---------|----------| +| `system-prompt.md` | Teach LLM about all patterns | Add to Cursor/Claude/ChatGPT | +| `pattern-index.md` | Complete schema reference | Quick lookup, validation | +| `build-dashboard.md` | Generate dashboards | Revenue, analytics, KPIs | +| `build-admin-panel.md` | Generate admin UIs | User management, CRUD | +| `build-analytics-view.md` | Generate analytics pages | Data analysis, insights | +| `build-chat-interface.md` | Generate chat UIs | AI chatbots, support | +| `build-settings-page.md` | Generate settings pages | Configuration, preferences | + +--- + +## 🚀 Next Steps + +1. **Start with `system-prompt.md`** - Add it to your AI tool +2. **Try a build guide** - Generate a complete layout +3. **Reference `pattern-index.md`** - When you need schema details +4. **Customize prompts** - Adapt for your specific needs + +--- + +## 💬 Need Help? + +- **Issues**: [GitHub Issues](https://github.com/harshmathurx/agent-patterns/issues) +- **Discussions**: [GitHub Discussions](https://github.com/harshmathurx/agent-patterns/discussions) +- **Examples**: Check the build guides for working examples + +--- + +**Remember**: These prompts cost nothing to use, work offline, and create zero lock-in. Once your LLM knows about Agent Patterns, it will naturally use them for any UI generation. + diff --git a/prompts/build-admin-panel.md b/prompts/build-admin-panel.md new file mode 100644 index 0000000..22086af --- /dev/null +++ b/prompts/build-admin-panel.md @@ -0,0 +1,250 @@ +# Build Admin Panel - Complete Prompt + +Use this prompt to generate a complete admin panel with user management using Agent Patterns. + +## Prompt + +``` +Build me a complete admin panel for user management using Agent Patterns. The admin panel should include: + +1. A Sidebar navigation with: + - Logo and app name at the top + - Navigation items: Dashboard, Users, Settings, Reports, Analytics + - User section at the bottom (avatar + name) + - Collapsible functionality + +2. Main content area with: + - Page header with title "User Management" and an "Add User" button + - A StatsGrid showing 4 user-related metrics (Total Users, Active Today, New This Month, Churned) + - A DataTable with user data including: + * Columns: Avatar, Name, Email, Role, Status, Last Active, Actions + * At least 20 users with realistic data + * Sorting, filtering, pagination (10 per page) + * Row selection with bulk action button + - When clicking a user row, show a DetailCard in a modal/side panel with: + * User profile information + * Edit mode enabled + * Account status badge + * Created/updated timestamps + * Action buttons (Reset Password, Deactivate Account) + +3. An "Add User" AgentForm that appears in a modal/side panel with: + - Fields: Name, Email, Role (select), Status (toggle), Password + - Proper Zod validation + - Submit handler that logs the data + +4. A ConfirmDialog for destructive actions like: + - "Are you sure you want to deactivate this user?" + - "Delete 5 selected users?" + +Use realistic data - actual names, emails, roles (Admin, Editor, Viewer). +Make it production-ready with proper TypeScript types and responsive design. +Use a clean, professional admin panel aesthetic. +``` + +## Expected Output + +The LLM should generate a complete React component that: + +1. **Imports all necessary patterns**: +```typescript +import { Sidebar } from '@/patterns/sidebar/component' +import { StatsGrid } from '@/patterns/stats-grid/component' +import { DataTable } from '@/patterns/data-table/component' +import { DetailCard } from '@/patterns/detail-card/component' +import { AgentForm } from '@/patterns/agent-form/component' +import { ConfirmDialog } from '@/patterns/confirm-dialog/component' +``` + +2. **Implements state management**: +```typescript +const [selectedUser, setSelectedUser] = useState(null) +const [showAddUserForm, setShowAddUserForm] = useState(false) +const [showConfirmDialog, setShowConfirmDialog] = useState(false) +const [selectedRows, setSelectedRows] = useState([]) +``` + +3. **Contains realistic data**: +```typescript +const users = [ + { + id: '1', + name: 'Sarah Johnson', + email: 'sarah.johnson@company.com', + role: 'Admin', + status: 'active', + lastActive: '2 hours ago', + created: '2023-01-15', + }, + { + id: '2', + name: 'Michael Chen', + email: 'michael.chen@company.com', + role: 'Editor', + status: 'active', + lastActive: '5 minutes ago', + created: '2023-03-22', + }, + // ... 20+ users +] + +const userStats = [ + { + id: '1', + label: 'Total Users', + value: '2,847', + change: 12, + changeLabel: 'vs last month', + trend: 'up' as const + }, + { + id: '2', + label: 'Active Today', + value: '1,423', + change: -3, + changeLabel: 'vs yesterday', + trend: 'down' as const + }, + // ... more stats +] +``` + +4. **Implements complete layout**: +```typescript +export default function AdminPanel() { + const [selectedUser, setSelectedUser] = useState(null) + const [showAddForm, setShowAddForm] = useState(false) + const [confirmAction, setConfirmAction] = useState<'deactivate' | 'delete' | null>(null) + + return ( +
+ {/* Sidebar */} + }} + items={navigationItems} + footer={} + collapsible={true} + /> + + {/* Main Content */} +
+
+ {/* Header */} +
+
+

User Management

+

Manage users and permissions

+
+ +
+ + {/* Stats */} + + + {/* User Table */} + + + {/* Bulk Actions */} + {selectedRows.length > 0 && ( +
+

{selectedRows.length} users selected

+ +
+ )} +
+
+ + {/* Detail Panel */} + {selectedUser && ( +
+ console.log('Update user:', data)} + actions={ + + } + /> +
+ )} + + {/* Add User Form */} + {showAddForm && ( +
+
+ { + console.log('New user:', data) + setShowAddForm(false) + }} + /> +
+
+ )} + + {/* Confirm Dialog */} + { + console.log('Action confirmed:', confirmAction) + setConfirmAction(null) + }} + onCancel={() => setConfirmAction(null)} + /> +
+ ) +} +``` + +5. **Is production-ready** with: + - Complete CRUD operations structure + - State management for modals/panels + - Form validation with Zod + - Confirmation dialogs for destructive actions + - Bulk operations support + - Responsive sidebar layout + - Professional admin UI styling + - Proper TypeScript types throughout + +## Variations + +You can modify this prompt for different admin panel types: + +- **E-commerce Admin**: Product management, orders, inventory +- **CMS Admin**: Content management, posts, pages, media +- **SaaS Admin**: Tenant management, subscriptions, billing +- **Support Admin**: Ticket management, customers, conversations +- **Analytics Admin**: Reports, dashboards, data exports + +Simply replace the data model and business logic to match your domain. + diff --git a/prompts/build-analytics-view.md b/prompts/build-analytics-view.md new file mode 100644 index 0000000..ed59f67 --- /dev/null +++ b/prompts/build-analytics-view.md @@ -0,0 +1,311 @@ +# Build Analytics View - Complete Prompt + +Use this prompt to generate a comprehensive analytics page with insights using Agent Patterns. + +## Prompt + +``` +Build me a comprehensive analytics page using Agent Patterns. The page should include: + +1. A page header with: + - Title "Analytics Overview" + - Date range selector (last 7 days, 30 days, 90 days, custom) + - Export button + +2. A StatsGrid with 6 key performance metrics: + - Total Views, Unique Visitors, Bounce Rate, Avg Session Duration, Conversions, Revenue + - Each with trend indicators and comparison to previous period + +3. Three charts in a 2-column grid: + - Large area chart (full width) showing daily traffic for the past 30 days + - Bar chart showing top 5 traffic sources + - Pie chart showing device distribution (Desktop, Mobile, Tablet) + +4. An InsightsList showing 5-6 AI-generated insights: + - Mix of all types (info, warning, success, error) + - Priority badges (high, medium, low) + - Specific, actionable insights about the data + - Each with 1-2 action buttons + +5. A DataTable showing "Top Pages" with: + - Columns: Page Path, Views, Unique Visitors, Avg Time, Bounce Rate, Conversions + - At least 15 rows with realistic URLs + - Sorting enabled on all columns + - Pagination with 10 rows per page + +6. A Timeline showing recent important events: + - Campaign launches, feature releases, incidents, milestones + - Last 2 weeks of events + - Status indicators (completed, in-progress, etc.) + +Use realistic analytics data - actual page paths, traffic numbers, percentages. +Make it professional and data-driven with insights that sound like they came from an AI analyst. +Use proper formatting for numbers (1.2K, 45.3%, $12.5K, etc.). +``` + +## Expected Output + +The LLM should generate a complete React component that: + +1. **Imports all necessary patterns**: +```typescript +import { StatsGrid } from '@/patterns/stats-grid/component' +import { Chart } from '@/patterns/chart/component' +import { InsightsList } from '@/patterns/insights-list/component' +import { DataTable } from '@/patterns/data-table/component' +import { Timeline } from '@/patterns/timeline/component' +``` + +2. **Contains comprehensive analytics data**: +```typescript +const performanceStats = [ + { + id: '1', + label: 'Total Views', + value: '1.24M', + change: 18.2, + changeLabel: 'vs last period', + trend: 'up' as const, + color: 'success' as const, + }, + { + id: '2', + label: 'Unique Visitors', + value: '847K', + change: 12.5, + changeLabel: 'vs last period', + trend: 'up' as const, + color: 'success' as const, + }, + { + id: '3', + label: 'Bounce Rate', + value: '42.3%', + change: -5.1, + changeLabel: 'vs last period', + trend: 'down' as const, + color: 'success' as const, // Down is good for bounce rate + }, + // ... more stats +] + +const trafficData = [ + { label: 'Jan 15', value: 28450 }, + { label: 'Jan 16', value: 31200 }, + { label: 'Jan 17', value: 29800 }, + // ... 30 days of data +] + +const trafficSources = [ + { label: 'Organic Search', value: 45230 }, + { label: 'Direct', value: 28940 }, + { label: 'Social Media', value: 18650 }, + { label: 'Referral', value: 12340 }, + { label: 'Email', value: 8920 }, +] + +const deviceDistribution = [ + { label: 'Desktop', value: 52, color: 'hsl(var(--primary))' }, + { label: 'Mobile', value: 38, color: 'hsl(var(--secondary))' }, + { label: 'Tablet', value: 10, color: 'hsl(var(--muted))' }, +] + +const insights = [ + { + id: '1', + title: 'Traffic spike detected on mobile devices', + description: 'Mobile traffic increased by 34% in the last 3 days, primarily from organic search. This correlates with improved mobile page load times after recent optimization.', + type: 'success' as const, + priority: 'high' as const, + actions: [ + { label: 'View Mobile Analytics', onClick: () => {} }, + { label: 'Export Report', onClick: () => {} }, + ], + }, + { + id: '2', + title: 'High bounce rate on product pages', + description: 'Product category pages show 58% bounce rate, 12% higher than site average. Users are leaving without viewing product details.', + type: 'warning' as const, + priority: 'high' as const, + actions: [ + { label: 'View Problem Pages', onClick: () => {} }, + { label: 'A/B Test Suggestions', onClick: () => {} }, + ], + }, + { + id: '3', + title: 'Conversion rate improving', + description: 'Overall conversion rate reached 3.2%, up from 2.8% last month. Checkout flow optimization is showing positive results.', + type: 'success' as const, + priority: 'medium' as const, + actions: [ + { label: 'View Funnel', onClick: () => {} }, + ], + }, + // ... more insights +] + +const topPages = [ + { + path: '/products/wireless-headphones', + views: 124500, + uniqueVisitors: 98200, + avgTime: '3:24', + bounceRate: '38.2%', + conversions: 2847, + }, + { + path: '/blog/best-productivity-apps-2024', + views: 89300, + uniqueVisitors: 76400, + avgTime: '5:12', + bounceRate: '42.8%', + conversions: 1243, + }, + // ... 15+ pages +] + +const recentEvents = [ + { + id: '1', + title: 'Summer Campaign Launch', + description: 'Launched summer sale campaign across all channels', + timestamp: '2024-02-14T10:00:00', + status: 'completed' as const, + user: 'Marketing Team', + }, + { + id: '2', + title: 'Mobile App Update', + description: 'Released v2.1 with performance improvements', + timestamp: '2024-02-12T14:30:00', + status: 'completed' as const, + user: 'Product Team', + }, + // ... more events +] +``` + +3. **Implements complete layout**: +```typescript +export default function AnalyticsView() { + const [dateRange, setDateRange] = useState('30d') + + return ( +
+
+ {/* Header */} +
+
+

Analytics Overview

+

+ Comprehensive insights into your performance +

+
+
+ + +
+
+ + {/* Performance Stats */} + + + {/* Charts Section */} +
+ {/* Main Traffic Chart - Full Width */} + + + {/* Secondary Charts - 2 Column */} +
+ + +
+
+ + {/* AI Insights */} + + + {/* Top Pages Table */} +
+

Top Pages

+ +
+ + {/* Recent Events Timeline */} +
+

Recent Events

+ +
+
+
+ ) +} +``` + +4. **Is production-ready** with: + - Realistic analytics metrics and trends + - Proper number formatting (K, M, %, time formats) + - AI-generated insights that sound professional + - Actionable recommendations with context + - Complete data visualization mix + - Responsive grid layouts + - Professional analytics dashboard styling + - Date range selection capability + - Export functionality hook + +## Variations + +You can modify this prompt for different analytics types: + +- **Marketing Analytics**: Campaign performance, ROI, lead attribution +- **Product Analytics**: Feature usage, user flows, engagement metrics +- **Sales Analytics**: Pipeline, deals, revenue forecasting +- **Content Analytics**: Article performance, engagement, SEO metrics +- **E-commerce Analytics**: Orders, revenue, cart abandonment, product performance + +Simply replace the metrics, charts, and insights to match your analytics domain. + diff --git a/prompts/build-chat-interface.md b/prompts/build-chat-interface.md new file mode 100644 index 0000000..b08e74b --- /dev/null +++ b/prompts/build-chat-interface.md @@ -0,0 +1,408 @@ +# Build Chat Interface - Complete Prompt + +Use this prompt to generate a complete AI chat interface using Agent Patterns. + +## Prompt + +``` +Build me a complete AI chat interface using Agent Patterns. The interface should include: + +1. A full-screen layout with: + - A Sidebar on the left showing: + * App logo and name at top + * "New Chat" button + * List of recent conversations (10+ chats with titles and timestamps) + * Settings button at bottom + - Main chat area on the right + +2. In the main chat area: + - Header with conversation title and a CommandPalette trigger button (⌘K) + - Chat messages list showing a realistic conversation: + * 10-15 messages alternating between user and assistant + * Conversation about "analyzing sales data and generating insights" + * Include system messages for important events + * Show timestamps on messages + * The last assistant message should be streaming (isStreaming: true) + - A StreamingIndicator showing "AI is typing..." when assistant is responding + - Input area at bottom with: + * Multi-line textarea for user input + * Send button + * File attachment button + * Stop generation button (when streaming) + +3. A CommandPalette that opens with ⌘K showing: + - Common AI commands: "Summarize conversation", "Export chat", "Change model" + - Quick actions: "Clear history", "New chat", "Settings" + - Recent commands + - Groups: Actions, History, Settings + +4. When streaming a response, show: + - StreamingIndicator with progress steps: + * "Analyzing request..." (completed) + * "Generating response..." (active) + * "Formatting output..." (pending) + - Token counter showing tokens used/remaining + - Stop button to cancel generation + +5. A ConfirmDialog for: + - "Clear conversation history?" + - "Delete this chat?" + +Use realistic chat messages - actual questions about data analysis and thoughtful AI responses. +Include code blocks in some messages using CodeBlock pattern. +Make it look like a professional AI assistant interface (ChatGPT, Claude-style). +``` + +## Expected Output + +The LLM should generate a complete React component that: + +1. **Imports all necessary patterns**: +```typescript +import { ChatMessage } from '@/patterns/chat-message/component' +import { StreamingIndicator } from '@/patterns/streaming-indicator/component' +import { Sidebar } from '@/patterns/sidebar/component' +import { CommandPalette } from '@/patterns/command-palette/component' +import { CodeBlock } from '@/patterns/code-block/component' +import { ConfirmDialog } from '@/patterns/confirm-dialog/component' +``` + +2. **Implements state management**: +```typescript +const [messages, setMessages] = useState(conversationHistory) +const [inputValue, setInputValue] = useState('') +const [isStreaming, setIsStreaming] = useState(false) +const [showCommandPalette, setShowCommandPalette] = useState(false) +const [showConfirm, setShowConfirm] = useState(false) +const [tokenCount, setTokenCount] = useState(0) +``` + +3. **Contains realistic conversation data**: +```typescript +const conversationHistory = [ + { + role: 'user' as const, + content: 'Can you analyze my sales data from last quarter and identify the top trends?', + avatar: 'JD', + timestamp: '10:32 AM', + status: 'sent' as const, + }, + { + role: 'assistant' as const, + content: 'I\'ll analyze your sales data for Q4 2023. Let me break this down into key trends...\n\n**Top 3 Trends:**\n\n1. **Mobile Sales Growth**: 42% increase in mobile transactions\n2. **Geographic Expansion**: West region outperformed by 28%\n3. **Product Category Shift**: Electronics sales up 35%\n\nWould you like me to dive deeper into any of these trends?', + avatar: 'AI', + timestamp: '10:33 AM', + status: 'sent' as const, + }, + { + role: 'user' as const, + content: 'Yes, can you show me the code to visualize the geographic data?', + avatar: 'JD', + timestamp: '10:35 AM', + status: 'sent' as const, + }, + { + role: 'assistant' as const, + content: 'Here\'s a React component using Recharts to visualize your geographic sales data:', + avatar: 'AI', + timestamp: '10:35 AM', + status: 'sent' as const, + actions: [ + { label: 'Copy Code', onClick: () => {} }, + { label: 'Run in Sandbox', onClick: () => {} }, + ], + }, + { + role: 'system' as const, + content: 'Code block generated successfully', + timestamp: '10:35 AM', + }, + { + role: 'user' as const, + content: 'This is great! Can you also create a summary report I can share with my team?', + avatar: 'JD', + timestamp: '10:38 AM', + status: 'sent' as const, + }, + { + role: 'assistant' as const, + content: 'I\'ll create a comprehensive executive summary of your Q4 sales performance...', + avatar: 'AI', + timestamp: '10:38 AM', + isStreaming: true, + }, +] + +const recentChats = [ + { + id: '1', + title: 'Q4 Sales Analysis', + timestamp: '2 hours ago', + active: true + }, + { + id: '2', + title: 'Marketing Campaign Ideas', + timestamp: 'Yesterday' + }, + { + id: '3', + title: 'Customer Segmentation Strategy', + timestamp: '2 days ago' + }, + // ... more chats +] + +const commands = [ + { + id: 'summarize', + label: 'Summarize conversation', + description: 'Get a summary of this chat', + group: 'actions', + shortcut: '⌘S', + onSelect: () => {}, + }, + { + id: 'export', + label: 'Export chat', + description: 'Download as markdown or PDF', + group: 'actions', + shortcut: '⌘E', + onSelect: () => {}, + }, + { + id: 'model', + label: 'Change model', + description: 'Switch between GPT-4, Claude, etc.', + group: 'actions', + onSelect: () => {}, + }, + // ... more commands +] + +const streamingSteps = [ + { label: 'Analyzing request...', status: 'completed' as const }, + { label: 'Generating response...', status: 'active' as const }, + { label: 'Formatting output...', status: 'pending' as const }, +] +``` + +4. **Implements complete chat layout**: +```typescript +export default function ChatInterface() { + const [messages, setMessages] = useState(conversationHistory) + const [input, setInput] = useState('') + const [isStreaming, setIsStreaming] = useState(false) + const [showCommandPalette, setShowCommandPalette] = useState(false) + const [confirmAction, setConfirmAction] = useState<'clear' | 'delete' | null>(null) + const [tokenCount, setTokenCount] = useState(1247) + + useEffect(() => { + // Handle ⌘K shortcut + const handleKeyDown = (e: KeyboardEvent) => { + if ((e.metaKey || e.ctrlKey) && e.key === 'k') { + e.preventDefault() + setShowCommandPalette(true) + } + } + window.addEventListener('keydown', handleKeyDown) + return () => window.removeEventListener('keydown', handleKeyDown) + }, []) + + const handleSend = () => { + if (!input.trim()) return + + // Add user message + const userMessage = { + role: 'user' as const, + content: input, + avatar: 'JD', + timestamp: new Date().toLocaleTimeString(), + status: 'sent' as const, + } + + setMessages([...messages, userMessage]) + setInput('') + setIsStreaming(true) + + // Simulate AI response + setTimeout(() => { + const aiMessage = { + role: 'assistant' as const, + content: 'Processing your request...', + avatar: 'AI', + timestamp: new Date().toLocaleTimeString(), + isStreaming: true, + } + setMessages(prev => [...prev, aiMessage]) + }, 500) + } + + return ( +
+ {/* Sidebar */} + , + onClick: () => setMessages([]), + }, + ...recentChats.map(chat => ({ + id: chat.id, + label: chat.title, + badge: chat.timestamp, + active: chat.active, + })), + ]} + footer={ + + } + collapsible={true} + className="w-64" + /> + + {/* Main Chat Area */} +
+ {/* Header */} +
+

Q4 Sales Analysis

+ +
+ + {/* Messages */} +
+ {messages.map((message, i) => ( + + ))} + + {/* Streaming Indicator */} + {isStreaming && ( + + )} +
+ + {/* Input Area */} +
+
+
+