Proven Prompts: Claude

I want to build off of the One-pager PRD artifact to create a workflow that walks the user through idea to Wireframe > To Prototype > Production Ready Architecture and Specs > Build production app with Claude Code. Create the Outline and roadmap first, then we will build the artifact for each component and link them together, integrating the anthropic api for AI assisted support throughout the process.

This is turning into more of context reference doc for the evolution of this project...

Chat: https://claude.ai/chat/92023bbd-19a9-4d84-b0ef-29d4c18fc0e3?artifactId=remixed-3d81ba29

Claude's thought process:

This is an excellent and ambitious project! The user wants to create a comprehensive workflow that takes someone from a product idea all the way through to production-ready code. Let me break down what they're asking for:

  1. Start with the existing One-pager PRD Creator

  2. Extend it to include:

    • Wireframe design

    • Prototype creation

    • Production-ready architecture and specs

    • Building with Claude Code

They want me to first create an outline and roadmap before we start building. This is smart - we need to plan the architecture and flow carefully.

Key considerations:

  • Each stage should build on the previous one

  • Need to integrate the Anthropic API throughout for AI assistance

  • Should maintain state across stages

  • Need clear transitions between stages

  • Should be modular so we can build each component separately

  • User flow should be intuitive and guided

Let me create a comprehensive outline and roadmap that considers:

  • User journey/workflow

  • Technical architecture

  • Data flow between stages

  • AI integration points

  • Component breakdown

  • Implementation phases

You can use Claude's thoughts as a template to build more in depth Prompts.

Output :

I love this vision! Let's create a comprehensive Product Development Studio that guides users from concept to production. Here's the complete outline and roadmap:


🎯 PRODUCT DEVELOPMENT STUDIO - MASTER OUTLINE

Overall Vision

A unified platform that takes users through the complete product development lifecycle with AI-assisted guidance at every stage.


πŸ“‹ STAGE BREAKDOWN

Stage 1: Ideation β†’ PRD (Already Built)

Current State: One-pager PRD Creator

  • Input: 3 key questions about the product

  • Output: Professional one-pager PRD

  • Enhancement: Add "Export to Wireframe Stage" button


Stage 2: PRD β†’ Wireframes

Component: Wireframe Designer

Features:

  • Input Sources:

    • Import PRD content automatically

    • Manual wireframe creation

    • AI-suggested layouts based on PRD

  • Core Functionality:

    • Drag-and-drop wireframe builder

    • Pre-built component library (buttons, forms, navigation, etc.)

    • Multi-screen/page support

    • Annotations and notes

    • Responsive preview (mobile/tablet/desktop)

  • AI Assistant:

    • Generate wireframe suggestions from PRD

    • Suggest UX improvements

    • Accessibility recommendations

    • Best practice guidance

  • Output:

    • Exportable wireframe specs (JSON)

    • Visual wireframe images

    • Annotated design document


Stage 3: Wireframes β†’ Interactive Prototype

Component: Prototype Builder

Features:

  • Input Sources:

    • Import wireframes from Stage 2

    • Import design system/brand guidelines

  • Core Functionality:

    • Convert wireframes to interactive prototype

    • Add interactions (clicks, hovers, transitions)

    • Link screens together

    • Add realistic data/content

    • User flow visualization

    • Mobile + desktop preview

  • AI Assistant:

    • Auto-generate component code (React)

    • Suggest interaction patterns

    • Generate sample data

    • Recommend animations/transitions

    • Design system suggestions

  • Output:

    • Live interactive prototype

    • Component library (React)

    • Design tokens

    • User flow documentation


Stage 4: Prototype β†’ Architecture & Specs

Component: Architecture Planner

Features:

  • Input Sources:

    • PRD requirements

    • Prototype components

    • Technical constraints

  • Core Functionality:

    • System architecture diagram

    • Database schema designer

    • API endpoint planner

    • Technology stack selector

    • Infrastructure planning

    • Security considerations

    • Performance requirements

  • AI Assistant:

    • Generate architecture recommendations

    • Suggest tech stack based on requirements

    • Create database schemas

    • Design API contracts

    • Identify potential bottlenecks

    • Generate technical documentation

  • Output:

    • Architecture diagram

    • Database schema (SQL/NoSQL)

    • API specifications (OpenAPI/Swagger)

    • Tech stack document

    • Implementation roadmap

    • File structure recommendation


Stage 5: Architecture β†’ Production Build

Component: Claude Code Generator

