Skip to main content

Prompt Engineering

Prompt engineering is the practice of designing model inputs, instructions, examples, context, tool access, and output contracts so that an AI system behaves predictably enough for the intended task. It is not a collection of magic phrases. Modern prompting is closer to interface and workflow design: make the goal explicit, provide the information that changes the decision, define observable success criteria, and test the result.

This guide was reorganized from the supplied Persian Prompt Engineering v4 training booklet and reviewed against current model/API guidance on 2026-08-10. Historical techniques from the booklet are retained where they are still useful, but they are separated from current production guidance.

Learning path

Foundations

  1. Fundamentals — what prompts are, how model context works, and how instruction roles differ.
  2. Writing effective prompts — goal, context, constraints, output contracts, uncertainty handling, and acceptance criteria.

Techniques

  1. Prompt patterns — zero-shot, few-shot, examples, decomposition, critique, extraction, and tool-assisted patterns.
  2. Reasoning and agent patterns — Chain-of-Thought, self-consistency, ReAct, and Tree of Thoughts as historical/research patterns, plus safer modern guidance for reasoning models.

Systems and workflows

  1. Prompt systems and orchestration — workflow vs. agent-driven control, skills, manager/handoff patterns, context isolation, and structured handoffs.
  2. Clarification and verification loops — readiness gates, clarify-before-execute, bounded repair loops, stop conditions, and runtime verification.

Production and APIs

  1. API and model controls — OpenAI Responses API, message roles, Structured Outputs, tools, reasoning effort, sampling controls, and version pinning.
  2. Context and grounding — context windows, conversation state, ChatGPT memory, tools, and Retrieval-Augmented Generation (RAG).
  3. Security — prompt injection, system-prompt leakage, least privilege, output validation, and human approval for high-risk actions.

Examples and practice

  1. Templates and examples — reusable templates for teaching, summarization, debugging, support, RAG, extraction, and engineering handoff.
  2. Evaluation — eval sets, rubrics, regression testing, adversarial cases, and prompt versioning.
  3. Exercises — practical exercises with suggested answers.
  4. Glossary and references — terminology, research papers, and current operational references.

Repository relationship

Reusable prompt assets belong under prompts/. Documentation in this section explains how to design and evaluate them; production prompt files should remain versioned assets with explicit ownership, consumers, and acceptance tests.

Core principle

A good prompt should reduce unnecessary guessing, but prompt wording alone cannot guarantee correctness, security, authorization, or factuality. Those properties require model choice, grounded data, deterministic application controls, tool permissions, validation, and evaluation.