Prompts Reference

MCP Prompts for guided workflows: save code, review, and explain snippets.

MCP Prompts are reusable workflow templates that guide your AI assistant through common tasks. Snippets-mcp provides 3 prompts.

Available Prompts

PromptDescription
save_codeGuide for saving code as a new snippet
review_snippetCode review workflow
explain_snippetCode explanation at varying levels

save_code

Guides the user through saving code as a new snippet. Suggests appropriate filename, description with hashtags, and visibility setting.

Arguments

ArgumentRequiredDescription
codeyesThe code to save
languagenoProgramming language hint
descriptionnoInitial description suggestion

Example

User: Save this code as a snippet

```go
func Reverse(s string) string {
    runes := []rune(s)
    for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
        runes[i], runes[j] = runes[j], runes[i]
    }
    return string(runes)
}

Your AI assistant will:
1. Suggest a filename (e.g., `reverse.go`)
2. Suggest description with tags (e.g., `String reversal function #go #strings #utility`)
3. Ask about visibility (public/private)
4. Call `create_snippet` with the final parameters

---

## review_snippet

Performs code review on an existing snippet.

### Arguments

| Argument | Required | Description |
|----------|----------|-------------|
| `id` | yes | Snippet ID to review |
| `focus` | no | Review focus area (see below) |

### Focus Options

| Focus | Description |
|-------|-------------|
| `all` | Comprehensive review (default) |
| `security` | Security vulnerabilities and risks |
| `performance` | Performance issues and optimizations |
| `style` | Code style, conventions, readability |

### Example

User: Review snippet abc123 for security issues

Your AI assistant will:

  1. Fetch the snippet using get_snippet
  2. Analyze for security concerns:
    • Input validation
    • Injection vulnerabilities
    • Sensitive data exposure
    • Authentication/authorization issues
  3. Provide findings with recommendations

---

## explain_snippet

Explains what a snippet does, tailored to the audience's experience level.

### Arguments

| Argument | Required | Description |
|----------|----------|-------------|
| `id` | yes | Snippet ID to explain |
| `audience` | no | Target audience (see below) |

### Audience Options

| Audience | Description |
|----------|-------------|
| `beginner` | No prior knowledge assumed |
| `intermediate` | Basic programming knowledge (default) |
| `expert` | Deep technical dive |

### Example: Beginner

User: Explain snippet abc123 for a beginner

Your AI assistant will:

  1. Fetch the snippet
  2. Explain high-level purpose
  3. Walk through code line by line
  4. Define technical terms
  5. Use analogies for complex concepts

### Example: Expert

User: Explain snippet abc123 for an expert

Your AI assistant will:

  1. Fetch the snippet
  2. Focus on implementation choices
  3. Discuss algorithmic complexity
  4. Compare to alternative approaches
  5. Highlight edge cases and trade-offs

---

## Using Prompts

In Claude Desktop, prompts appear in the prompt picker (paperclip icon). Select a prompt, fill in the arguments, and your AI assistant executes the guided workflow.

Prompts can also be invoked via the MCP protocol:

```json
{
  "method": "prompts/get",
  "params": {
    "name": "review_snippet",
    "arguments": {
      "id": "abc123",
      "focus": "security"
    }
  }
}