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
| Prompt | Description |
|---|---|
save_code | Guide for saving code as a new snippet |
review_snippet | Code review workflow |
explain_snippet | Code 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
| Argument | Required | Description |
|---|---|---|
code | yes | The code to save |
language | no | Programming language hint |
description | no | Initial 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:
- Fetch the snippet using
get_snippet - Analyze for security concerns:
- Input validation
- Injection vulnerabilities
- Sensitive data exposure
- Authentication/authorization issues
- 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:
- Fetch the snippet
- Explain high-level purpose
- Walk through code line by line
- Define technical terms
- Use analogies for complex concepts
### Example: Expert
User: Explain snippet abc123 for an expert
Your AI assistant will:
- Fetch the snippet
- Focus on implementation choices
- Discuss algorithmic complexity
- Compare to alternative approaches
- 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"
}
}
}