Features:

  • Input Sources:

    • Architecture specs

    • Component library from prototype

    • API specifications

  • Core Functionality:

    • Generate project scaffolding

    • Create Claude Code prompts

    • Generate implementation tickets

    • Code review checklist

    • Testing strategy

    • Deployment guide

  • AI Assistant:

    • Generate boilerplate code

    • Create component implementations

    • Generate API routes

    • Write tests

    • Create deployment configs

    • Generate documentation

  • Output:

    • Complete codebase structure

    • Claude Code command sequences

    • Implementation guide

    • Testing suite

    • Deployment scripts

    • Documentation


πŸ—οΈ TECHNICAL ARCHITECTURE

Data Flow

User Input β†’ PRD β†’ Wireframes β†’ Prototype β†’ Architecture β†’ Production Code
     ↓         ↓         ↓           ↓            ↓              ↓
  AI Assist  AI Assist AI Assist  AI Assist   AI Assist    AI Assist

State Management

  • Global Project State: Maintains all data across stages

  • Stage-Specific State: Each stage's local state

  • Navigation State: Track current stage and progress

  • Export/Import: Seamless data transfer between stages

Core Data Structure

javascript

{
  projectId: "uuid",
  projectName: "string",
  createdAt: "timestamp",
  updatedAt: "timestamp",
  currentStage: "prd | wireframe | prototype | architecture | build",
  stages: {
    prd: { /* PRD data */ },
    wireframes: { /* Wireframe data */ },
    prototype: { /* Prototype data */ },
    architecture: { /* Architecture data */ },
    build: { /* Build specs */ }
  }
}

🎨 UI/UX DESIGN SYSTEM

Layout Structure

  • Top Navigation: Stage progress indicator (breadcrumb style)

  • Left Sidebar: Tools/options for current stage

  • Main Canvas: Primary work area

  • Right Sidebar: AI assistant (always available)

  • Bottom Panel: Export/Continue/Back buttons

Design Principles

  • Consistent glassmorphism aesthetic

  • Smooth stage transitions

  • Real-time AI suggestions

  • Mobile-responsive

  • Keyboard shortcuts

  • Dark mode support


πŸ€– AI INTEGRATION POINTS

Anthropic API Usage

Each stage will have dedicated AI capabilities:

  1. PRD Stage: Content generation, refinement

  2. Wireframe Stage: Layout suggestions, UX recommendations

  3. Prototype Stage: Component generation, interaction patterns

  4. Architecture Stage: System design, tech stack recommendations

  5. Build Stage: Code generation, best practices

AI Assistant Features

  • Context-aware suggestions

  • Inline editing

  • Version history with AI explanations

  • "Ask Claude" sidebar (always available)

  • Template library with AI customization


πŸ“¦ COMPONENT BREAKDOWN

Shared Components

  1. Navigation Bar - Stage selector + progress

  2. AI Sidebar - Chat interface with Claude

  3. Export Manager - Export current stage data

  4. Project Manager - Save/load projects

  5. Settings Panel - Preferences and configs

Stage-Specific Components

  1. PRD Creator (βœ… Built)

  2. Wireframe Canvas (To build)

  3. Prototype Studio (To build)

  4. Architecture Planner (To build)

  5. Code Generator (To build)


πŸš€ IMPLEMENTATION ROADMAP

Phase 1: Foundation (Week 1)

  • Create master shell application

  • Build navigation system

  • Implement global state management

  • Create AI sidebar component

  • Set up Anthropic API integration

  • Integrate existing PRD Creator

Phase 2: Wireframe Stage (Week 2)

  • Build wireframe canvas

  • Create component library

  • Implement drag-and-drop

  • Add AI wireframe generation

  • Create export functionality

  • Connect to PRD stage

Phase 3: Prototype Stage (Week 3)

  • Build prototype editor

  • Implement interaction system

  • Create live preview

  • Add AI component generation

  • Implement screen linking

  • Connect to wireframe stage

Phase 4: Architecture Stage (Week 4)

  • Build architecture diagram tool

  • Create database schema designer

  • Implement API planner

  • Add AI architecture recommendations

  • Create tech stack selector

  • Connect to prototype stage

Phase 5: Build Stage (Week 5)

  • Build code generation interface

  • Create Claude Code prompt builder

  • Implement file tree viewer

  • Add ticket generation

  • Create deployment guide generator

  • Connect to architecture stage

Phase 6: Integration & Polish (Week 6)

  • End-to-end testing

  • UI/UX refinements

  • Performance optimization

  • Add templates library

  • Create documentation

  • Beta testing


πŸ’Ύ DATA PERSISTENCE

Storage Strategy

  • In-Memory State: React state for current session

  • Local Storage: Auto-save project data

  • Export Options:

    • JSON (full project data)

    • PDF (documentation)

    • ZIP (code + assets)

    • Claude Code files


