jpskill.com
🛠️ 開発・MCP コミュニティ

mcp-prompts-guide

Create powerful MCP prompts that guide AI interactions with templates, arguments, and context injection

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o mcp-prompts-guide.zip https://jpskill.com/download/19018.zip && unzip -o mcp-prompts-guide.zip && rm mcp-prompts-guide.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19018.zip -OutFile "$d\mcp-prompts-guide.zip"; Expand-Archive "$d\mcp-prompts-guide.zip" -DestinationPath $d -Force; ri "$d\mcp-prompts-guide.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して mcp-prompts-guide.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → mcp-prompts-guide フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] mcp-prompts-guide あなたは rmcp クレートを使った MCP プロンプト作成のエキスパートであり、プロンプト設計、テンプレートシステム、コンテキスト管理の知識を持っています。

あなたの専門知識

あなたは開発者に以下のことについて指導します。

  • プロンプトの設計とテンプレート
  • 動的な引数処理
  • コンテキスト注入パターン
  • マルチターン会話
  • プロンプトの連鎖
  • プロンプトのテスト

MCP プロンプトとは何ですか?

プロンプトは、AI との対話をガイドするために MCP サーバーが提供する、事前に定義されたメッセージテンプレートです。これらは、ユーザーが適切なコンテキストと構造で会話を開始するのに役立ちます。

プロンプトの特性

  • テンプレート化されている: 動的な値にプレースホルダーを使用します
  • コンテキストに依存する: 関連情報を含みます
  • 実行可能である: 特定のタスクへと導きます
  • 再利用可能である: 複数の会話で機能します
  • 発見可能である: ユーザーが選択できるようにリスト表示されます

プロンプトの実装

基本的なプロンプト構造

use rmcp::prelude::*;
use serde::{Deserialize, Serialize};
use schemars::JsonSchema;

#[derive(Clone)]
struct PromptService;

impl PromptService {
    async fn list_prompts(&self) -> Vec<PromptInfo> {
        vec![
            PromptInfo {
                name: "analyze_code".to_string(),
                description: Some("Analyze code for issues and improvements".to_string()),
                arguments: vec![
                    PromptArgument {
                        name: "language".to_string(),
                        description: Some("Programming language".to_string()),
                        required: true,
                    },
                    PromptArgument {
                        name: "focus".to_string(),
                        description: Some("Focus area (performance, security, style)".to_string()),
                        required: false,
                    },
                ],
            },
        ]
    }

    async fn get_prompt(
        &self,
        name: &str,
        arguments: HashMap<String, String>,
    ) -> Result<PromptResponse, Error> {
        match name {
            "analyze_code" => {
                let language = arguments.get("language")
                    .ok_or_else(|| Error::MissingArgument("language".to_string()))?;
                let focus = arguments.get("focus").map(|s| s.as_str()).unwrap_or("general");

                let messages = vec![
                    PromptMessage {
                        role: Role::User,
                        content: format!(
                            "I need you to analyze {} code with a focus on {}. \
                             Please review the code carefully and provide:\n\
                             1. Issues found\n\
                             2. Recommendations\n\
                             3. Code examples for improvements",
                            language, focus
                        ),
                    },
                ];

                Ok(PromptResponse {
                    description: Some("Code analysis prompt".to_string()),
                    messages,
                })
            }
            _ => Err(Error::PromptNotFound(name.to_string())),
        }
    }
}

プロンプト設計パターン

パターン 1: コードレビュープロンプト

impl PromptService {
    fn create_code_review_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
        let language = args.get("language").map(|s| s.as_str()).unwrap_or("any");
        let file_path = args.get("file_path");

        let mut context = format!(
            "You are an expert code reviewer for {} projects.\n\n",
            language
        );

        if let Some(path) = file_path {
            context.push_str(&format!("File: {}\n\n", path));
        }

        context.push_str(
            "Please review the code for:\n\
             - Bugs and logic errors\n\
             - Performance issues\n\
             - Security vulnerabilities\n\
             - Code style and best practices\n\
             - Test coverage gaps\n\n\
             Provide specific line numbers and actionable recommendations."
        );

        PromptResponse {
            description: Some("Comprehensive code review".to_string()),
            messages: vec![
                PromptMessage {
                    role: Role::User,
                    content: context,
                },
            ],
        }
    }
}

パターン 2: タスク固有のプロンプト

impl PromptService {
    fn create_api_design_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
        let api_type = args.get("api_type").map(|s| s.as_str()).unwrap_or("REST");
        let domain = args.get("domain").map(|s| s.as_str()).unwrap_or("general");

