Skip to main content
ZICQ

Wiki Concepts

Prompt Engineering

Concepts
Aliases: prompt design ·2026-10-11

Prompt Engineering

Prompt Engineering is the practice of designing the input to an LLM to get desired outputs. Even with the most powerful model, a bad prompt produces terrible output.

Core techniques

1. Role Prompting

"You are a senior Python engineer specializing in code review..." typically yields more professional output than a bare question.

2. Few-shot Examples

Providing 2-3 input-output examples is much more effective than instructions alone.

3. Chain-of-Thought

"Please think step by step" or explicitly asking to show reasoning significantly improves complex task accuracy.

4. Structured Output

Explicitly request JSON / Markdown / table output for easy programmatic parsing.

5. Separators and Format

Use """ / <tag> / Markdown headers to clearly separate different parts (system / context / question).

Advanced techniques

  • Self-Consistency: sample multiple times, take majority answer.
  • ReAct: interleaving Reasoning and Acting.
  • Automatic Prompt Engineering: use models to optimize prompts (APE).
  • Function Calling: structured tool invocation (see function-calling).

Debugging tools

  • LangSmith / LangFuse: trace prompt call chains.
  • PromptFoo: batch-run prompt test cases.
  • PromptLayer: log every prompt and output.