🎯 SUCCESS METRICS

User Experience

  • Time from idea to production-ready specs: < 2 hours

  • User satisfaction: 90%+ would recommend

  • Completion rate: 70%+ finish all stages

Technical Performance

  • AI response time: < 3 seconds

  • Stage transition: < 1 second

  • Export generation: < 10 seconds


πŸ“š TECH STACK

Frontend

  • React (artifact environment)

  • Tailwind CSS (styling)

  • Lucide React (icons)

  • React Flow (diagrams)

AI Integration

  • Anthropic API (Claude Sonnet 4.5)

  • Streaming responses

  • Context management

Libraries

  • React DnD (drag and drop)

  • Excalidraw (wireframes/diagrams)

  • Monaco Editor (code editing)

  • HTML2Canvas (screenshots)


πŸ”„ USER JOURNEY EXAMPLE

  1. Start: User has an app idea

  2. Stage 1: Answer 3 questions β†’ Get PRD

  3. Stage 2: Review PRD β†’ AI generates wireframes β†’ User refines

  4. Stage 3: Import wireframes β†’ Add interactions β†’ Preview prototype

  5. Stage 4: Define architecture β†’ AI suggests tech stack β†’ Generate specs

  6. Stage 5: Get Claude Code prompts β†’ Build production app

  7. Complete: Ship product! πŸš€


🎨 VISUAL MOCKUP CONCEPT

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ—οΈ Product Studio    [PRD] β†’ [Wire] β†’ [Proto] β†’ [Arch] β†’ [Build] β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”Œβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚     β”‚ β”‚                               β”‚ β”‚         β”‚ β”‚
β”‚ β”‚Tool β”‚ β”‚      Main Canvas Area         β”‚ β”‚   AI    β”‚ β”‚
β”‚ β”‚     β”‚ β”‚                               β”‚ β”‚ Claude  β”‚ β”‚
β”‚ β”‚Bar  β”‚ β”‚   [Current Stage Content]     β”‚ β”‚ Sidebar β”‚ β”‚
β”‚ β”‚     β”‚ β”‚                               β”‚ β”‚         β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                        β”‚
β”‚           [Back] [Save] [Export] [Next Stage β†’]       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What do you think of this roadmap?

Would you like me to:

  1. Start building Phase 1 (Master shell + navigation)

  2. Refine any stage before we begin

  3. Create a simplified MVP with fewer features

  4. Dive into a specific stage you're most excited about

Let me know and we'll bring this Product Development Studio to life! πŸš€

Phase 1 Build

Thoughts : Thought process

Perfect! The user wants to start with Phase 1. Let me build the master shell application with:

  1. Navigation system with stage progress

  2. Global state management

  3. AI sidebar component

  4. Anthropic API integration

  5. Integration of the existing PRD Creator

Key considerations:

  • This is an artifact, so we can't use localStorage directly (forbidden in artifacts)

  • We need to use React state (useState, useReducer) for state management

  • The Anthropic API is available via fetch to https://api.anthropic.com/v1/messages

  • No API key needed (handled on backend)

  • We should create a modular structure where each stage can be a separate component

  • The PRD creator should be integrated as the first stage

  • We need smooth transitions between stages

  • AI sidebar should be always available

  • Export functionality to prepare for Claude Code export

Let me create a comprehensive Phase 1 artifact that includes:

  • Master navigation with progress indicator

  • Global project state management

  • AI assistant sidebar

  • Stage container system

  • The PRD stage (integrated from existing)

  • Export preparation for Claude Code

  • Placeholder stages for future development

I'll use a clean, modular architecture that makes it easy to add the other stages later.

Artifact https://claude.ai/public/artifacts/f46ea609-a044-4595-b3f0-e74bdaccbe21

Summary:

πŸŽ‰ Phase 1 Complete! Here's what we built:

βœ… Core Features Implemented:

  1. Master Navigation System

    • Beautiful stage progress indicator with breadcrumb-style navigation

    • Click to navigate between accessible stages

    • Visual indicators for completed stages (βœ“)

    • Disabled states for future stages

  2. Global State Management

    • Complete project state using React's useReducer

    • Tracks all stages and their data

    • Project metadata (name, timestamps, completion status)

    • Easy to extend for future stages

  3. AI Assistant Sidebar

    • Always-accessible Claude AI chat

    • Context-aware (knows current stage and project data)

    • Streaming-like conversation experience

    • Slide-in/out animation

  4. PRD Stage (Fully Integrated)

    • Complete PRD creator from the original artifact

    • Three-question form

    • AI-generated professional PRD

    • Split-screen design

  5. Export System

    • Export Project JSON: Full project data for saving/loading

    • Export for Claude Code: Special markdown format with instructions for building in Claude Code

    • Both exports ready to use outside the artifact

  6. Placeholder Stages

    • Wireframes, Prototype, Architecture, and Build stages

    • Coming soon indicators

    • Easy to replace with real implementations

