About & Architecture
PromptLab AI uses a layered pipeline with a clean provider abstraction that makes swapping the mock engine for a real Claude or OpenAI API a one-line change.
AI Pipeline
Input
AIProviderInput — originalPrompt + taskType
Weakness Analyzer
Detects vague language, missing context, hallucination risks → WeaknessItem[]
Variant Generator
Produces Balanced, Detailed Expert, Short Efficient → PromptVariant[]
Heuristic Scorer
Scores 4 dimensions (Clarity, Context, Specificity, OutputControl) → PromptScores
Comparator
Ranks variants by overall score, picks the winner → ScoredVariant[]
OptimizationResult
Assembled result saved to localStorage history
Each stage corresponds to a TypeScript interface. The pipeline runs entirely client-side with the mock provider — no server needed.
Architecture
Tech Stack
Next.js 16
FrameworkApp Router, Server Components, file-based routing
TypeScript 5
LanguageStrict mode, discriminated unions, full type safety
Tailwind CSS v4
StylingCSS-first configuration, dark mode via class strategy
shadcn/ui + Base UI
ComponentsAccessible headless components built on Radix primitives
Framer Motion
AnimationPipeline animations, score bar entrances, page transitions
next-themes
ThemingSSR-safe dark/light mode with system preference detection
nanoid
UtilityCompact, URL-safe unique IDs for results and history entries
localStorage
StorageVersioned JSON schema, SSR-safe, max 50 entries
What's next
- Phase 7: Real Claude API integration via ClaudeProvider
- Prompt version diffing — compare your original vs optimized side-by-side
- Batch optimization — submit multiple prompts at once
- Export to PDF or Markdown
- User accounts with cloud sync (Supabase)