/** * Example-based prompts for teaching AI proper edit behavior */ export const EDIT_EXAMPLES = ` ## Edit Strategy Examples ### Example 1: Update Header Color USER: "Make the header background black" CORRECT APPROACH: 1. Identify Header component location 2. Edit ONLY Header.jsx 3. Change background color class/style INCORRECT APPROACH: - Regenerating entire App.jsx - Creating new Header.jsx from scratch - Modifying unrelated files EXPECTED OUTPUT: // Only the Header component with updated background // Preserving all existing functionality ### Example 2: Add New Page USER: "Add a videos page" CORRECT APPROACH: 1. Create Videos.jsx component 2. Update routing in App.jsx or Router component 3. Add navigation link if needed INCORRECT APPROACH: - Regenerating entire application - Recreating all existing pages EXPECTED OUTPUT: // New Videos component // ONLY the routing update, preserving everything else ### Example 3: Fix Styling Issue USER: "Fix the button styling on mobile" CORRECT APPROACH: 1. Identify which component has the button 2. Update only that component's Tailwind classes 3. Add responsive modifiers (sm:, md:, etc) INCORRECT APPROACH: - Regenerating all components - Creating new CSS files - Modifying global styles unnecessarily ### Example 4: Add Feature to Component USER: "Add a search bar to the header" CORRECT APPROACH: 1. Modify Header.jsx to add search functionality 2. Preserve all existing header content 3. Integrate search seamlessly INCORRECT APPROACH: - Creating Header.jsx from scratch - Losing existing navigation/branding ### Example 5: Add New Component USER: "Add a newsletter signup to the footer" CORRECT APPROACH: 1. Create Newsletter.jsx component 2. UPDATE Footer.jsx to import Newsletter 3. Add in the appropriate place in Footer EXPECTED OUTPUT: // New Newsletter component // Updated Footer with Newsletter import and usage import Newsletter from './Newsletter'; // ... existing code ... // Add in the render ### Example 6: Add External Library USER: "Add animations with framer-motion to the hero" CORRECT APPROACH: 1. Import framer-motion in Hero.jsx 2. Use motion components 3. System will auto-install framer-motion EXPECTED OUTPUT: import { motion } from 'framer-motion'; // ... rest of Hero with motion animations ### Example 7: Remove Element USER: "Remove start deploying button" CORRECT APPROACH: 1. Search for "start deploying" in all component files 2. Find it in Hero.jsx 3. Edit ONLY Hero.jsx to remove that button INCORRECT APPROACH: - Creating a new file - Editing multiple files - Redesigning the entire Hero EXPECTED OUTPUT: // Hero component with "start deploying" button removed // All other content preserved ### Example 8: Delete Section USER: "Delete the testimonials section" CORRECT APPROACH: 1. Find which file contains testimonials 2. Remove only that section from the file 3. Keep all other content intact INCORRECT APPROACH: - Deleting the entire file - Recreating the page without testimonials ### Example 9: Change a Single Style (CRITICAL EXAMPLE) USER: "update the hero to bg blue" CORRECT APPROACH: 1. Identify the Hero component file: 'src/components/Hero.jsx'. 2. Locate the outermost 'div' or container element. 3. Find the existing background color class (e.g., 'bg-gray-900'). 4. Replace ONLY that class with 'bg-blue-500'. 5. Return the entire file, completely unchanged except for that single class modification. **Original File Content (BEFORE):** import React from 'react'; export default function Hero() { return (

Welcome to the App

This is the original hero section.

); }
**Expected Output (AFTER):** import React from 'react'; export default function Hero() { return (

Welcome to the App

This is the original hero section.

); }
NOTICE: Everything remains EXACTLY the same except 'bg-gray-900' → 'bg-blue-500'. - The button still has bg-blue-600 (unchanged) - All text, structure, imports are identical - No reformatting, no "improvements", no cleanup ## Key Principles 1. **Minimal Changes**: Only modify what's necessary 2. **Preserve Functionality**: Keep all existing features 3. **Respect Structure**: Follow existing patterns 4. **Target Precision**: Edit specific files, not everything 5. **Context Awareness**: Use imports/exports to understand relationships ## File Identification Patterns - "header" → src/components/Header.jsx - "navigation" → src/components/Nav.jsx or Header.jsx - "footer" → src/components/Footer.jsx - "home page" → src/App.jsx or src/pages/Home.jsx - "styling" → Component files (Tailwind) or index.css - "routing" → App.jsx or Router component - "layout" → Layout components or App.jsx ## Edit Intent Classification UPDATE_COMPONENT: Modify existing component - Keywords: update, change, modify, edit, fix - Action: Edit single file ADD_FEATURE: Add new functionality - Keywords: add, create, implement, build - Action: Create new files + minimal edits FIX_ISSUE: Resolve problems - Keywords: fix, resolve, debug, repair - Action: Targeted fixes UPDATE_STYLE: Change appearance - Keywords: style, color, theme, design - Action: Update Tailwind classes REFACTOR: Improve code quality - Keywords: refactor, clean, optimize - Action: Restructure without changing behavior `; export function getEditExamplesPrompt(): string { return EDIT_EXAMPLES; } export function getComponentPatternPrompt(fileStructure: string): string { return ` ## Current Project Structure ${fileStructure} ## Component Naming Patterns Based on your file structure, here are the patterns to follow: 1. Component files are in: src/components/ 2. Page components might be in: src/pages/ or src/components/ 3. Utility functions are in: src/utils/ or src/lib/ 4. Styles use Tailwind classes inline 5. Main app entry is: src/App.jsx When the user mentions a component by name, look for: - Exact matches first (Header → Header.jsx) - Partial matches (nav → Navigation.jsx, NavBar.jsx) - Semantic matches (top bar → Header.jsx) `; }