🎨 Design Features:

  • Glassmorphism UI with animated gradient background

  • Smooth transitions and hover effects

  • Responsive layout

  • Project name editing inline

  • Professional color scheme

πŸ”§ Technical Architecture:

  • Modular component structure

  • Clean separation of concerns

  • Ready for stage additions

  • No localStorage (artifact-safe)

  • Anthropic API integrated


πŸš€ Try it out!

  1. Create a PRD: Fill out the 3 questions and generate a PRD

  2. Chat with Claude: Click "AI Assistant" to get help

  3. Export: Use the Export button to save your project

  4. Navigate: See how the stage navigation works


πŸ“ Next Steps - What would you like to do?

  1. Phase 2: Build the Wireframe Stage (drag-and-drop wireframe canvas)

  2. Phase 3: Build the Prototype Stage (interactive prototype builder)

  3. Phase 4: Build the Architecture Stage (system design & tech stack)

  4. Phase 5: Build the Build Stage (code generation for Claude Code)

Or we can:

  • Refine Phase 1 (add features, improve UX)

  • Test the Claude Code export workflow

  • Add more PRD templates/examples

What would you like to tackle next? 🎯

Artifact Code:

import React, { useState, useReducer } from 'react';
import { FileText, Layout, Zap, GitBranch, Code, ChevronRight, MessageSquare, Download, Save, X, Send, Sparkles, Menu } from 'lucide-react';

// ==================== STATE MANAGEMENT ====================
const initialState = {
  projectId: `project-${Date.now()}`,
  projectName: 'Untitled Project',
  createdAt: new Date().toISOString(),
  updatedAt: new Date().toISOString(),
  currentStage: 'prd',
  stages: {
    prd: {
      completed: false,
      question1: '',
      question2: '',
      question3: '',
      generatedPRD: ''
    },
    wireframe: {
      completed: false,
      wireframes: []
    },
    prototype: {
      completed: false,
      components: []
    },
    architecture: {
      completed: false,
      diagram: null,
      techStack: []
    },
    build: {
      completed: false,
      code: {}
    }
  }
};

function projectReducer(state, action) {
  switch (action.type) {
    case 'UPDATE_STAGE_DATA':
      return {
        ...state,
        updatedAt: new Date().toISOString(),
        stages: {
          ...state.stages,
          [action.stage]: {
            ...state.stages[action.stage],
            ...action.data
          }
        }
      };
    case 'SET_CURRENT_STAGE':
      return {
        ...state,
        currentStage: action.stage
      };
    case 'MARK_STAGE_COMPLETE':
      return {
        ...state,
        stages: {
          ...state.stages,
          [action.stage]: {
            ...state.stages[action.stage],
            completed: true
          }
        }
      };
    case 'SET_PROJECT_NAME':
      return {
        ...state,
        projectName: action.name,
        updatedAt: new Date().toISOString()
      };
    case 'LOAD_PROJECT':
      return action.project;
    default:
      return state;
  }
}

// ==================== STAGES CONFIG ====================
const STAGES = [
  { id: 'prd', name: 'PRD', icon: FileText, description: 'Product Requirements' },
  { id: 'wireframe', name: 'Wireframes', icon: Layout, description: 'UI Wireframes' },
  { id: 'prototype', name: 'Prototype', icon: Zap, description: 'Interactive Prototype' },
  { id: 'architecture', name: 'Architecture', icon: GitBranch, description: 'System Design' },
  { id: 'build', name: 'Build', icon: Code, description: 'Production Code' }
];