        PromptResponse {
            description: Some(format!("Design {} API for {}", api_type, domain)),
            messages: vec![
                PromptMessage {
                    role: Role::System,
                    content: format!(
                        "You are an expert API architect specializing in {} APIs.",
                        api_type
                    ),
                },
                PromptMessage {
                    role: Role::User,
                    content: format!(
                        "I need to design a {} API for a {} application.\n\n\
                         Please help me:\n\
                         1. Define the resource models\n\
                         2. Design the endpoints\n\
                         3. Specify request/response formats\n\
                         4. Consider authentication and authorization\n\
                         5. Plan for versioning and backwards compatibility\n\n\
                         Focus on best practices and industry standards.",
                        api_type, domain
                    ),
                },
            ],
        }
    }
}

パターン 3: インタラクティブな学習プロンプト

impl PromptService {
    fn create_learning_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
        let topic = args.get("topi
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

You are an expert in creating MCP prompts using the rmcp crate, with knowledge of prompt design, template systems, and context management.

Your Expertise

You guide developers on:

  • Prompt design and templates
  • Dynamic argument handling
  • Context injection patterns
  • Multi-turn conversations
  • Prompt chaining
  • Testing prompts

What are MCP Prompts?

Prompts are predefined message templates that MCP servers provide to guide AI interactions. They help users start conversations with the right context and structure.

Prompt Characteristics

  • Templated: Use placeholders for dynamic values
  • Contextual: Include relevant information
  • Actionable: Guide toward specific tasks
  • Reusable: Work across multiple conversations
  • Discoverable: Listed for user selection

Implementing Prompts

Basic Prompt Structure

use rmcp::prelude::*;
use serde::{Deserialize, Serialize};
use schemars::JsonSchema;

#[derive(Clone)]
struct PromptService;

impl PromptService {
    async fn list_prompts(&self) -> Vec<PromptInfo> {
        vec![
            PromptInfo {
                name: "analyze_code".to_string(),
                description: Some("Analyze code for issues and improvements".to_string()),
                arguments: vec![
                    PromptArgument {
                        name: "language".to_string(),
                        description: Some("Programming language".to_string()),
                        required: true,
                    },
                    PromptArgument {
                        name: "focus".to_string(),
                        description: Some("Focus area (performance, security, style)".to_string()),
                        required: false,
                    },
                ],
            },
        ]
    }

    async fn get_prompt(
        &self,
        name: &str,
        arguments: HashMap<String, String>,
    ) -> Result<PromptResponse, Error> {
        match name {
            "analyze_code" => {
                let language = arguments.get("language")
                    .ok_or_else(|| Error::MissingArgument("language".to_string()))?;
                let focus = arguments.get("focus").map(|s| s.as_str()).unwrap_or("general");

                let messages = vec![
                    PromptMessage {
                        role: Role::User,
                        content: format!(
                            "I need you to analyze {} code with a focus on {}. \
                             Please review the code carefully and provide:\n\
                             1. Issues found\n\
                             2. Recommendations\n\
                             3. Code examples for improvements",
                            language, focus
                        ),
                    },
                ];

                Ok(PromptResponse {
                    description: Some("Code analysis prompt".to_string()),
                    messages,
                })
            }
            _ => Err(Error::PromptNotFound(name.to_string())),
        }
    }
}

Prompt Design Patterns

Pattern 1: Code Review Prompts

impl PromptService {
    fn create_code_review_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
        let language = args.get("language").map(|s| s.as_str()).unwrap_or("any");
        let file_path = args.get("file_path");

        let mut context = format!(
            "You are an expert code reviewer for {} projects.\n\n",
            language
        );

        if let Some(path) = file_path {
            context.push_str(&format!("File: {}\n\n", path));
        }

        context.push_str(
            "Please review the code for:\n\
             - Bugs and logic errors\n\
             - Performance issues\n\
             - Security vulnerabilities\n\
             - Code style and best practices\n\
             - Test coverage gaps\n\n\
             Provide specific line numbers and actionable recommendations."
        );

        PromptResponse {
            description: Some("Comprehensive code review".to_string()),
            messages: vec![
                PromptMessage {
                    role: Role::User,
                    content: context,
                },
            ],
        }
    }
}

Pattern 2: Task-Specific Prompts

impl PromptService {
    fn create_api_design_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
        let api_type = args.get("api_type").map(|s| s.as_str()).unwrap_or("REST");
        let domain = args.get("domain").map(|s| s.as_str()).unwrap_or("general");

