MessyDev build: how Check Before You Send was built
A walkthrough of a feature inside MessyDev itself: a prompt reviewer that works signed out, degrades to deterministic rules when the model is unavailable, and never pretends to be certain.
The idea
Give someone a way to check a prompt before sending it to an AI builder, explaining what is missing rather than silently rewriting it.
Architecture
- A public page that works without an account, because the first useful thing should not need a signup.
- A deterministic rule set that runs instantly in the browser and never fails.
- A server endpoint that adds a model-written review on top of those rules.
- Rate limiting on the endpoint, since it is reachable by anyone.
Tools
| Tool | Role |
|---|---|
| Lovable | AI building platform used to write and edit the feature |
| Lovable AI gateway | Routes model requests server-side so no key reaches the browser |
| Supabase | Accounts and stored history for signed-in users |
The build process
- Wrote the deterministic rules first, so the page is useful even when the model is not reachable.
- Added the server endpoint, with input length limits and sanitisation before anything is sent to a model.
- Made the signed-out path return the rule-based result rather than an error.
- Added an explicit label showing whether the answer came from the model or the offline rules.
What the AI generated
- The rule evaluation and its scoring.
- The server endpoint, its validation and its rate limiting.
- The page, the result cards and the copy-to-clipboard behaviour.
What was happening underneath
- Signed-out requests still pass through the authentication check, which is why they appear in logs as auth failures even though the page is meant to work signed out.
- The model response is parsed into a fixed shape; anything unparseable falls back to the rule output rather than showing raw text.
- User text is wrapped in an explicit boundary so instructions inside a pasted prompt are treated as data, not commands.
Problems, and what they actually were
Signed-out checks appeared as authentication failures in the security log.
Underneath: The shared authentication helper logs every request without a session as a failure, including supported anonymous paths.
Fix: Documented the threshold at which a connection is actually blocked and added filters so anonymous requests can be told apart from genuine bad tokens.
A long pasted prompt could try to instruct the reviewer.
Underneath: Everything sent to a model is just text; a pasted prompt containing instructions looks identical to your own instructions.
Fix: Added explicit boundaries and a rule that content inside them is analysed, never obeyed.
Deployment
- Shipped behind the existing public routes with no database change.
- Verified signed out first, then signed in, then with the model deliberately unavailable.
Lessons learned
- A feature that degrades to something deterministic is more trustworthy than one that fails.
- Label the source of an answer. 'Offline checklist' is honest; silence is not.
- Anything a user pastes is data. Treat it as data everywhere.
Read the concepts behind it
- How AI coding tools workInside an AI coding tool: the model, the context window, the tool calls, the build loop, and why the wrapper around the model matters as much as the model.
- Common security mistakes in AI-generated appsThe handful of issues that show up repeatedly in generated code — what each one looks like, why it happens, and the check that catches it.