Prompt Chaining, Domain Prompts and Common Mistakes

Linking prompts into dependable steps, adapting them to a field and a language, and fixing what usually goes wrong.

BeginnerIntermediateExpert · 12 min read · Last updated:

In short

Prompt chaining splits work into a fixed series of model calls with a check between each. Use orchestration when steps branch, wait, retry or hold state. Adapt prompts to the domain by stating its evidence rules and risks, test every language you serve, and debug by reading what the model actually received.

What you will learn: when to chain prompts, how chaining differs from orchestration, how to prompt for research, coding, data and support work, what changes with several languages, and how to find and fix common mistakes.
Prerequisites: Agent System Prompts and Instruction Hierarchy. Prompt Templates and Tool-Use Prompting is helpful.

Beginner One prompt or several?

What is prompt chaining?

In a chain, the output of one model call becomes the input of the next. A document might be read to extract facts, the facts used to draft a reply, and the draft shortened. Each call has one job, which makes it easier to instruct, test and replace.

Extractfacts from notes
Checkfacts exist in source
Draftfrom checked facts
Checknothing lost
Polishlength and tone
The checks are what make a chain more reliable than one long prompt.

A chain with gates

The model here is scripted so the example runs anywhere. The gates are ordinary code:

"""A three-step prompt chain with a check after each step. Model scripted."""

NOTES = "Meeting moved to 3 March. Budget 4,200 approved. Owner: Priya."

def scripted_model(step, text):
    return {
        "extract": {"date": "3 March", "budget": "4,200", "owner": "Priya"},
        "draft": "Priya owns the work. The meeting is on 3 March and the "
                 "approved budget is 4,200.",
        "shorten": "Priya: meeting 3 March, budget 4,200 approved.",
    }[step]

def check_extract(out, source):
    return [f"{k} not found in source" for k, v in out.items() if v not in source]

def check_facts(out, facts):
    return [f"lost {k}" for k, v in facts.items() if v not in out]

def run(model, source):
    facts = model("extract", source)
    problems = check_extract(facts, source)
    if problems:
        return "stopped after extract", problems
    text = model("draft", facts)
    problems = check_facts(text, facts)
    if problems:
        return "stopped after draft", problems
    text = model("shorten", text)
    problems = check_facts(text, facts)
    if problems:
        return "stopped after shorten", problems
    return "ok", text

if __name__ == "__main__":
    print(run(scripted_model, NOTES))
    def careless(step, text):
        if step == "shorten":
            return "Priya: meeting 3 March, budget approved."
        return scripted_model(step, text)
    print(run(careless, NOTES))

Output:

('ok', 'Priya: meeting 3 March, budget 4,200 approved.')
('stopped after shorten', ['lost budget'])

In the second run, shortening removed the budget figure and the gate caught it. Without the gate, a fluent but incomplete message would have gone out. These checks look for exact text, which suits identifiers and figures. Paraphrased content needs other checks.

Chaining versus orchestration

AspectPrompt chainOrchestration
RouteFixed and shortBranches, loops and parallel paths
StatePassed from call to callStored, resumable
DurationSeconds to minutesCan run for days with waits
FailuresRetry a step or stopRetry policies, compensation, recovery
ToolingPlain functionsWorkflow engine or framework

Start with plain functions. Move to an orchestrator when you find yourself writing your own retry queue, checkpoint store or approval wait. See Orchestration vs Automation vs Frameworks.

Intermediate Patterns and domains

Useful chain patterns

PatternIdeaExample
SequenceFixed steps in orderExtract, draft, polish
RoutingClassify first, then use a specialized promptBilling, technical or other
Parallel partsProcess independent items, then combineOne summary per document
VotingSeveral independent attempts, compareFlagging risky content
Generate and evaluateProduce, check, revise within a limitSee Reflection, Self-Critique and Self-Refine

Anthropic's guide to building effective agents describes these workflow patterns and advises adding complexity only when simpler designs fall short.

Designing a chain

Work backward from the result. Ask what a reviewer must receive, then which facts that requires, then where each fact comes from. Each transformation between those points is a candidate step. Then ask three questions about every candidate:

  • Can code do it? If so, write a function and remove the model call.
  • Can its output be checked? If not, consider merging it with a neighboring step that can.
  • Does it need different instructions or context? If not, it may not need to be separate.