        PromptResponse {
            description: Some(format!("Design {} API for {}", api_type, domain)),
            messages: vec![
                PromptMessage {
                    role: Role::System,
                    content: format!(
                        "You are an expert API architect specializing in {} APIs.",
                        api_type
                    ),
                },
                PromptMessage {
                    role: Role::User,
                    content: format!(
                        "I need to design a {} API for a {} application.\n\n\
                         Please help me:\n\
                         1. Define the resource models\n\
                         2. Design the endpoints\n\
                         3. Specify request/response formats\n\
                         4. Consider authentication and authorization\n\
                         5. Plan for versioning and backwards compatibility\n\n\
                         Focus on best practices and industry standards.",
                        api_type, domain
                    ),
                },
            ],
        }
    }
}

Pattern 3: Interactive Learning Prompts

impl PromptService {
    fn create_learning_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
        let topic = args.get("topic").ok_or(Error::MissingArgument("topic".to_string())).unwrap();
        let level = args.get("level").map(|s| s.as_str()).unwrap_or("beginner");

        PromptResponse {
            description: Some(format!("Learn {} at {} level", topic, level)),
            messages: vec![
                PromptMessage {
                    role: Role::System,
                    content: format!(
                        "You are a patient and knowledgeable teacher of {}. \
                         Adapt your explanations to a {} level.",
                        topic, level
                    ),
                },
                PromptMessage {
                    role: Role::User,
                    content: format!(
                        "I want to learn about {}. I'm at a {} level.\n\n\
                         Please:\n\
                         1. Start with the fundamentals\n\
                         2. Provide clear examples\n\
                         3. Build complexity gradually\n\
                         4. Check my understanding as we go\n\
                         5. Suggest exercises\n\n\
                         Let's begin!",
                        topic, level
                    ),
                },
            ],
        }
    }
}

Pattern 4: Context-Rich Prompts

impl PromptService {
    async fn create_project_prompt(
        &self,
        args: &HashMap<String, String>,
        project_context: &ProjectContext,
    ) -> PromptResponse {
        let task = args.get("task").unwrap();

        let context = format!(
            "# Project Context\n\n\
             Project: {}\n\
             Language: {}\n\
             Framework: {}\n\
             Dependencies: {}\n\n\
             # Task\n\n\
             {}\n\n\
             # Guidelines\n\n\
             - Follow the project's existing patterns\n\
             - Maintain code style consistency\n\
             - Update tests and documentation\n\
             - Consider existing dependencies",
            project_context.name,
            project_context.language,
            project_context.framework,
            project_context.dependencies.join(", "),
            task
        );

        PromptResponse {
            description: Some(format!("Project task: {}", task)),
            messages: vec![
                PromptMessage {
                    role: Role::User,
                    content: context,
                },
            ],
        }
    }
}

Advanced Prompt Features

Multi-Turn Conversations

impl PromptService {
    fn create_debug_session_prompt(&self) -> PromptResponse {
        PromptResponse {
            description: Some("Interactive debugging session".to_string()),
            messages: vec![
                PromptMessage {
                    role: Role::System,
                    content: "You are an expert debugger. Help the user systematically \
                              identify and fix issues in their code.".to_string(),
                },
                PromptMessage {
                    role: Role::Assistant,
                    content: "I'll help you debug this issue. First, can you:\n\
                              1. Describe what you expected to happen\n\
                              2. Describe what actually happened\n\
                              3. Share any error messages\n\
                              4. Show the relevant code".to_string(),
                },
                PromptMessage {
                    role: Role::User,
                    content: "[User provides debugging information here]".to_string(),
                },
            ],
        }
    }
}

Prompt with Examples

impl PromptService {
    fn create_few_shot_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
        let task = args.get("task").unwrap();

        PromptResponse {
            description: Some("Task with examples".to_string()),
            messages: vec![
                PromptMessage {
                    role: Role::System,
                    content: "You help users by following the pattern shown in examples.".to_string(),
                },
                PromptMessage {
                    role: Role::User,
                    content: "Example 1: Convert 'hello world' to camelCase".to_string(),
                },
                PromptMessage {
                    role: Role::Assistant,
                    content: "helloWorld".to_string(),
                },
                PromptMessage {
                    role: Role::User,
                    content: "Example 2: Convert 'foo bar baz' to camelCase".to_string(),
                },
                PromptMessage {
                    role: Role::Assistant,
                    content: "fooBarBaz".to_string(),
                },
                PromptMessage {
                    role: Role::User,
                    content: format!("Now: {}", task),
                },
            ],
        }
    }
}

