# What is prompt engineering? What works in production

> Source: <https://dev.to/yzh317179958/what-is-prompt-engineering-what-works-in-production-1j7b>
> Published: 2026-11-25 19:10:03+00:00

**Recommendation:** Before adding prompt rules, print the exact prompt sent to the model and strip raw threads and payloads down to the relevant structured facts; one case dropped from 37,604 to 4,722 tokens and fixed four misidentifications.
More in the playbook "Controlling LLM cost": <https://wpnews.pro/playbooks/llm-cost>

Prompt engineering is the practice of structuring the instructions, context, and output format you send to a large language model so it produces reliable results for a specific task. In everyday work, the biggest gains rarely come from clever phrasing; they come from giving the model clean, relevant facts and removing conflicting rules.

*Distilling messy threads and raw order payloads into concise, structured facts fixes more errors than stacking extra rules into a long prompt.*

## 
  
  
  The four parts of a production prompt

A prompt inside a live business system is not a single sentence typed into a chat box. It has four distinct layers:

1. 
**Role and scope:** what job this step owns and what it must not decide. For example, a drafting step writes the reply based on a verified decision; it does not invent a refund amount on its own.
2. 
**Global principles:** clear, non-contradictory rules written once—answer the customer's question directly in the first sentence, give concrete troubleshooting steps before asking for extra paperwork, and never expose internal field names or SKU codes.
3. 
**Distilled case facts:** only the structured facts needed for this turn—customer request, verified order and shipping state, prior commitments with dates, and known gaps or conflicts.
4. 
**Strict output contract:** the exact fields, labels, or JSON keys downstream code expects so the response can be checked and logged automatically.

## 
  
  
  Why most prompt tuning stalls

Teams running AI in customer service hit the same wall after the first month: every time the model makes a mistake on one ticket, someone appends a new rule to the prompt. After thirty incidents, the prompt is thousands of words long, full of overlapping bans and copied reply templates.

Two things go wrong when prompts grow this way:

- 
**Templates turn into robotic replies:** if you put sample customer sentences inside the prompt, models copy those exact sentences into unrelated tickets. State the principle clearly and keep incident examples in a separate constraint lookup that triggers only on matching scenarios.
- 
**Raw payloads drown out the rules:** no amount of prompt wording fixes an input stuffed with a 25-round raw email thread or an unfiltered order JSON. On one real multi-item support case in our production pipeline, trimming the input to the exact order lines mentioned by the customer cut the request from 37,604 tokens to 4,722 tokens and turned four wrong part identifications into four correct ones without touching the model.

For more on why systems fail even with strong models, see [why AI agents fail in production](https://ai.dingboai.com/en/why-ai-agents-fail-in-production.html) and [what is an LLM](https://ai.dingboai.com/en/what-is-an-llm.html).

## 
  
  
  Subtraction beats stacking rules

When a live agent misbehaves, our first step is subtraction, not addition:

- 
**Print the exact prompt sent to the model:** check what the model actually received, including retrieved knowledge snippets, thread summaries, and tool outputs. Most "prompt bugs" are dirty inputs.
- 
**Delete duplicate and conflicting instructions:** if one rule says "always cite a confirmed date" and another says "never say you are unsure," the model invents dates. Resolve the conflict instead of adding a third warning.
- 
**Keep historical safety constraints intact:** when shortening a prompt, merge and tighten wording, but preserve verified factual constraints learned from past incidents and re-run regression tests against real tickets.
- 
**Write positive rules, not banned-phrase lists:** telling a model not to write a specific disclaimer phrase often causes it to translate and output that exact disclaimer in another language. State what it should give the customer instead—an analysis based on verified facts and concrete next steps.

## 
  
  
  Testing prompt changes on real work

Prompt engineering only counts when measured on real cases. In our production customer service operation (36,789 customer emails and 15,725 chat conversations in the 30 days to 19 November 2026 across eight languages), every prompt change is replayed on real historical tickets before going live, comparing the new draft side by side against the final reply human agents actually sent. Across that 30-day window, 26,451 sent replies used an AI draft (3,331 sent automatically by the AI, 3,781 sent unchanged by agents, and 19,339 edited). Tracking where agents still edit drafts shows which instructions are unclear or missing. See [how to measure AI customer service quality](https://ai.dingboai.com/en/measure-ai-customer-service-quality.html) and [how an AI support agent learns from agent edits](https://ai.dingboai.com/en/ai-learns-from-agent-edits.html).

## 
  
  
  Where prompt engineering ends and engineering begins

Prompts should steer judgement and writing style. Code should handle data retrieval, identity verification, fact extraction, permission checks, and final execution. Mixing those responsibilities leads to brittle bots. See [AI guardrails for customer service](https://ai.dingboai.com/en/ai-guardrails-for-customer-service.html) and [what is MCP](https://ai.dingboai.com/en/what-is-mcp-model-context-protocol.html).

If your team is spending hours tweaking prompts on a support bot that still gives inconsistent replies, share the workflow in the form above. We inspect the real data flow, design a clean agent architecture, and charge per completed task after a live pilot.

*Originally published at [ai.dingboai.com](https://ai.dingboai.com/en/what-is-prompt-engineering.html). Dingbo AI builds and runs AI agents for customer service, paid per completed task.*
