Building AI Features That Actually Ship (and Stay Reliable)
LLM demos are easy. Production AI features need evals, guardrails, cost control and a plan for when the model gets it wrong. Here's my checklist.
By Habib Ur RehmanSenior Full Stack Engineer & MVP Partner- Published
- Updated
- 9 min read

Key takeaways
- Build an eval set of 30–50 realistic inputs before tuning prompts, so you can measure regressions.
- Constrain model output with a schema and validate it; never let raw text drive critical logic.
- Control cost and latency with the smallest passing model, caching, streaming and rate limits.
- Plan for wrong answers: show sources, allow edits and undo, and log failures as new eval cases.
Adding an LLM call to a product takes an afternoon. Making that feature trustworthy at scale takes real engineering. These are the practices I apply before an AI feature goes in front of customers.

Start with an eval set
Collect 30–50 realistic inputs with the outputs you'd consider good. Run every prompt or model change against them. Without this, you're tuning by vibes and will regress without noticing.
Constrain the output
Whenever possible, ask for structured output and validate it with a schema. If the response doesn't parse, retry once, then fall back gracefully. Never let raw model text drive critical logic.
const Result = z.object({
summary: z.string().max(400),
sentiment: z.enum(["positive", "neutral", "negative"]),
})
const parsed = Result.safeParse(JSON.parse(modelOutput))
if (!parsed.success) return fallback()
Control cost and latency
- Use the smallest model that passes your evals.
- Cache identical or near-identical requests.
- Stream responses so the UI feels instant.
- Set per-user rate limits and monthly budget alerts.
Plan for being wrong
Models will occasionally be confidently incorrect. Show sources where you can, let users edit or undo AI output, and log failures so you can turn them into new eval cases. AI-native development is one of my core skills.
FAQs
Short answers on evaluation, safety and architecture for teams adding LLMs to a product.
Collect 30 to 50 realistic inputs with the outputs you would accept, then run every prompt or model change against that set. Track pass rate over time so regressions are visible instead of anecdotal.
Request structured output, validate it against a schema such as Zod, retry once on failure and fall back gracefully if it still does not parse.
Use the smallest model that passes your evals, cache identical or near-identical requests, stream responses, and set per-user rate limits with budget alerts.
The term has two common meanings. An AI-native product is one where AI is central to how it works, for example generating, classifying or acting on content as the core experience rather than a feature added later. AI-native development refers to using AI coding assistants in the engineering workflow. Both still need the same discipline: evaluations, validation and monitoring.
Yes. Start with one narrow, well-defined feature, call the model from your backend rather than the browser, and wrap the provider behind a small interface so you can change models later. Ship it behind a feature flag, measure it against an evaluation set, and review data privacy before sending customer data to a third-party API. See the architecture such a feature fits into.
Start with good prompts and retrieval-augmented generation (RAG) when the model needs your own, changing information such as documents or product data. Consider fine-tuning when you need consistent style, format or behaviour that prompting can't deliver reliably. RAG is generally easier to keep current because you update the data, not the model.
You can't eliminate it, so design for it. Treat model output and any retrieved or user-supplied text as untrusted, keep instructions separate from data, give the model only the access it needs, validate outputs before acting on them and require human confirmation for sensitive actions. The OWASP Top 10 for LLM Applications is a useful checklist.
References
- Zod: TypeScript-first schema validation — Zod documentation
- #AI
- #LLMs
- #Architecture
Keep reading

Next.js & React
Next.js App Router: Patterns I Reach for on Every Project
Server Components, route groups, streaming and server actions — the handful of patterns that keep my Next.js codebases fast and easy to reason about.
- Published
- Updated
- 8 min read

SaaS & MVP
How I Ship a Production-Ready MVP in Six Weeks
A practical playbook for founders: what to cut, what to keep, and how to sequence the work so you launch fast without building a house of cards.
- Published
- Updated
- 7 min read
SaaS & MVP
Building Scalable SaaS Applications with Next.js and NestJS
A practical architecture guide to building a multi-tenant SaaS with Next.js and NestJS: how the two fit together, how to handle auth, databases, tenancy and background jobs, and what to avoid.
- Published
- 11 min read