Ship this prompt as an app: the one-file pattern
Wrap a good prompt in one route handler: validate input, call the model, validate output, return typed JSON. No agent framework, no vector DB, no queue. A prompt plus a POST endpoint is a shippable feature. Add the rest only when a real user complains. Ship the prompt, not the platform.
On this page
You have a prompt that works in the playground. The gap to production is smaller than you think. One endpoint.
You are {{role}}. Given the input, produce {{output_contract}}.
Respond ONLY as JSON matching this shape: {{schema}}.
If the input is invalid or out of scope, return {"error": "reason"}.
Input:
{{validated_input}}
The whole app:
export async function POST(req: Request) {
const body = await req.json();
const input = InputSchema.parse(body); // reject junk early
const raw = await model(renderPrompt(input)); // your one prompt
const data = OutputSchema.parse(JSON.parse(raw)); // trust nothing
return Response.json({ ok: true, data });
}
Validate in. Validate out. Ship. Add caching, auth, and retries when traffic — not your imagination — demands them.
Receipt
- Model: Opus 4.8 (
claude-opus-4-8) - Cost: ~700 in + 500 out tokens ≈ $0.030 / call
- Time from working prompt to deployed endpoint: under an hour
Why it works
- The prompt is the product. Everything else is plumbing you can defer.
- Schemas at both edges. Validation on input and output turns a flaky LLM into a typed function.
- One file, one thing to debug. No framework indirection between you and the failure.
Failure mode
- Premature scale. A queue and a vector DB on day one bury a 30-line feature. Don't.
- Unbounded cost. A public endpoint with Opus behind it is a billing risk — add a rate limit and a per-request token cap before launch.
Cost to test: $0.030 / call.
Sources
- Internal prototypes shipped on this pattern.
- Anthropic Opus 4.8 pricing.
FAQ
When do I actually need an agent framework?
When you have multiple tools, real branching, and state that outlives one request. Until then a single prompt plus a route handler is simpler and faster to debug.
Isn't Opus overkill for a first ship?
For the prototype, capability beats cost — ship on Opus, prove value, then route easy traffic down to Haiku with the cheap-then-deep pattern.