// ==================== AI SIDEBAR COMPONENT ====================
const AISidebar = ({ isOpen, onClose, projectState, currentStage }) => {
  const [messages, setMessages] = useState([
    {
      role: 'assistant',
      content: `Hi! I'm Claude, your AI assistant for this project. I'm here to help you at every stage of your product development journey. Currently, you're working on the **${STAGES.find(s => s.id === currentStage)?.name}** stage. How can I help you today?`
    }
  ]);
  const [input, setInput] = useState('');
  const [isLoading, setIsLoading] = useState(false);

  const sendMessage = async () => {
    if (!input.trim() || isLoading) return;

    const userMessage = input.trim();
    setInput('');
    setMessages(prev => [...prev, { role: 'user', content: userMessage }]);
    setIsLoading(true);

    try {
      // Build context about the project
      const context = `Current stage: ${currentStage}
Project: ${projectState.projectName}
${currentStage === 'prd' && projectState.stages.prd.generatedPRD ? `Current PRD:\n${projectState.stages.prd.generatedPRD}` : ''}`;

      const response = await fetch('https://api.anthropic.com/v1/messages', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          model: 'claude-sonnet-4-20250514',
          max_tokens: 2000,
          messages: [
            ...messages.map(m => ({ role: m.role, content: m.content })),
            {
              role: 'user',
              content: `${context}\n\nUser question: ${userMessage}`
            }
          ]
        })
      });

      const data = await response.json();
      const assistantResponse = data.content[0].text;

      setMessages(prev => [...prev, { role: 'assistant', content: assistantResponse }]);
    } catch (error) {
      setMessages(prev => [...prev, {
        role: 'assistant',
        content: 'Sorry, I encountered an error. Please try again.'
      }]);
    }

    setIsLoading(false);
  };

  if (!isOpen) return null;

  return (
    <div className="fixed right-0 top-0 h-full w-96 bg-white/95 backdrop-blur-lg shadow-2xl border-l border-gray-200 flex flex-col z-50">
      {/* Header */}
      <div className="p-4 border-b border-gray-200 flex items-center justify-between bg-gradient-to-r from-purple-50 to-blue-50">
        <div className="flex items-center gap-2">
          <Sparkles className="w-5 h-5 text-purple-600" />
          <h3 className="font-semibold text-gray-900">AI Assistant</h3>
        </div>
        <button
          onClick={onClose}
          className="p-1 hover:bg-gray-200 rounded-md transition-colors"
        >
          <X className="w-5 h-5" />
        </button>
      </div>

      {/* Messages */}
      <div className="flex-1 overflow-y-auto p-4 space-y-4">
        {messages.map((msg, idx) => (
          <div
            key={idx}
            className={`flex ${msg.role === 'user' ? 'justify-end' : 'justify-start'}`}
          >
            <div
              className={`max-w-[80%] p-3 rounded-lg ${
                msg.role === 'user'
                  ? 'bg-blue-600 text-white'
                  : 'bg-gray-100 text-gray-900'
              }`}
            >
              <p className="text-sm whitespace-pre-wrap">{msg.content}</p>
            </div>
          </div>
        ))}
        {isLoading && (
          <div className="flex justify-start">
            <div className="bg-gray-100 p-3 rounded-lg">
              <div className="flex gap-1">
                <div className="w-2 h-2 bg-gray-400 rounded-full animate-bounce" style={{ animationDelay: '0ms' }}></div>
                <div className="w-2 h-2 bg-gray-400 rounded-full animate-bounce" style={{ animationDelay: '150ms' }}></div>
                <div className="w-2 h-2 bg-gray-400 rounded-full animate-bounce" style={{ animationDelay: '300ms' }}></div>
              </div>
            </div>
          </div>
        )}
      </div>

      {/* Input */}
      <div className="p-4 border-t border-gray-200 bg-white">
        <div className="flex gap-2">
          <input
            type="text"
            value={input}
            onChange={(e) => setInput(e.target.value)}
            onKeyPress={(e) => e.key === 'Enter' && sendMessage()}
            placeholder="Ask Claude anything..."
            className="flex-1 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
          />
          <button
            onClick={sendMessage}
            disabled={isLoading || !input.trim()}
            className="p-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors"
          >
            <Send className="w-5 h-5" />
          </button>
        </div>
      </div>
    </div>
  );
};

