DEV Community

manja316
manja316

Posted on

The anatomy of a single-purpose AI tool (and why I shipped two of them this week)

I keep hitting the same friction with ChatGPT: I want to do ONE thing — fix this JSON, build that regex — and a chat window is the wrong shape for it. Too many turns, too much context-reset, too much typing.

So I built two tools that prove a smaller hypothesis: a single-purpose page with AI as the fallback beats a chat window for any task you do more than once a week.

The shape

Both apps are the same shape:

  1. Deterministic path first. regexai runs your regex through native RegExp and highlights matches as you type. jsonfix calls JSON.parse and formats. No API, no latency, no cost. 95% of sessions never leave this path.
  2. AI fallback. If the deterministic path fails (regex doesn't match what you want, JSON throws SyntaxError), one button hands the problem to Claude with a tight prompt. Result lands back in the same UI.
  3. No login, no quota popup, no "sign up for more". Friction kills these utilities. The cost per session is low enough that I eat it.

Why this shape wins

Chat is bad at repeating chores because every turn re-establishes context. Single-purpose pages keep state in the URL or the textarea — paste, click, paste, click. You can do twenty in a row.

ChatGPT is great for novel problems. It's wrong for the 30th time this month you needed to validate an IPv4. The tool that wins for "30th time" is the one with the lowest activation energy, and that's a bookmarked URL that does ONE thing.

Architecture (small enough to fit in a tweet)

  • Next.js 16 App Router
  • One client component for the UI, one route handler for the AI call
  • @anthropic-ai/sdk on the server, claude-haiku-4-5 for speed and cost
  • Edge runtime so cold starts don't matter
  • Vercel analytics, nothing else

That's it. No database. No auth. No queue. The state of the app is whatever's in the textarea. If the tab closes, the work is gone — and that's correct, because the user is solving a 30-second problem, not building a project.

The prompt that does the heavy lifting

For jsonfix:

You are a JSON repair tool. The user pasted text they believe should be valid JSON but it isn't. Return the corrected JSON and a one-line explanation of what was broken. Output as {"fixed": "...", "explanation": "..."}. Do not invent fields. Preserve all keys and values; only fix syntax.

For regexai:

You are a regex builder. Given the user's description, return {"pattern": "...", "flags": "g", "explanation": "...", "testString": "..."}. Use ECMAScript regex syntax (no PCRE-only features). Generate a testString that demonstrates a match.

Both prompts are pinned: model name, system prompt, schema. No few-shot examples — the schema in the prompt is enough at this scope.

What I'd build next in this shape

Tools that are great candidates:

  • cron expression builder
  • SQL query explainer (paste a query, get the plain English)
  • diff explainer (paste two blobs, get a semantic summary)
  • HTTP request replayer (paste curl, get fetch / Python requests / etc.)

The pattern is the same every time: deterministic path, AI fallback, no login, one job per page.

Try them

If you build one in the same shape, drop the link — happy to feature it.

Top comments (0)