{"slug": "what-is-prompt-engineering-what-works-in-production", "title": "What is prompt engineering? What works in production", "summary": "A production engineering team reports that prompt engineering gains come mainly from cleaning and distilling inputs rather than adding rules, cutting one multi-item support request from 37,604 tokens to 4,722 and correcting four wrong part identifications without changing the model. The team structures production prompts in four layers—role and scope, global principles, distilled case facts, and a strict output contract—and treats misbehaving agents with subtraction, deleting conflicting instructions and preserving verified safety constraints under regression tests.", "body_md": "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.\n\n*Distilling messy threads and raw order payloads into concise, structured facts fixes more errors than stacking extra rules into a long prompt.*\n\n## \n  \n  \n  The four parts of a production prompt\n\nA prompt inside a live business system is not a single sentence typed into a chat box. It has four distinct layers:\n\n1. \n**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.\n2. \n**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.\n3. \n**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.\n4. \n**Strict output contract:** the exact fields, labels, or JSON keys downstream code expects so the response can be checked and logged automatically.\n\n## \n  \n  \n  Why most prompt tuning stalls\n\nTeams 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.\n\nTwo things go wrong when prompts grow this way:\n\n- \n**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.\n- \n**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.\n\nFor 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).\n\n## \n  \n  \n  Subtraction beats stacking rules\n\nWhen a live agent misbehaves, our first step is subtraction, not addition:\n\n- \n**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.\n- \n**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.\n- \n**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.\n- \n**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.\n\n## \n  \n  \n  Testing prompt changes on real work\n\nPrompt 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).\n\n## \n  \n  \n  Where prompt engineering ends and engineering begins\n\nPrompts 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).\n\nIf 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.\n\n*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.*", "url": "https://wpnews.pro/news/what-is-prompt-engineering-what-works-in-production", "canonical_source": "https://dev.to/yzh317179958/what-is-prompt-engineering-what-works-in-production-1j7b", "published_at": "2026-11-25 19:10:03+00:00", "updated_at": "2026-11-25 19:14:54.837484+00:00", "lang": "en", "topics": ["large-language-models", "ai-agents", "ai-tools", "natural-language-processing"], "entities": [], "also_reported_by": [], "takeaway": "Trimming a support prompt's input to only the order lines the customer mentioned cut tokens from 37,604 to 4,722 and fixed four wrong part identifications without changing the model.", "recommendation": {"advice": "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.", "playbook": "llm-cost", "playbook_url": "https://wpnews.pro/playbooks/llm-cost"}, "alternates": {"html": "https://wpnews.pro/news/what-is-prompt-engineering-what-works-in-production", "markdown": "https://wpnews.pro/news/what-is-prompt-engineering-what-works-in-production.md", "text": "https://wpnews.pro/news/what-is-prompt-engineering-what-works-in-production.txt", "jsonld": "https://wpnews.pro/news/what-is-prompt-engineering-what-works-in-production.jsonld"}}