prompt-engineer について
LLM アプリケーションやエージェントを開発する人向けのプロンプトエンジニアリングスキルです。出力の調整やトークン使用量の管理に役立つ設計手法、テンプレート、テスト方法を扱います。
主な機能
- 01役割とタスクの設定
- 02思考過程を促すプロンプト
- 03少数例による指示
- 04構造化出力形式
- 05プロンプトのテストとトークン追跡
活用シーン
- 01システムプロンプトの作成
- 02出力の一貫性向上
- 03エージェント用テンプレートの作成
- 04トークン使用量の削減
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ htlin222/ dotfiles --skill prompt-engineerインストール後、Claude Code で/prompt-engineerを入力して読み込まれたか確認します。
詳細
プロンプトエンジニアリング
LLM アプリケーション向けの効果的なプロンプトを作成します。
使用する場面
- システムプロンプトの作成
- AI の出力品質の向上
- AI エージェントの構築
- トークン使用量の最適化
- プロンプトテンプレートの設計
主な手法
役割の設定
You are an expert [role] with [X] years of experience in [domain].
Your task is to [specific goal].
思考の連鎖
Think through this step by step:
1. First, analyze [aspect 1]
2. Then, consider [aspect 2]
3. Finally, determine [conclusion]
Show your reasoning before giving the final answer.
少数ショットの例
Here are examples of the expected format:
Input: [example 1 input]
Output: [example 1 output]
Input: [example 2 input]
Output: [example 2 output]
Now process this input:
Input: {user_input}
Output:
構造化出力
Respond in the following JSON format:
{
"analysis": "your analysis here",
"confidence": 0.0-1.0,
"recommendations": ["item1", "item2"]
}
Return valid JSON only, no additional text.
プロンプトテンプレート
コードレビュー
You are a senior code reviewer. Review the code for:
1. Security vulnerabilities
2. Performance issues
3. Code quality and readability
4. Best practices violations
For each issue:
- Severity: Critical/High/Medium/Low
- Location: file:line
- Issue: description
- Fix: suggested solution
Code to review:
{code}
データ抽出
Extract the following information from the text:
- Name: person's full name
- Email: email address
- Company: organization name
- Role: job title
If information is not found, use "NOT_FOUND".
Return as JSON.
Text:
{text}
分類
Classify the following text into one of these categories:
- POSITIVE
- NEGATIVE
- NEUTRAL
Consider tone, sentiment, and overall message.
Respond with only the category name.
Text: {text}
Category:
ベストプラクティス
| 実践項目 | すること | 避けること |
|---|---|---|
| 指示 | 具体的かつ明確にする | 曖昧にする |
| 形式 | 出力形式を指定する | 形式を決めつける |
| 例 | 2~3 個の例を含める | 複雑なタスクで例を使わない |
| 制約 | 明確な境界を設ける | 範囲を限定しない |
| 長さ | 必要に応じて最大長を設定する | 無制限にする |
プロンプトのテスト
- エッジケースでテストする
- 敵対的な入力を試す
- 実行ごとの一貫性を確認する
- 出力品質を測定する
- トークン使用量を追跡する
例
入力:「要約用のプロンプトを作成してください」 **アクション:**長さの制約、重要なポイントの抽出、形式の指定を含むプロンプトを設計します
入力:「このプロンプトの出力を改善してください」 **アクション:**例を追加し、指示を明確にし、形式を指定して、反復的にテストします
コメント
Markdown 対応