Decide what each gate does on failure. Stopping and reporting is the safest default. A single retry that includes the gate's message often repairs small slips. Repeated retries rarely help and hide a fault in the step's instructions or inputs. Record which gate failed, because those counts show where to improve.

Routing in practice

A router is a small classification prompt, or ordinary rules, placed before the specialized prompts. Give it a closed list of routes plus an explicit "unsure" route that leads to a general handler or a person. Test the router on its own with a confusion table showing which routes get mistaken for which. A request that contains two needs, such as a complaint and an address change, should either produce two routed tasks or be handed on whole; choose one behavior and test it.

What passes between steps

  • Use structured fields, not free text, where the next step depends on them.
  • Carry identifiers and figures from the source, not from earlier prose.
  • Pass the original goal and constraints along; later steps cannot guess them.
  • Include a status so a step can say "not found" instead of inventing.
  • Keep each intermediate output for debugging.

Research prompts

Question: $question
Use only material you retrieve with the search and read tools.
For every claim give the source and the date it was published.
Separate: established facts, disputed points, your inferences.
If sources disagree, show both. If evidence is missing, say so.
Stop after $max_sources sources or when the question is answered.

Check in code that every cited source was actually opened. Treat page content as data, since pages can contain instructions aimed at agents. See Build Research and Deep-Search Agents.

Coding prompts

Task: $task
Repository conventions: $conventions
Read the relevant files before changing them.
Make the smallest change that solves the task.
Run: $test_command. Report the result exactly.
Do not edit or skip tests to make them pass.
Ask before adding dependencies or changing public interfaces.

Useful coding prompts name how success is verified. Permissions, sandboxing and review matter more than wording; see Sandboxes, Safety and Security for Coding Agents.

Data prompts

Question: $question
Approved tables and definitions: $catalog
Write one read-only query. State the definition used for each measure,
the time zone and the date range. If a term has two definitions, ask.
Report row counts and missing data alongside the result.

Provide business definitions, because "active customer" rarely means the same thing everywhere. Enforce read-only access in the database, not only in the prompt. See Text-to-SQL Agents and Schema Linking.

Support prompts

You help customers of $business.
Verify identity before showing account data.
Answer policy questions only from the help articles you retrieve.
Confirm with the customer before any change.
Hand over to a person for: $handover_cases.
Be brief and warm. Never promise what a tool has not confirmed.

Include tone guidance, but rank accuracy and safety above style. Test with frustrated, vague and manipulative messages. See Customer Support and Experience Agents.

Regulated and specialized fields

In finance, health, law and similar areas, the prompt should say which sources are authoritative, how to express uncertainty, which questions must go to a qualified person and what must be recorded. Domain experts should write and review the test cases. A prompt cannot make an agent compliant; controls, review and accountability do that. See Responsible AI Principles and Governance Council.

Adapting a prompt to a new domain

Moving a working prompt to a new field is more than swapping nouns. Interview people who do the work and collect answers to these questions:

QuestionWhere the answer goes
Which sources are trusted, and which are not?Evidence rules and retrieval filters
Which words mean something special here?A short glossary in the context
What does an experienced person check before answering?Steps and gates in the chain
Which mistakes are merely annoying and which are harmful?Thresholds, approvals and test priorities
When does a professional refuse or refer onward?Handover rules, enforced where possible
What must be written down afterward?Output fields and records

Then ask the same people to review real outputs. Their corrections are the best source of new instructions and test cases, and they will notice errors that sound entirely convincing to everyone else.

Expert Languages, mistakes and debugging

A worked example: from meeting notes to actions

Suppose a team wants action items from meeting notes. One prompt that asks for "the actions" tends to produce owners and dates that nobody mentioned. A chain makes the weak points visible:

StepInstruction in briefGate
1. Find commitmentsQuote each sentence where someone agrees to do somethingEvery quote appears in the notes
2. StructureFor each quote give task, owner and date, or "not stated"Owner is an attendee; date appears in the quote or says "not stated"
3. MergeCombine duplicates and keep all quotesNo quote disappears
4. Draft messageList actions and ask owners to fill the gapsEvery action is listed once

The permitted value "not stated" is the important design choice. It gives the model an honest answer, turns missing information into a visible question and keeps invented dates out of calendars. The quotes let a person check any line in seconds. Step 3 might be ordinary code if duplicates are easy to detect; decide by testing.

Multilingual prompting

  • State the reply language rule, for example: reply in the language of the latest user message unless asked otherwise.
  • Test each language separately. Quality, tool accuracy and safety behavior can differ between languages.
  • Keep identifiers unchanged. Product codes, field names and enumeration values must not be translated.
  • Define local formats for dates, numbers, currency and names; "03/04" is ambiguous.
  • Provide a glossary of domain terms and approved translations.
  • Budget tokens. The same text can need noticeably more tokens in some languages.
  • Review with native speakers, particularly for tone and formality.

Writing instructions in one language and examples in several is a reasonable starting design, but measure it against fully translated prompts for your case.

Common prompting mistakes

MistakeWhat happensBetter
Vague goalPlausible but unhelpful outputSay what done looks like
Rules without reasonsApplied too rigidly or ignored in new casesExplain the purpose
Only "do not" instructionsModel knows what to avoid, not what to doDescribe the wanted behavior
Shouting in capitalsOver-reaction to one ruleCalm, precise wording
Contradictory rulesUnpredictable choicesRemove conflicts; state priority
One narrow exampleCopies of the exampleSeveral varied examples
Everything in one promptImportant parts lostChain or route
No way outInvented answersAllow "not found" and hand over
Assuming shared knowledgeWrong internal termsDefine terms and give context
Security by promptBypassed by hostile inputEnforce limits in code
Untested editsFixes one case, breaks othersRun the regression set

A method for debugging prompts

  1. Read the exact rendered request, including tool definitions and history.
  2. Ask whether a capable person could do the task from that text alone.
  3. Reproduce the failure several times to see how often it happens.
  4. Change one thing, ideally by removing or clarifying before adding.
  5. Run the whole test set and compare case by case.
  6. Record what you changed and why.

If clear instructions and correct information still fail, the limit may be the model, the tool design or the data. Fine-Tuning vs RAG vs Prompting vs Long Context helps decide.

Illustrative example: the growing prompt

An invented support prompt gains a new warning after every complaint until it runs to several pages with conflicting rules. The team groups the rules by case type, adds a routing step, gives each route a short prompt, and moves refund limits into code. Reviewing and testing each route becomes manageable.

Chains multiply small error rates

If five independent steps each succeed 95% of the time, the whole chain succeeds about 77% of the time. Gates, retries and fewer steps all help. See Agent Limits, Myths and When Not to Use One.

Prefer code for exact work

Sorting, arithmetic, filtering and format conversion belong in functions. Each step removed from the model is a step that needs no prompt, costs almost nothing and cannot drift.

From symptom to fix

You observeLook at first
Output ignores a ruleConflicting rules, rule buried in the middle, no reason given
Answers are genericMissing context about audience, goal and data
Replies copy an exampleToo few or too similar examples
Facts are inventedMissing source material; no permitted "not found" answer
A later step goes wrongWhat the previous step passed on
Works in testing, fails liveDifferences in tools, history or input length
Behavior changed overnightModel version, tool definitions, retrieved content

Work down only one row at a time and confirm the cause before editing. A fix aimed at the wrong cause adds words to the prompt, hides the real fault and makes the next investigation harder.

Checklist

  • Each chain step has one job and a check.
  • Identifiers and figures come from sources.
  • Domain prompts state evidence rules and handover cases.
  • Permissions are enforced outside the prompt.
  • Every served language has its own test cases.
  • Prompt changes run against the regression set.

Frequently asked questions

Is chaining slower and more expensive?

It uses more calls, but each can be smaller and some can use cheaper models. Compare total cost per correct result.

Should I write prompts in English for non-English users?

It can work well, but do not assume it. Test instructions in both forms with native reviewers.

How long may a prompt be?

As long as needed to give clear, relevant instructions and no longer. Remove rules that tests show to have no effect.

References and further reading

Next steps