← Blog

AI Engineering

Advanced Prompt Engineering Techniques: Chain of Thought, Roles, and Structured Outputs

Go beyond basic prompts: chain-of-thought, self-critique, tool-aware prompting, JSON schemas, and multi-step workflows that raise accuracy for complex tasks.

AAuroviq··3 min read
Advanced Prompt Engineering Techniques: Chain of Thought, Roles, and Structured Outputs

Once basic prompts work, hard tasks need reasoning scaffolds and machine-readable outputs. Advanced prompt engineering is less about secret phrases and more about decomposing work the way a careful analyst would.

Start with prompt fundamentals if you are new.

Chain of thought (CoT)

Ask the model to reason step by step before the final answer for math, multi-hop analysis, and planning. In production, prefer hidden reasoning patterns your provider supports, or ask for a short “reasoning summary” if you must log explanations for humans.

Think through the problem in numbered steps.
Then provide Final answer: … in one line.

Caution: long CoT increases tokens/cost and can leak sensitive intermediate thoughts into logs—redact carefully.

Self-critique and dual-pass prompts

  1. Generate a draft
  2. Critique against a checklist (accuracy, tone, policy)
  3. Revise

Two-pass flows often beat one giant mega-prompt for quality writing, code review, and compliance checks.

Role specialization

Instead of “be helpful,” assign a narrow expert role with decision rights: “You are a staff SRE reviewing a runbook for production safety. Prefer conservative changes.” Roles bias style and risk tolerance.

Structured outputs (JSON / schemas)

For software systems, free text is a bug. Prefer:

  • Provider JSON mode / schema-constrained decoding when available
  • Explicit schema in the prompt with types and enums
  • Validation in code (Zod, Pydantic, JSON Schema) with repair loops
Return ONLY valid JSON matching:
{
  "priority": "P0"|"P1"|"P2",
  "summary": string,
  "actions": string[]
}
No markdown fences.

Tool-aware and ReAct-style prompting

When the model can call tools (search, DB, tickets), instruct: reason → choose tool → observe → answer. Never invent tool results. Production agents need hard validation around tool arguments—see production agents.

Decomposition patterns that scale

  • Map-reduce — chunk long docs, summarize parts, then merge
  • Plan-then-execute — outline steps, then run each step with focused prompts
  • Router — classify intent, then send to specialized prompt

When advanced techniques hurt

  • Simple extraction tasks (overthinking adds errors)
  • Latency-sensitive UX (prefer smaller models + short prompts)
  • Unvalidated CoT used as legal or medical advice

Frequently asked questions

Should every prompt say “think step by step”?

No. Use CoT for multi-step reasoning; skip it for formatting and straightforward transforms.

Is few-shot always better?

Usually for classification and style matching. Poor examples teach the wrong pattern—curate carefully.

Work with Auroviq

Auroviq (AuroviQ) builds production AI features, agent workflows, and LLM integrations for product companies in the UK, Netherlands, Singapore, and India. We combine prompt design with architecture, evals, and secure delivery—not demos that break in production.

Tags

advanced prompt engineeringchain of thoughtJSON modeLLM techniquesReActstructured output

Next step

Building AI products that ship?

AuroviQ helps teams design, build, and scale reliable software and AI systems — from mobile apps to enterprise platforms.