Structure beats cleverness
A reliable prompt states the role, the task, the constraints, the input and the exact output format — in that order. Ambiguity is the main cause of inconsistent responses; specify length, tone, schema and what to do when information is missing.
Few-shot and reasoning
Two or three worked examples pin down format far more effectively than adjectives. Asking the model to work step by step improves multi-step arithmetic and logic; for user-facing output, keep the reasoning internal and return only the conclusion.
Structured output and injection
Request JSON against a schema and validate it — retry on parse failure rather than trusting the string. Treat any text that came from a user, a web page or a document as untrusted data, never as instructions: prompt injection is the LLM equivalent of SQL injection.
{
"role": "contract auditor",
"task": "classify the finding",
"output_schema": {
"severity": "critical|high|medium|low",
"summary": "string, max 200 chars",
"confidence": "number 0-1"
},
"on_missing_info": "return severity 'low' with confidence 0"
}