← Blog

Best Prompt Engineering Practices for Production Apps

2026-09-20 · 5 min read · SubToAPI Team

"Best prompt engineering" usually means one of two things: people looking for techniques that reliably improve model output, or people looking for a course that teaches them. This article is about the first — concrete practices you can apply today to get more consistent, accurate, and useful responses from Claude or any other large language model, without needing to fine-tune anything.

The short version: the best prompt engineering isn't a trick or a magic phrase. It's structure, specificity, and iteration. Below are the techniques that actually move the needle in production systems, not just in demos.

Structure Beats Cleverness

The single biggest improvement most people can make isn't a clever phrase — it's structure. Models respond better to prompts that clearly separate instructions, context, and input.

## Task
Summarize the customer support ticket below in 2 sentences.

## Constraints
- No greetings or sign-offs
- Mention the product name if present
- Flag if the customer requests a refund

## Ticket
{{ticket_text}}

This format works because it removes ambiguity about what's instruction versus what's data. XML tags work just as well for this, and Claude in particular handles them cleanly:

<task>Summarize the ticket in 2 sentences.</task>
<constraints>
No greetings. Mention product name if present. Flag refund requests.
</constraints>
<ticket>{{ticket_text}}</ticket>

Pick one convention and use it consistently across your prompts. Consistency matters more than which format you choose.

Show, Don't Just Tell (Few-Shot Examples)

Instructions describe what you want. Examples show it. For anything with a specific output format — JSON schemas, tone, classification labels — one or two well-chosen examples outperform a paragraph of description.

Classify the sentiment as positive, negative, or neutral.

Review: "The shipping was fast but the product broke in two days."
Sentiment: negative

Review: "Works exactly as described, no complaints."
Sentiment: positive

Review: "{{new_review}}"
Sentiment:

Keep examples diverse — include edge cases, not just the obvious ones. A model that only sees clean positive/negative examples will struggle with mixed or ambiguous input.

Give the Model Room to Think

For anything involving reasoning — math, multi-step logic, comparing options — ask the model to work through the problem before giving a final answer. This is often called chain-of-thought prompting, and it consistently reduces errors on non-trivial tasks.

Think through this step by step before answering.

Question: A store has 120 units. It sells 15% on Monday and
30% of the remainder on Tuesday. How many units are left?

If you need a clean answer for downstream parsing, ask for the reasoning first and the final answer last, wrapped in a clear marker:

Show your reasoning, then end with:
FINAL ANSWER: <value>

Be Explicit About Format

Vague instructions produce vague or inconsistent output. If you need JSON, say so and show the shape. If you need a specific word count, state it as a hard constraint, not a suggestion.

Return only valid JSON matching this shape, no other text:
{
  "summary": string,
  "priority": "low" | "medium" | "high",
  "tags": string[]
}

This matters even more once you're calling the model programmatically — a human can tolerate a slightly off format, your parser can't.

Use System Prompts for Persistent Behavior

Anything that should apply to every request — tone, role, output constraints, safety rules — belongs in a system prompt, not repeated in every user message. This keeps individual requests short and makes behavior consistent across a session or an entire application.

{
  "system": "You are a technical support assistant. Be concise. Never invent version numbers or API endpoints you're not certain about.",
  "messages": [
    { "role": "user", "content": "How do I reset my API key?" }
  ]
}

Prompt Engineering Meets Tool Use

Modern prompt engineering isn't just about text — it's increasingly about giving models tools and letting them decide when to call them. Instead of writing a prompt that tries to make the model "guess" live data, define a tool schema and let the model request it explicitly.

{
  "tools": [
    {
      "name": "get_order_status",
      "description": "Look up the current status of an order by ID",
      "input_schema": {
        "type": "object",
        "properties": { "order_id": { "type": "string" } },
        "required": ["order_id"]
      }
    }
  ]
}

This removes a whole category of prompting problems — you no longer need to coax accurate answers out of a model that simply doesn't have the data. If you're building this against Claude specifically, SubToAPI exposes tool use through a standard HTTPS endpoint, so you can test and ship these flows without managing separate credentials per environment. See /docs/tools for the request format.

Test Prompts Like Code

The best prompt engineering practice, above any individual technique, is treating prompts as versioned, testable artifacts:

If you're calling Claude programmatically, SubToAPI's dashboard includes usage metadata per request, which makes it easier to see how prompt changes affect both output quality and cost over time. Getting started takes a few minutes — see /docs/quickstart.

Questions

Is prompt engineering still useful with newer, smarter models? Yes. Better models reduce the need for workarounds, but structure, examples, and clear constraints still meaningfully improve consistency and reduce parsing errors, especially in production systems.

Should I write one long prompt or split instructions and context? Split them. Use a system prompt for persistent behavior and a structured user message (with clear sections or tags) for the task-specific input. This is easier to maintain and debug than one long block of text.

How do I know if my prompt is actually good? Test it against a fixed set of representative inputs, including edge cases, and check the output for accuracy, format compliance, and consistency — not just how it looks on one example.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →