mcpField
S
system-prompt-engineering

system-prompt-engineering

github.com/melodic-softwareエージェントワークフロー28170 回インストール今日更新
リポジトリ

system-prompt-engineering について

カスタムエージェントの役割、専門性、継続的な規則、境界を定めるシステムプロンプト設計スキルです。例の作成や検証を含む設計手順を示します。

主な機能

  1. 01エージェントの役割と専門性の定義
  2. 02継続的な規則と境界の設定
  3. 03主要シナリオの例の設計
  4. 04プロンプトの明確さと網羅性の検証
  5. 05システムプロンプトとユーザープロンプトの区別

活用シーン

  1. 01特化型カスタムエージェントの作成
  2. 02エージェントの継続的な振る舞いの設定
  3. 03システムプロンプトの不足点の確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/melodic-software/claude-code-plugins --skill system-prompt-engineering

インストール後、Claude Code で/system-prompt-engineeringを入力して読み込まれたか確認します。

詳細

システムプロンプトエンジニアリングスキル

カスタムエージェントのアイデンティティ、ルール、振る舞いを確立する、効果的なシステムプロンプトを設計します。

目的

すべての会話を通じてエージェントの振る舞いを形作るシステムプロンプトを作成します。システムプロンプトは、ユーザープロンプトよりも桁違いに重要です。

使用するタイミング

  • 新しいカスタムエージェントを作成するとき
  • エージェントの専門性を確立するとき
  • 永続的なルールを定義するとき
  • 特化したアシスタントを構築するとき

システムプロンプトとユーザープロンプト

項目システムプロンプトユーザープロンプト
適用範囲すべての会話単一のタスク
持続性あらゆる内容に影響リクエストごと
影響度桁違いに高い影響範囲が小さい
セクション目的、指示、例すべてのセクション

主なセクション

目的(必須)

エージェントが何者で、何をするのかを定義します。

## Purpose

You are a security expert specializing in code review.
Your role is to identify vulnerabilities and suggest fixes.
You focus on OWASP Top 10 and secure coding practices.

ガイドライン:

  • 直接的で明確なアイデンティティの説明
  • 具体的な専門分野
  • エージェントが行うこと
指示(推奨)

ルール、制約、境界を定めます。

## Instructions

- Focus only on security concerns
- Always explain the reasoning behind findings
- Prioritize issues by severity (Critical, High, Medium, Low)
- Do not modify code without explicit permission
- When uncertain, ask clarifying questions

ガイドライン:

  • 明確さを保つために箇条書きを使う
  • 肯定的なルールと否定的なルール
  • エッジケースへの対応
  • 境界の定義
例(重要)

具体的な例を通じて振る舞いを形作ります。

## Examples

### Example 1: SQL Injection Finding
**Input:** "Review this login function"
**Output:** "Found SQL injection vulnerability at line 42. The user input is directly concatenated into the query string. Recommendation: Use parameterized queries instead."

### Example 2: Out of Scope Request
**Input:** "Fix this CSS styling issue"
**Output:** "That's outside my security focus. I specialize in security vulnerabilities, not styling. Consider consulting a frontend expert for CSS issues."

### Example 3: Clean Code
**Input:** "Check this authentication module"
**Output:** "Reviewed the authentication module. No security vulnerabilities found. The code follows secure practices: uses parameterized queries, hashes passwords with bcrypt, and implements rate limiting."

ガイドライン:

  • 多様な例を2〜4件用意する
  • よくあるケースを網羅する
  • エッジケースを含める
  • 望ましい出力形式を示す

設計プロセス

ステップ1:エージェントのアイデンティティを定義する

次の質問に答えます。

  • このエージェントにはどのような専門知識がありますか?
  • どの分野で動作しますか?
  • 主な目的は何ですか?
  • どのような口調を使うべきですか?
ステップ2:境界を定める

次の質問に答えます。

  • エージェントは何をするべきですか?
  • エージェントがしてはいけないことは何ですか?
  • どのような場合に確認を求めるべきですか?
  • どのような制約がありますか?
ステップ3:例を作成する

重要なシナリオごとに、次の点を検討します。

  • 典型的な入力は何ですか?
  • 理想的な出力は何ですか?
  • エッジケースにはどのように対応するべきですか?
ステップ4:設計を検証する

次の点を確認します。

  • 目的が明確かつ具体的である
  • 指示に曖昧さがない
  • 例が重要なシナリオを網羅している
  • 境界が明確に定義されている
  • 口調に一貫性がある

避けるべきこと

避けること理由代わりに
詳細なワークフロー自律性を損なう大まかなガイドライン
動的な変数システムプロンプトは静的ユーザープロンプトを使う
規定しすぎた形式制約が強くなりすぎる柔軟なガイドライン
「念のため」の情報をすべて含めるコンテキストが膨らむ必要なものだけにする

システムプロンプトの構成

---
name: agent-name
description: When to use this agent (for auto-delegation)
tools: [minimal tool set]
model: sonnet
color: blue
---

# Agent Name

## Purpose
[Identity and role definition]

## Instructions
[Rules and constraints]

## Examples

### Example 1: [Scenario]
**Input:** [typical input]
**Output:** [ideal output]

### Example 2: [Edge Case]
**Input:** [edge case input]
**Output:** [handling output]

### Example 3: [Boundary]
**Input:** [out-of-scope request]
**Output:** [how to decline/redirect]

出力形式

システムプロンプトを設計するときは、次の形式を使います。

## System Prompt Design

**Agent Name:** [name]
**Domain:** [expertise area]
**Model:** [sonnet/opus/haiku]

### Purpose
[2-3 sentences defining identity]

### Instructions
- [rule 1]
- [rule 2]
- [rule 3]

### Examples

**Example 1:** [scenario]
- Input: [input]
- Output: [output]

**Example 2:** [scenario]
- Input: [input]
- Output: [output]

### Validation
- [ ] Purpose is specific
- [ ] Instructions are actionable
- [ ] Examples are diverse
- [ ] Boundaries are clear

よくあるエージェントの種類

エキスパートエージェント

重点:深い専門知識

## Purpose
You are an expert in [domain] with deep knowledge of [specifics].
ガードエージェント

重点:検証と安全性

## Instructions
- Validate all inputs against [criteria]
- Block requests that [conditions]
- Log suspicious activity
翻訳エージェント

重点:形式の変換

## Examples
### Input Format
[format A]

### Output Format
[format B]

重要な引用

「システムプロンプトは、ユーザープロンプトよりも桁違いに重要です。システムプロンプトは一度実行され、あらゆる内容に影響します。」

関連項目

  • @system-vs-user-prompts.md - 違いとベストプラクティス
  • @agent-expert-creation skill - エキスパートエージェントの作成
  • @one-agent-one-purpose.md - 特化の原則

バージョン履歴

  • v1.0.0 (2025-12-26):初回リリース

最終更新

日付: 2025-12-26 モデル: claude-opus-4-5-20251101

コメント