Prompt Engineering
Writing clear instructions, rules and examples for an AI model so it does a business task the same way every time, in the format your systems expect.
What Is Prompt Engineering
A prompt is the instruction you give a language model. Prompt engineering is the work of writing that instruction so the output is correct, consistent and in a format the next step of your process can use. In practice it looks less like clever wording and more like writing a good procedure for a new hire: what the task is, what each category means, what to do when unsure, and exactly what the answer must look like. The fixed part usually lives in the system prompt.
Why it matters to you
In a process, a person does not read the model’s answer first. Code does: a router, a validation rule, an import into your ERP. A vague prompt gives answers that are fine for a human and useless for a system. A better prompt is usually the cheapest improvement available, and the thing to fix before anyone talks about fine-tuning.
Before and after: extracting invoice fields
Before:
Read this invoice and tell me the important details.
The model returns a friendly paragraph. The date is written as “3rd March”, the total carries a currency symbol, and the tax amount is missing because the model decided it was not important. Nothing can be imported.
After:
You extract data from supplier invoices for accounts payable.
Return only JSON with these fields:
supplier_name, supplier_tax_id, invoice_number,
invoice_date (YYYY-MM-DD), due_date (YYYY-MM-DD or null),
currency (ISO code), subtotal, tax, total (numbers, no symbols),
po_number (or null), total_page (page where the total appears).
Use only values printed on the invoice. If a field is missing
or unreadable, return null. Never calculate or guess a value.
If the document is not an invoice, return {"document_type": "other"}.
Add one or two sample invoices with the exact JSON you expect, and the output becomes something code can check. Does subtotal plus tax equal the total? Does the tax ID match a known supplier? Is the PO still open? Anything that fails goes to a person.
What it does not do
A good prompt does not make the model infallible. It reduces errors and makes the remaining ones visible, because a null value or a failed check is easy to route to a reviewer. The validation rules and the human review of flagged items stay in place.
Prompts also need testing like any other change. Keep a set of real documents with known correct answers and rerun it every time you change the wording or switch models.
This pattern is the extraction step in accounts payable invoice automation. The same approach classifies support tickets and intake forms in AI automation projects.