// ==================== PRD STAGE COMPONENT ====================
const PRDStage = ({ projectState, dispatch }) => {
  const [isGenerating, setIsGenerating] = useState(false);
  const prdData = projectState.stages.prd;

  const handleInputChange = (field, value) => {
    dispatch({
      type: 'UPDATE_STAGE_DATA',
      stage: 'prd',
      data: { [field]: value }
    });
  };

  const generatePRD = async () => {
    setIsGenerating(true);

    const prompt = `Create a professional one-pager PRD based on these inputs:

1. Product/Feature: ${prdData.question1}
2. Target Users & Problem: ${prdData.question2}
3. Key Functionality & Success Metrics: ${prdData.question3}

Please format the PRD exactly following this template using proper markdown headers:

# One-pager: [NAME]

## 1. TL;DR
A short summaryβ€”what is this, who's it for, and why does it matter?

## 2. Goals
### Business Goals
* [List business goals]

### User Goals
* [List user goals]

### Non-Goals
* [List non-goals]

## 3. User stories
Personas and their jobs-to-be-done.

## 4. Functional requirements
Grouped features by priority.

## 5. User experience
* Bullet-pointed user journeys
* Edge cases and UI notes

## 6. Narrative
A day-in-the-life (Make it sing.)

## 7. Success metrics
* [List key metrics]

## 8. Milestones & sequencing
Lean roadmap, small team (keep it scrappy!), phases.

Make it professional yet approachable. Be specific and actionable.`;

    try {
      const response = await fetch('https://api.anthropic.com/v1/messages', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          model: 'claude-sonnet-4-20250514',
          max_tokens: 4000,
          messages: [{ role: 'user', content: prompt }]
        })
      });

      const data = await response.json();
      const generatedPRD = data.content[0].text;

      dispatch({
        type: 'UPDATE_STAGE_DATA',
        stage: 'prd',
        data: { generatedPRD }
      });

      dispatch({
        type: 'MARK_STAGE_COMPLETE',
        stage: 'prd'
      });
    } catch (error) {
      console.error('Error generating PRD:', error);
    }

    setIsGenerating(false);
  };

  const renderMarkdown = (text) => {
    let html = text
      .replace(/^# (.*$)/gim, '<h1 class="text-2xl font-bold text-gray-900 mt-8 mb-4">$1</h1>')
      .replace(/^## (.*$)/gim, '<h2 class="text-xl font-bold text-gray-900 mt-6 mb-3">$1</h2>')
      .replace(/^### (.*$)/gim, '<h3 class="text-lg font-bold text-gray-900 mt-4 mb-2">$1</h3>')
      .replace(/^\* (.*$)/gim, '<li class="ml-4 mb-1">$1</li>')
      .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
      .replace(/\n\n/g, '</p><p class="mb-4">');

    return `<p class="mb-4">${html}</p>`;
  };

  return (
    <div className="flex h-full gap-6">
      {/* Left: Input Form */}
      <div className="w-1/2 overflow-y-auto">
        <div className="bg-white/80 backdrop-blur-lg rounded-xl shadow-lg border border-white/50 p-6">
          <h2 className="text-xl font-semibold text-gray-900 mb-6">Answer 3 Questions</h2>

          <div className="space-y-6">
            <div>
              <label className="block text-sm font-medium text-gray-700 mb-2">
                1. What product or feature are you building?
              </label>
              <textarea
                value={prdData.question1}
                onChange={(e) => handleInputChange('question1', e.target.value)}
                className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"
                rows="3"
                placeholder="e.g., A real-time collaboration dashboard for remote teams..."
              />
            </div>

            <div>
              <label className="block text-sm font-medium text-gray-700 mb-2">
                2. Who are the target users and what problem does this solve?
              </label>
              <textarea
                value={prdData.question2}
                onChange={(e) => handleInputChange('question2', e.target.value)}
                className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"
                rows="3"
                placeholder="e.g., Remote team managers who struggle with visibility..."
              />
            </div>

            <div>
              <label className="block text-sm font-medium text-gray-700 mb-2">
                3. What are the key features and how will you measure success?
              </label>
              <textarea
                value={prdData.question3}
                onChange={(e) => handleInputChange('question3', e.target.value)}
                className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"
                rows="3"
                placeholder="e.g., Live status updates, team activity feed... Success measured by 40% reduction..."
              />
            </div>

            <button
              onClick={generatePRD}
              disabled={isGenerating || !prdData.question1 || !prdData.question2 || !prdData.question3}
              className="w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-purple-600 text-white rounded-md hover:from-blue-700 hover:to-purple-700 disabled:from-gray-300 disabled:to-gray-400 disabled:cursor-not-allowed transition-all shadow-lg"
            >
              {isGenerating ? 'Generating PRD...' : 'Generate PRD'}
            </button>
          </div>
        </div>
      </div>

      {/* Right: Generated PRD */}
      <div className="w-1/2 bg-white/90 backdrop-blur-lg rounded-xl shadow-lg border border-white/50 overflow-hidden">
        <div className="h-full overflow-y-auto p-6">
          {prdData.generatedPRD ? (
            <div
              className="prose prose-sm max-w-none"
              dangerouslySetInnerHTML={{ __html: renderMarkdown(prdData.generatedPRD) }}
            />
          ) : (
            <div className="text-gray-500 text-center py-12">
              <FileText className="w-12 h-12 mx-auto mb-3 text-gray-400" />
              <p>Your PRD will appear here after answering the questions</p>
            </div>
          )}
        </div>
      </div>
    </div>
  );
};

// ==================== PLACEHOLDER STAGES ====================
const PlaceholderStage = ({ stage }) => {
  return (
    <div className="flex items-center justify-center h-full">
      <div className="text-center">
        <div className="w-24 h-24 mx-auto mb-4 bg-gradient-to-br from-gray-200 to-gray-300 rounded-full flex items-center justify-center">
          {React.createElement(STAGES.find(s => s.id === stage)?.icon || FileText, { className: 'w-12 h-12 text-gray-600' })}
        </div>
        <h3 className="text-2xl font-bold text-gray-900 mb-2">
          {STAGES.find(s => s.id === stage)?.name} Stage
        </h3>
        <p className="text-gray-600 mb-4">Coming soon in Phase {['wireframe', 'prototype', 'architecture', 'build'].indexOf(stage) + 2}</p>
        <div className="inline-block px-4 py-2 bg-blue-50 text-blue-700 rounded-md text-sm">
          This stage is under development
        </div>
      </div>
    </div>
  );
};

// ==================== MAIN APP ====================
const ProductStudio = () => {
  const [projectState, dispatch] = useReducer(projectReducer, initialState);
  const [aiSidebarOpen, setAiSidebarOpen] = useState(false);
  const [showExportMenu, setShowExportMenu] = useState(false);

  const currentStageIndex = STAGES.findIndex(s => s.id === projectState.currentStage);

  const goToStage = (stageId) => {
    dispatch({ type: 'SET_CURRENT_STAGE', stage: stageId });
  };

  const exportProject = () => {
    const dataStr = JSON.stringify(projectState, null, 2);
    const dataBlob = new Blob([dataStr], { type: 'application/json' });
    const url = URL.createObjectURL(dataBlob);
    const link = document.createElement('a');
    link.href = url;
    link.download = `${projectState.projectName.replace(/\s+/g, '-')}.json`;
    link.click();
    URL.revokeObjectURL(url);
    setShowExportMenu(false);
  };

  const exportForClaudeCode = () => {
    const claudeCodeInstructions = `# ${projectState.projectName} - Claude Code Build Instructions

## Project Overview
${projectState.stages.prd.generatedPRD || 'PRD not yet generated'}

## Development Stages Completed
- βœ… PRD: ${projectState.stages.prd.completed ? 'Complete' : 'In Progress'}
- ⏳ Wireframes: ${projectState.stages.wireframe.completed ? 'Complete' : 'Pending'}
- ⏳ Prototype: ${projectState.stages.prototype.completed ? 'Complete' : 'Pending'}
- ⏳ Architecture: ${projectState.stages.architecture.completed ? 'Complete' : 'Pending'}
- ⏳ Build: ${projectState.stages.build.completed ? 'Complete' : 'Pending'}

## Next Steps for Claude Code
1. Review the PRD and requirements
2. Set up project structure
3. Implement core features
4. Add tests and documentation

## Full Project Data
Export the full JSON file for complete project context.
`;

    const blob = new Blob([claudeCodeInstructions], { type: 'text/markdown' });
    const url = URL.createObjectURL(blob);
    const link = document.createElement('a');
    link.href = url;
    link.download = `${projectState.projectName.replace(/\s+/g, '-')}-claude-code.md`;
    link.click();
    URL.revokeObjectURL(url);
    setShowExportMenu(false);
  };

  return (
    <div className="h-screen bg-gradient-to-br from-indigo-100 via-purple-50 to-pink-100 flex flex-col overflow-hidden">
      {/* Animated Background */}
      <div className="absolute top-0 left-0 w-full h-full overflow-hidden pointer-events-none">
        <div className="absolute top-10 left-10 w-72 h-72 bg-blue-300 rounded-full mix-blend-multiply filter blur-xl opacity-70 animate-blob"></div>
        <div className="absolute top-0 right-20 w-72 h-72 bg-purple-300 rounded-full mix-blend-multiply filter blur-xl opacity-70 animate-blob animation-delay-2000"></div>
        <div className="absolute bottom-20 left-20 w-72 h-72 bg-pink-300 rounded-full mix-blend-multiply filter blur-xl opacity-70 animate-blob animation-delay-4000"></div>
      </div>

      {/* Top Navigation */}
      <div className="relative z-10 bg-white/90 backdrop-blur-lg border-b border-white/50 shadow-sm">
        <div className="px-6 py-4">
          <div className="flex items-center justify-between mb-4">
            <div className="flex items-center gap-3">
              <div className="w-10 h-10 bg-gradient-to-br from-blue-600 to-purple-600 rounded-lg flex items-center justify-center">
                <Sparkles className="w-6 h-6 text-white" />
              </div>
              <div>
                <h1 className="text-xl font-bold text-gray-900">Product Development Studio</h1>
                <input
                  type="text"
                  value={projectState.projectName}
                  onChange={(e) => dispatch({ type: 'SET_PROJECT_NAME', name: e.target.value })}
                  className="text-sm text-gray-600 bg-transparent border-none focus:outline-none focus:ring-1 focus:ring-blue-500 rounded px-1"
                />
              </div>
            </div>

            <div className="flex items-center gap-2">
              <div className="relative">
                <button
                  onClick={() => setShowExportMenu(!showExportMenu)}
                  className="flex items-center gap-2 px-4 py-2 bg-white/80 hover:bg-white border border-gray-300 rounded-md transition-colors"
                >
                  <Download className="w-4 h-4" />
                  Export
                </button>
                {showExportMenu && (
                  <div className="absolute right-0 mt-2 w-56 bg-white rounded-lg shadow-xl border border-gray-200 py-1 z-50">
                    <button
                      onClick={exportProject}
                      className="w-full px-4 py-2 text-left hover:bg-gray-50 flex items-center gap-2"
                    >
                      <Save className="w-4 h-4" />
                      Export Project JSON
                    </button>
                    <button
                      onClick={exportForClaudeCode}
                      className="w-full px-4 py-2 text-left hover:bg-gray-50 flex items-center gap-2"
                    >
                      <Code className="w-4 h-4" />
                      Export for Claude Code
                    </button>
                  </div>
                )}
              </div>
              <button
                onClick={() => setAiSidebarOpen(!aiSidebarOpen)}
                className="flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-purple-600 to-blue-600 text-white rounded-md hover:from-purple-700 hover:to-blue-700 transition-all shadow-lg"
              >
                <MessageSquare className="w-4 h-4" />
                AI Assistant
              </button>
            </div>
          </div>

          {/* Stage Progress */}
          <div className="flex items-center gap-2">
            {STAGES.map((stage, idx) => {
              const StageIcon = stage.icon;
              const isActive = projectState.currentStage === stage.id;
              const isCompleted = projectState.stages[stage.id].completed;
              const isAccessible = idx <= currentStageIndex;

              return (
                <React.Fragment key={stage.id}>
                  <button
                    onClick={() => isAccessible && goToStage(stage.id)}
                    disabled={!isAccessible}
                    className={`flex items-center gap-2 px-4 py-2 rounded-lg transition-all ${
                      isActive
                        ? 'bg-blue-600 text-white shadow-lg scale-105'
                        : isCompleted
                        ? 'bg-green-100 text-green-700 hover:bg-green-200'
                        : isAccessible
                        ? 'bg-gray-100 text-gray-700 hover:bg-gray-200'
                        : 'bg-gray-50 text-gray-400 cursor-not-allowed'
                    }`}
                  >
                    <StageIcon className="w-4 h-4" />
                    <span className="text-sm font-medium">{stage.name}</span>
                    {isCompleted && <span className="text-xs">βœ“</span>}
                  </button>
                  {idx < STAGES.length - 1 && (
                    <ChevronRight className="w-4 h-4 text-gray-400" />
                  )}
                </React.Fragment>
              );
            })}
          </div>
        </div>
      </div>

      {/* Main Content Area */}
      <div className="flex-1 overflow-hidden relative z-10">
        <div className="h-full p-6">
          <div className="h-full bg-white/80 backdrop-blur-lg rounded-xl shadow-xl border border-white/50 p-6">
            {projectState.currentStage === 'prd' && (
              <PRDStage projectState={projectState} dispatch={dispatch} />
            )}
            {projectState.currentStage === 'wireframe' && (
              <PlaceholderStage stage="wireframe" />
            )}
            {projectState.currentStage === 'prototype' && (
              <PlaceholderStage stage="prototype" />
            )}
            {projectState.currentStage === 'architecture' && (
              <PlaceholderStage stage="architecture" />
            )}
            {projectState.currentStage === 'build' && (
              <PlaceholderStage stage="build" />
            )}
          </div>
        </div>
      </div>

      {/* AI Sidebar */}
      <AISidebar
        isOpen={aiSidebarOpen}
        onClose={() => setAiSidebarOpen(false)}
        projectState={projectState}
        currentStage={projectState.currentStage}
      />

      <style jsx>{`
        @keyframes blob {
          0% { transform: translate(0px, 0px) scale(1); }
          33% { transform: translate(30px, -50px) scale(1.1); }
          66% { transform: translate(-20px, 20px) scale(0.9); }
          100% { transform: translate(0px, 0px) scale(1); }
        }
        .animate-blob {
          animation: blob 7s infinite;
        }
        .animation-delay-2000 {
          animation-delay: 2s;
        }
        .animation-delay-4000 {
          animation-delay: 4s;
        }
      `}</style>
    </div>
  );
};

export default ProductStudio;