Transform your simple ideas into powerful, AI-optimized prompts
Prompt Master is a sophisticated, AI-powered web application that helps users refine and enhance their text-based prompts for Large Language Models (LLMs). It transforms simple, underdeveloped ideas into comprehensive, structured, and highly-effective "super prompts" through an interactive three-stage workflow.
-
π― Three-Stage Wizard Workflow
- Stage 1: Input your initial prompt or idea
- Stage 2: Answer AI-generated clarifying questions
- Stage 3: Receive your optimized super prompt
-
π€ AI-Powered Analysis
- Powered by Google Gemini 2.0 Flash
- Intelligent question generation based on context gaps
- Best practice prompt engineering principles
-
π¨ Modern UI/UX
- Dark mode with purple-to-pink gradient theme
- Fully responsive design (mobile to desktop)
- Smooth animations and transitions
- Accessible keyboard navigation
-
π± Progressive Web App (PWA)
- Installable on mobile and desktop
- Offline capability with service worker
- Native app-like experience
-
β‘ Performance
- Built with Next.js 15 App Router
- Server-side API routes for security
- Optimized bundle size
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: TailwindCSS v4
- AI Service: Google Gemini API (
@google/genai) - Icons: Lucide React
- PWA: Custom Service Worker
Before you begin, ensure you have:
- Node.js 18+ installed (Download)
- npm or yarn package manager
- Google Gemini API Key (Get one here)
```bash git clone cd prompt-master ```
```bash npm install ```
Create a `.env.local` file in the root directory:
```bash
cp .env.example .env.local ```
Edit `.env.local` and add your Gemini API key:
```env GEMINI_API_KEY=your_actual_api_key_here ```
Important: Never commit your `.env.local` file to version control!
```bash npm run dev ```
Open http://localhost:3000 in your browser.
``` prompt-master/ βββ app/ β βββ api/ β β βββ analyze/ β β β βββ route.ts # API: Analyze prompt & generate questions β β βββ generate/ β β βββ route.ts # API: Generate super prompt β βββ layout.tsx # Root layout with metadata & PWA config β βββ page.tsx # Main application page β βββ globals.css # Global styles & Tailwind config βββ components/ β βββ Stage1InitialPrompt.tsx # Stage 1: Prompt input β βββ Stage2Clarification.tsx # Stage 2: Questions & answers β βββ Stage3SuperPrompt.tsx # Stage 3: Super prompt display β βββ LoadingSpinner.tsx # Reusable loading indicator β βββ ErrorMessage.tsx # Error display component β βββ ServiceWorkerRegistration.tsx # PWA service worker setup βββ lib/ β βββ types.ts # TypeScript interfaces β βββ prompts.ts # Meta-prompts for AI β βββ gemini.ts # Gemini API client config βββ public/ β βββ manifest.json # PWA manifest β βββ sw.js # Service worker β βββ icons/ # PWA icons (192x192, 512x512) βββ package.json ```
Users enter their basic prompt or idea into a clean, focused textarea. The system validates the input and prepares it for analysis.
The Gemini API analyzes the initial prompt and generates 4-6 targeted clarifying questions. Users answer these to provide missing context about:
- Target audience
- Desired tone and style
- Output format
- Specific constraints
- Background information
The system employs a Master Prompt Engineering Expert methodology that:
Critical Analysis Phase:
- Identifies strengths, weaknesses, and ambiguities in the original prompt
- Analyzes gaps in context, constraints, and requirements
Transformation Phase:
Strategically applies 12+ industry-standard prompt engineering techniques:
- Role-Playing - Assigns authoritative, competent personas
- Contextualization - Provides rich background information
- Task Decomposition - Breaks complex requests into manageable steps
- Constraint Definition - Outlines clear boundaries and requirements
- Exemplification - Illustrates input-output patterns (Few-Shot Learning)
- Chain-of-Thought - Encourages step-by-step reasoning
- Zero-Shot Prompting - Leverages inherent AI knowledge
- Persona Alignment - Ensures consistent character responses
- Instruction Clarity - Removes all vagueness
- Output Control - Guides quality and nature of responses
- Negative Constraints - Specifies what to avoid
- Goal Reinforcement - Emphasizes primary objectives
Result:
A significantly more effective super prompt that ensures the AI understands nuances and executes with maximum precision. Users can copy this to use with any AI model (ChatGPT, Claude, Gemini, etc.) for superior results.
The app uses TailwindCSS v4 with CSS-based configuration in app/globals.css:
```css @theme inline { --color-purple-600: #9333ea; --color-pink-600: #db2777; /* Custom colors and gradients */ } ```
Modify model settings in lib/gemini.ts:
```typescript export const DEFAULT_MODEL = 'gemini-2.0-flash-exp'; ```
```bash npm run build ```
```bash npm start ```
```bash npm run build && npm start ```
- Push your code to GitHub
- Import project in Vercel
- Add environment variable:
GEMINI_API_KEY - Deploy!
The app can be deployed to any platform supporting Next.js:
- Netlify
- Railway
- AWS Amplify
- Google Cloud Run
Environment Variable Setup: Ensure GEMINI_API_KEY is set in your deployment platform's environment configuration.
- β API keys stored in environment variables
- β Server-side API routes (no client-side exposure)
- β Input validation on all endpoints
- β Error handling with user-friendly messages
- β Rate limiting recommended for production
Edit app/globals.css:
```css --color-purple-600: #your-color; --color-pink-600: #your-color; ```
Edit lib/prompts.ts to customize how the AI analyzes prompts and generates questions.
Modify temperature and token limits in API routes (app/api/analyze/route.ts and app/api/generate/route.ts).
Comprehensive documentation is available in the docs/ folder:
- π Documentation Index - Start here for complete documentation
- π― Project Overview - High-level application summary
- π¨βπ» Developer Guide - Setup and development workflow
- π€ User Guide - How to use Prompt Master
- π API Reference - Complete API documentation
- ποΈ System Architecture - Technical design
- πΎ Database Schema - Database structure
- β Task History - Feature implementation timeline
- π Deployment Guide - Production deployment
- π Changelog - Version history
For quick start instructions, see Quick Start Guide.
Error: "GEMINI_API_KEY is not defined"
Solution: Ensure .env.local exists and contains your API key. Restart the dev server.
Error: TypeScript compilation errors
Solution: Run npm install to ensure all dependencies are installed. Check for type errors in your code.
Error: PWA not installing Solution: Service workers only work on HTTPS or localhost. Ensure you're using a secure connection in production.
This project is open source and available under the MIT License.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For issues and questions:
- Open an issue on GitHub
- Check existing documentation
- Review the PRD in the repository
- Built with Next.js
- Powered by Google Gemini API
- Icons by Lucide
- Styled with TailwindCSS
Made with β€οΈ for better AI interactions