Best Practice of Crafting Prompts

Table of Contents

1. Claude's Prompt Engineering Course

1.1. Tips

  1. Being Clear and Direct: Claude responds best to clear and direct instructions.
  2. Assigning Role Prompting: Continuing on the theme of Claude having no context aside from what you say, it's sometimes important to prompt Claude to inhabit a specific role (including all necessary context). This is also known as role prompting. The more detail to the role context, the better.
  3. Separating Data and Instructions (This is for prompt template)
  4. Formatting Output and Speaking for Claude
  5. Precognition: Thinking Step by Step
    1. Order is important for prompts.
    2. Choice is better for only a QA.
  6. Using Examples for Fewshot Prompting
  7. Considering Hallucinations
    1. If it is difficult, "give LLMs an out". Tell it it's okay to decline
    2. The question should be at the bottom.
    3. Using CoT, let LLMs strictly mine something from documents

1.2. The Order and Elements for a Complex Prompt

  1. ROLE information
  2. TONE information
  3. Detailed TASK description and rules
  4. Examples
  5. Detailed INPUT description
  6. Remind LLM the TASK shown in 3, and tell LLMs how to respond to user's questions
  7. Detailed OUTPUT formatting

Note that the order and elements can be flexible, such as:

  1. Point 3 can be merged by point 6
  2. You can add the CoT (thinking step by step before point 7)

Author: Zi Liang (zi1415926.liang@connect.polyu.hk) Create Date: Tue Jun 3 14:40:26 2025 Last modified: 2025-06-03 Tue 21:15 Creator: Emacs 30.1 (Org mode 9.7.11)