一行要約
Claude 非依存の一般論。最も価値があるのは「問題 → 対処」のトラブルシューティング表と、「もう古い技法」の名指し(重い XML タグ、role prompting)。
The best prompt isn’t the longest or most complex. It’s the one that achieves your goals reliably with minimum necessary structure. 最良のプロンプトは、最も長いものでも最も複雑なものでもない。必要最小限の構造で、目的を確実に達成するものである。
要点
Prompt engineering is the craft of structuring instructions to get better outputs from AI models. prompt engineering とは、AI モデルからより良い出力を得るために指示を構造化する技芸である。
中核の4技法
- 明示的かつ明確に — 直接的な動作動詞で曖昧さを消す
- 文脈と動機を与える — 「なぜ」を説明すると、モデルが目的を理解できる
- 具体的に — 制約、文脈、構造、要件を含める
- 例を使う — one-shot / few-shot で形式の期待を明確にする
発展的な技法
- prefill による形式制御(Claude 4.6 以降では非対応。increase-consistency 参照)
- chain of thought
- prompt chaining
- 出力形式の制御
トラブルシューティング表(この記事で最も実用的)
| 問題 | 対処 |
|---|---|
| 出力が一般的すぎる | 具体性を足す、例を足す、網羅的な出力を要求する |
| 話が逸れる | 実際の目的を明示する、文脈を与える |
| 形式が一貫しない | few-shot 例を足す、または prefill |
| タスクが複雑すぎる | 複数のプロンプトに分割する(chaining) |
| 不要な前置きが付く | prefill、または直接答えるよう明示的に要求する |
| hallucination | 「わからない」と言う許可を明示的に与える |
| 頼んでいない提案が来る | 行動について明示する(“Suggest changes” ではなく “Change this”) |
避けるべき間違い
- 不要な複雑さによる過剰設計
- 発展的な技法を追って基本を無視する
- AI が心を読むと仮定する(具体的に書く)
- すべての技法を同時に使う
- 反復と洗練を飛ばす
- 古くなった技法に頼る(重い XML タグ、role prompting)
Prompt engineering is ultimately about communication: speaking the language that helps AI most clearly understand your intent. prompt engineering は突き詰めれば伝達の問題である。自分の意図を AI が最も明確に理解できる言葉で語ることだ。
そのまま使える具体例
明示的に書く:
❌ Create an analytics dashboard
✅ Create an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation.文脈と動機を与える(理由を書くと一般化できる):
❌ NEVER use bullet points
✅ I prefer responses in natural paragraph form rather than bullet points because I find flowing prose easier to read and more conversational.具体的に書く:
❌ Create a meal plan for a Mediterranean diet
✅ Design a Mediterranean diet meal plan for pre-diabetic management. 1,800 calories daily, emphasis on low glycemic foods. List breakfast, lunch, dinner, and one snack with complete nutritional breakdowns.不確実性を認める許可(hallucination 対策):
Analyze this financial data and identify trends. If the data is insufficient to draw conclusions, say so rather than speculating.chain of thought:
Think step-by-step before you write the email.形式の制御:
Your response should be composed of smoothly flowing prose paragraphs... Reserve markdown primarily for inline code, code blocks, and simple headings. DO NOT use ordered lists or unordered lists unless...原典で言及されている関連文書
- claude-prompting-best-practices — Claude 固有の技法の living reference
- prompt-engineering-overview — 始める前の前提
- effective-context-engineering-for-ai-agents — context engineering
- reduce-hallucinations — 「わからない」と言う許可の詳細
- increase-consistency — prefill の代替