本文へ移動
cccskills
無料GitHub で公開日本語紹介

prompt-engineering

目的や評価基準を先に定め、指示の明確化、例示、XMLタグ、役割設定などを使って、AIの回答を望む形式に近づけるプロンプトを設計するスキルです。

原文原文の説明を見る

Prompt engineering best practices - invoke with @prompt-engineering

trycompai/compスター 2,058(GitHub 2,058 + cccskills 0)

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • AIへの指示を具体化したいとき
  • 回答形式を例で示したいとき
  • 複雑な依頼の背景や条件を整理したいとき
  • プロンプトの効果を評価して改善したいとき

日本語での紹介

できること

AIに頼みたい作業の成功条件や評価方法を決め、指示文を試しながら改善するための考え方をまとめたスキルです。作業内容を明確に書き、出力形式や文字数、対象読者、含める内容と除外する内容を指定する方法を扱います。入力と出力の例を示す方法、複雑な課題で段階的な検討を促す方法、<context>や<task>などのXMLタグで情報を整理する方法も説明します。役割や専門性、話し方を指定する方法や、回答の書き出しを与えて形式を導く方法も含まれます。プロンプトを調整するか、追加の学習(ファインチューニング)を行うかを考える際の観点も示します。

こんなときに便利

AIの回答が曖昧で、指示を具体化したいときに役立ちます。分類や要約などで、望む形式の例を示したい場合にも使えます。複数の条件や背景情報を整理して伝えたい人、数値や論理を含む複雑な依頼の指示を工夫したい人にも向いています。

使い方の例

  • 「記事の要約を3つの箇条書きで返すプロンプトに整えて」
  • 「分類結果の形式を例示するプロンプトを作って」
  • 「背景、作業、出力形式を分けた指示文にして」

注意点

