ioannis. ← All projects

AI Engineering · Case study · 2025

BetterPrompt

A Chrome extension and SaaS backend that rewrites rough input into expert-level prompts, then drops them straight into ChatGPT, Claude, Gemini and more, without breaking the user's flow.

BetterPrompt's job is to sit between a rough idea and a good prompt. A user highlights text on any page or types into the extension's side panel, and an intent-analysis step classifies what they're actually trying to do — Academic, Technical, Creative or General — before applying a matching optimisation strategy: RTF-style scaffolding (role, task, format), guided refinement questions when the request is underspecified, and tone controls for how formal or casual the rewritten prompt should read. The result isn't a single fixed template; the classification changes which transformation logic runs, so a technical debugging question and a creative-writing brief get rewritten differently rather than forced through the same rubric.

The extension itself is built on Chrome's Manifest V3, the current extension platform, using content scripts to detect and capture selected text on the page, DOM adapters so the same capture logic works across sites with very different layouts, and a background service worker that proxies requests so the page itself never talks to the backend directly. From the user's side, the optimised prompt can be copied, edited in a diff view against the original, or inserted straight into the AI tool that's already open — ChatGPT, Claude, Gemini, Perplexity, Grok, Copilot, Mistral and DeepSeek are all supported as insertion targets, so switching tools doesn't mean re-learning how to get a prompt in.

The backend is a Node.js and Express service that routes generation across Gemini and Anthropic depending on the prompt class — creative requests, for instance, are routed differently than technical ones — sitting behind a Railway-hosted proxy so provider API keys never reach the browser. Google OAuth handles sign-in, and Supabase backs the usage tier: every optimisation call is metered against the user's subscription, with atomic quota consumption so concurrent requests can't overdraw a plan, refund-on-failure so a request that errors out doesn't cost a credit, and webhook replay protection on the Revolut payment integration so a retried webhook can't double-charge or double-grant credits. Coupon logic and subscription-tier enforcement sit on top of the same metering path rather than as a separate system bolted on afterward.

Production hardening covers the parts that don't show up in a demo: request validation and CORS controls at the API boundary, request-size limits and timeout-aware messaging between the content script and the background worker so a slow network doesn't hang the page, a local fallback optimisation path for when the backend is unreachable, graceful shutdown handling on deploy, and the review and policy work needed to keep the listing compliant with Chrome Web Store requirements.