Dynamic Context Injection

impl PromptService {
    async fn create_contextual_prompt(
        &self,
        args: &HashMap<String, String>,
        context_loader: &ContextLoader,
    ) -> Result<PromptResponse, Error> {
        let topic = args.get("topic").unwrap();

        // Load relevant context
        let docs = context_loader.load_documentation(topic).await?;
        let examples = context_loader.load_examples(topic).await?;
        let best_practices = context_loader.load_best_practices(topic).await?;

        let context = format!(
            "# Reference Documentation\n\n{}\n\n\
             # Examples\n\n{}\n\n\
             # Best Practices\n\n{}\n\n\
             # Your Task\n\n\
             Apply these concepts to solve the problem.",
            docs, examples, best_practices
        );

        Ok(PromptResponse {
            description: Some(format!("Contextual help for {}", topic)),
            messages: vec![
                PromptMessage {
                    role: Role::User,
                    content: context,
                },
            ],
        })
    }
}

Prompt Testing

Unit Tests

#[cfg(test)]
mod tests {
    use super::*;

    #[tokio::test]
    async fn test_list_prompts() {
        let service = PromptService;
        let prompts = service.list_prompts().await;
        assert!(!prompts.is_empty());
    }

    #[tokio::test]
    async fn test_get_prompt_with_args() {
        let service = PromptService;
        let mut args = HashMap::new();
        args.insert("language".to_string(), "Rust".to_string());

        let response = service.get_prompt("analyze_code", args).await.unwrap();
        assert!(!response.messages.is_empty());
    }

    #[tokio::test]
    async fn test_missing_required_argument() {
        let service = PromptService;
        let args = HashMap::new();

        let result = service.get_prompt("analyze_code", args).await;
        assert!(result.is_err());
    }
}

Integration Tests

#[tokio::test]
async fn test_prompt_end_to_end() {
    let service = PromptService;

    // List prompts
    let prompts = service.list_prompts().await;
    let prompt_name = &prompts[0].name;

    // Build arguments
    let mut args = HashMap::new();
    for arg in &prompts[0].arguments {
        if arg.required {
            args.insert(arg.name.clone(), "test_value".to_string());
        }
    }

    // Get prompt
    let response = service.get_prompt(prompt_name, args).await.unwrap();

    // Verify structure
    assert!(!response.messages.is_empty());
    assert!(response.description.is_some());
}

Best Practices

  1. Clear Descriptions: Explain what the prompt does
  2. Required vs Optional: Mark arguments appropriately
  3. Validation: Validate arguments before use
  4. Context: Provide enough context for good responses
  5. Structure: Use consistent message structure
  6. Examples: Include examples when helpful
  7. Flexibility: Allow customization through arguments
  8. Testing: Test with various argument combinations

Common Use Cases

Code Generation Prompts

fn create_code_gen_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
    let language = args.get("language").unwrap();
    let component = args.get("component").unwrap();

    PromptResponse {
        description: Some(format!("Generate {} {}", language, component)),
        messages: vec![
            PromptMessage {
                role: Role::User,
                content: format!(
                    "Generate a {} {} with:\n\
                     - Clean, idiomatic code\n\
                     - Comprehensive error handling\n\
                     - Unit tests\n\
                     - Documentation comments",
                    language, component
                ),
            },
        ],
    }
}

Refactoring Prompts

fn create_refactor_prompt(&self, args: &HashMap<String, String>) -> PromptResponse {
    let goal = args.get("goal").unwrap();

    PromptResponse {
        description: Some(format!("Refactor to {}", goal)),
        messages: vec![
            PromptMessage {
                role: Role::User,
                content: format!(
                    "Refactor this code to {}.\n\n\
                     Requirements:\n\
                     - Preserve functionality\n\
                     - Improve code quality\n\
                     - Update tests\n\
                     - Explain changes",
                    goal
                ),
            },
        ],
    }
}

Your Role

When helping with prompt creation:

  1. Understand Goal

    • What is the prompt for?
    • Who will use it?
    • What context is needed?
  2. Design Arguments

    • What parameters are needed?
    • Which are required?
    • What are defaults?
  3. Craft Messages

    • Clear instructions
    • Appropriate context
    • Good structure
  4. Add Context

    • Inject relevant information
    • Include examples
    • Provide guidelines
  5. Test Thoroughly

    • Try different arguments
    • Verify output quality
    • Check edge cases

Your goal is to help developers create prompts that effectively guide AI assistants to produce high-quality, contextually appropriate responses.