AI Prompting Mastery

Clear Instructions and Structure

30 分钟

Be specific and say why

Instructions work best when they include the reason. "Keep answers short" is vague; "Keep answers under 80 words because they display in a small mobile card" lets the model make good decisions in cases you did not foresee.

Tell it what to do, not only what to avoid

Instead of Write
"Don't use jargon." "Write for a small-business owner with no technical background."
"Don't be long." "Answer in 3 sentences."
"No markdown." "Write plain paragraphs suitable for an email body."

Structure long prompts

Separate instructions from material with headings or XML-style tags. Models handle tagged sections reliably, and you can refer to them by name.

You are reviewing a client contract for a freelance web developer.

<contract>
{{CONTRACT_TEXT}}
</contract>

<instructions>
1. List every clause about payment terms, ownership of code and liability.
2. For each, quote the clause and explain the risk to the developer in one sentence.
3. Suggest a fairer rewording where the risk is high.
</instructions>

Answer inside <review> tags, one <clause> block per item.

Put long documents first, the question last

With long inputs, place the documents at the top and your question or instructions at the end. It tends to improve accuracy on long-context tasks.

Specify the output format precisely

Return JSON only, matching:
{"sentiment": "positive" | "neutral" | "negative", "reason": string (max 20 words)}

When you build apps, use the API's structured output features (covered in Claude & GPT Integration) so the format is guaranteed rather than requested.

Roles and system prompts

A system prompt sets stable context for a whole conversation: who the assistant is, the audience, rules and format.

You are PandaDev's learning assistant. You help beginners with Python and web
development. Explain concepts with short examples. If a question is outside
programming, say so politely and suggest where to look.

Keep it focused on what the model needs to know; a role line plus clear context beats a long list of rules in capital letters.

Avoid over-shouting

Older advice used "IMPORTANT!!!" and "NEVER" everywhere. Modern models follow calm, clear instructions well; aggressive emphasis can make them over-apply a rule in situations where it does not fit. Use emphasis sparingly, for the one or two things that truly matter.

Exercise

Rewrite this prompt to be specific, structured and format-explicit: "Summarise these customer reviews." Include where the reviews go, who the summary is for, length and the exact output format.

Check yourself

  • Why does explaining the reason behind an instruction help?
  • Where should long documents go relative to the question?
  • Why separate instructions from material with tags?

你的进度只保存在此浏览器中。

提交审核(10 积分)