特記事項はありません。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md5.3 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Source Cursor rule: .cursor/rules/prompt-engineering.mdc. Original file scope: .cursor/rules/*.mdc. Original Cursor alwaysApply: false.

Prompt Engineering Best Practices

Based on Claude's Prompt Engineering Documentation

Core Principles

1. Define Success Criteria First

Before writing prompts:

  • Establish clear objectives: What constitutes a successful response?
  • Create evaluation metrics: How will you measure prompt effectiveness?
  • Draft and iterate: Start with a first draft and refine based on results

2. When to Use Prompt Engineering vs Fine-tuning

Prompt engineering is preferred because:

  • Resource efficient: Only requires text input, no GPUs
  • Cost effective: Uses base model pricing
  • Maintains updates: Works across model versions
  • Time saving: Instant results vs hours/days for fine-tuning
  • Minimal data needs: Works with zero-shot or few-shot
  • Flexible iteration: Quick experimentation cycle
  • Preserves knowledge: No catastrophic forgetting
  • Transparent: Human-readable, easy to debug

The 6 Core Techniques

1. Be Clear and Direct

Principle: Provide explicit, unambiguous instructions.

❌ Bad: "Tell me about it"
✅ Good: "Summarize the following article in three bullet points, focusing on key findings"

❌ Bad: "Help with code"
✅ Good: "Debug this Python function that should return the sum of even numbers in a list"

Tips:

  • State the task explicitly at the start
  • Specify the desired output format (bullet points, JSON, paragraphs)
  • Include constraints (word count, tone, audience)
  • Mention what to include AND what to exclude

2. Use Examples (Multishot Prompting)

Principle: Show the model what you want through examples.

<examples>
  <example>
    <input>The movie was absolutely terrible, waste of time</input>
    <output>{"sentiment": "negative", "confidence": 0.95}</output>
  </example>
  <example>
    <input>Decent film, not great but watchable</input>
    <output>{"sentiment": "neutral", "confidence": 0.7}</output>
  </example>
  <example>
    <input>Best movie I've seen this year!</input>
    <output>{"sentiment": "positive", "confidence": 0.9}</output>
  </example>
</examples>

Now analyze: "The special effects were amazing but the plot was confusing"

Tips:

  • Include 3-5 diverse examples covering edge cases
  • Show examples of BOTH good and bad outputs
  • Match example complexity to your actual use case
  • Order examples from simple to complex

3. Let Claude Think (Chain of Thought)

Principle: Encourage step-by-step reasoning for complex tasks.

<instruction>
Solve this problem step by step. Show your reasoning before giving the final answer.
</instruction>

<problem>
A train leaves Station A at 9:00 AM traveling at 60 mph. Another train leaves
Station B at 10:00 AM traveling at 80 mph toward Station A. The stations are
280 miles apart. When will the trains meet?
</problem>

<thinking>
[Let Claude work through the problem here]
</thinking>

<answer>
[Final answer after reasoning]
</answer>

Tips:

  • Use phrases like "Think step by step" or "Explain your reasoning"
  • For complex tasks, explicitly request a thinking section
  • Chain of thought improves accuracy on math, logic, and multi-step problems
  • Can use <thinking> tags to separate reasoning from output

4. Use XML Tags

Principle: Structure prompts with clear delimiters for better parsing.

<context>
You are helping debug a penetration testing tool that automates security scans.
</context>

<task>
Analyze the following error log and identify the root cause.
</task>

<error_log>
[2024-01-15 10:23:45] ERROR: Connection timeout after 30s
[2024-01-15 10:23:45] DEBUG: Target: 192.168.1.1:443
[2024-01-15 10:23:45] DEBUG: Retry attempt 3 of 3
</error_log>

<output_format>
Provide your analysis in this format:
- Root cause: [one sentence]
- Evidence: [relevant log lines]
- Recommended fix: [actionable steps]
</output_format>

Common XML Tags:

  • <context> - Background information
  • <task> or <instruction> - What to do
  • <examples> - Sample inputs/outputs
  • <constraints> - Limitations or rules
  • <output_format> - Expected response structure
  • <thinking> - Reasoning section
  • <answer> - Final response

5. Give Claude a Role (System Prompts)

Principle: Assign a persona to influence response style and expertise.

<role>
You are a senior security researcher with 15 years of experience in penetration
testing. You specialize in web application security and have discovered multiple
CVEs. You communicate findings clearly and prioritize actionable recommendations.
</role>

<task>
Review this HTTP response and identify potential security vulnerabilities.
</task>

Effective Role Elements:

  • Expertise level (senior, expert, specialist)
  • Domain knowledge (security, finance, medicine)
  • Communication style (technical, friendly, formal)
  • Priorities (accuracy, brevity, thoroughness)

6. Prefill Claude's Response

Principle: Start the response to guide format and direction.

Human: List the top 3 security vulnerabilities in this code.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

api-endpoint-contract

無料概要あり

APIエンドポイントの追加・変更で、DTO、入力検証、OpenAPI仕様、MCPツールの説明や公開範囲を揃え、エージェントからも扱いやすいAPIに整えます。

  • APIエンドポイントを追加したいとき
  • DTOと入力検証を整えたいとき
  • MCPツールとしてAPIを公開したいとき
trycompai/comp2,0582026年10月24日 更新

audit-design-system

無料概要あり

既存コードのデザインシステム利用状況を調べ、旧UI部品やlucide-reactのアイコンを@trycompai/design-systemの部品・Carbonアイコンへ置き換えるスキルです。

  • 旧UI部品を移行したいとき
  • アイコンをCarbonに置き換えたいとき
  • 画面のデザインシステム準拠を確認するとき
trycompai/comp2,0582026年10月24日 更新

audit-hooks

無料概要あり

指定されたファイルのフックやAPI利用を点検し、禁止パターンをSWRやapiClientなどの指定方式へ修正するための監査手順と実装規約をまとめています。

  • 既存コードのAPI利用を点検したいとき
  • 生のfetchをapiClientに置き換えたいとき
  • 更新処理をSWRのmutateにそろえたいとき
trycompai/comp2,0582026年10月24日 更新

audit-rbac

無料概要あり

NestJSのAPIとフロントエンドを調べ、権限チェックや監査ログのルール違反を修正するための確認項目を示します。

  • APIの権限チェックを点検したいとき
  • 画面操作の権限制御を確認したいとき
  • RBAC違反を修正したいとき
trycompai/comp2,0582026年10月24日 更新

audit-tests

無料概要あり

権限で表示や操作が変わるコンポーネントの単体テストを点検し、不足分の追加や失敗の修正を行って、管理者と閲覧専用ユーザーの動作を確かめます。

  • 権限別の単体テストを追加したいとき
  • 管理者と監査ユーザーの表示を検証したいとき
  • 失敗する権限テストを修正したいとき
trycompai/comp2,0582026年10月24日 更新

better-auth-best-practices

無料概要あり

Better Authを使ったTypeScript認証の設定を支援し、データベース接続、セッション管理、メール認証、OAuth、プラグインやセキュリティ項目を整理します。

  • Better Authで認証を導入したいとき
  • DBやORMアダプターを接続したいとき
  • セッションの保存方法を設定したいとき
trycompai/comp2,0582026年10月24日 更新

trycompai のスキルをすべて見る

このスキルの問題を報告する