create-mcp-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate MCP Skill
创建MCP Skill
Guide for creating new skills that use MCP (Model Context Protocol) servers with optimized performance patterns.
📚 Reference: See MCP CLI Guide for detailed patterns and best practices.
本指南介绍如何创建使用MCP(Model Context Protocol,模型上下文协议)服务器且具备性能优化模式的新Skill。
📚 参考文档: 详细的模式与最佳实践请查看MCP CLI指南。
Overview
概述
This skill helps you create a new skill that uses an MCP server by:
- Setting up the skill directory structure
- Discovering available MCP tools
- Creating optimized command patterns
- Applying performance best practices
本Skill可帮助你创建使用MCP服务器的新Skill,具体包括:
- 搭建Skill目录结构
- 发现可用的MCP工具
- 创建优化的命令模式
- 应用性能最佳实践
Prerequisites
前提条件
- MCP CLI installed (or
brew install mcp)go install github.com/f/mcptools/cmd/mcptools@latest - Target MCP server available (npm package, binary, etc.)
- 已安装MCP CLI(或
brew install mcp)go install github.com/f/mcptools/cmd/mcptools@latest - 目标MCP服务器可用(npm包、二进制文件等)
Process
操作流程
1. Discover Available Tools
1. 发现可用工具
First, explore what the MCP server offers:
bash
undefined首先,探索MCP服务器提供的功能:
bash
undefinedList all tools
列出所有工具
mcp tools SERVER_COMMAND
mcp tools SERVER_COMMAND
Get detailed JSON schema
获取详细的JSON schema
mcp tools SERVER_COMMAND --format json
mcp tools SERVER_COMMAND --format json
Interactive exploration
交互式探索
mcp shell SERVER_COMMAND
mcp shell SERVER_COMMAND
Type /h for help
输入/h获取帮助
**Example:**
```bash
**示例:**
```bashChrome DevTools
Chrome DevTools
mcp tools bunx -y chrome-devtools-mcp@latest
mcp tools bunx -y chrome-devtools-mcp@latest
Filesystem server
文件系统服务器
mcp tools npx @modelcontextprotocol/server-filesystem ~
undefinedmcp tools npx @modelcontextprotocol/server-filesystem ~
undefined2. Test Individual Tools
2. 测试单个工具
Test each tool before documenting:
bash
undefined在编写文档前先测试每个工具:
bash
undefinedTemplate
模板
echo -e 'TOOL_NAME {"param":"value"}\nexit' | timeout 30 mcp shell SERVER_COMMAND
echo -e 'TOOL_NAME {"param":"value"}\nexit' | timeout 30 mcp shell SERVER_COMMAND
Example
示例
echo -e 'navigate_page {"url":"https://example.com"}\nexit' | timeout 30 mcp shell bunx -y chrome-devtools-mcp@latest -- --isolated
**Check for:**
- Required vs optional parameters
- Empty parameter schema issues
- Response format
- Execution timeecho -e 'navigate_page {"url":"https://example.com"}\nexit' | timeout 30 mcp shell bunx -y chrome-devtools-mcp@latest -- --isolated
**检查内容:**
- 必填参数与可选参数
- 空参数schema问题
- 响应格式
- 执行时间3. Create Skill Structure
3. 创建Skill结构
skills/SKILL_NAME/
├── SKILL.md # Main skill documentation
└── .examples/ # (Optional) Example outputsskills/SKILL_NAME/
├── SKILL.md # 主Skill文档
└── .examples/ # (可选)示例输出4. Write Skill Documentation
4. 编写Skill文档
Template for SKILL.md:
markdown
---
name: SKILL_NAME
description: Brief description of what this skill does and when to use it.
allowed-tools: Bash, Read, Write
---SKILL.md模板:
markdown
---
name: SKILL_NAME
description: Brief description of what this skill does and when to use it.
allowed-tools: Bash, Read, Write
---Skill Name
Skill名称
Brief overview.
📚 See also: MCP CLI Guide
简要概述。
📚 另请参阅: MCP CLI指南
Setup
安装配置
```bash
```bash
Installation instructions for the MCP server
MCP服务器安装说明
```
```
Quick Start (FASTEST)
快速开始(最优性能)
Common Task 1
常见任务1
```bash
pkill -9 -f "server-pattern" 2>/dev/null; sleep 1; \
echo -e 'command1 {"param":"value"}\ncommand2 {"param":"value"}\nexit' | \
timeout 30 mcp shell SERVER_COMMAND [FLAGS]
```
```bash
pkill -9 -f "server-pattern" 2>/dev/null; sleep 1; \
echo -e 'command1 {"param":"value"}\ncommand2 {"param":"value"}\nexit' | \
timeout 30 mcp shell SERVER_COMMAND [FLAGS]
```
Common Task 2
常见任务2
```bash
```bash
Another optimized pattern
另一种优化模式
```
⚡ Pattern: cleanup; sleep; echo commands | timeout shell
```
⚡ 模式说明: 清理进程;等待;通过管道传递命令至带超时的shell
Key Tools
核心工具
- tool1 - Description (required params: ,
param1)param2 - tool2 - Description (optional params: )
param1
- tool1 - 描述(必填参数:,
param1)param2 - tool2 - 描述(可选参数:)
param1
Important Notes
重要注意事项
- Server-specific quirks
- Performance considerations
- Common gotchas
- 服务器特定的特殊情况
- 性能考量因素
- 常见陷阱
Troubleshooting
故障排查
Problem: [Common issue]
```bash
问题:[常见问题]
```bash
Solution
解决方案
```
undefined```
undefinedBest Practices Checklist
最佳实践检查清单
When creating an MCP-based skill, ensure:
创建基于MCP的Skill时,请确保满足以下要求:
✅ Performance
✅ 性能
- Quick Start section at the top with copy-paste ready commands
- All examples use the optimized pattern:
cleanup; sleep; echo | timeout shell - Shell mode recommended over individual calls
- Cleanup commands included (pkill pattern)
- Timeout wrapper on all shell commands (30s default)
- 顶部设置快速开始区域,提供可直接复制粘贴的命令
- 所有示例均使用优化模式:
cleanup; sleep; echo | timeout shell - 推荐使用shell模式而非单独调用
- 包含清理命令(pkill模式)
- 所有shell命令均添加超时包装(默认30秒)
✅ Parameter Handling
✅ 参数处理
- Parameters passed directly (no wrapper)
{"arguments":{}} - Tools with optional-only params documented with workaround
- Empty parameter bug addressed where applicable
- Example commands show correct parameter format
- 参数直接传递(无需包装)
{"arguments":{}} - 仅含可选参数的工具需记录解决方案
- 适用时解决空参数bug
- 示例命令展示正确的参数格式
✅ Documentation
✅ 文档
- Reference to MCP CLI guide included
- Server installation instructions provided
- Quick start patterns for common tasks
- Key tools listed with parameter requirements
- Troubleshooting section for common issues
- Performance tips highlighted
- 包含MCP CLI指南的引用
- 提供服务器安装说明
- 常见任务的快速开始模式
- 列出核心工具及其参数要求
- 常见问题的故障排查区域
- 突出显示性能提示
✅ Command Structure
✅ 命令结构
- Correct argument order:
mcp call TOOL SERVER --params '{}' - Server flags properly positioned with separator
-- - Exit command included in shell mode examples
- One-liner format (no backslash continuations if possible)
- 正确的参数顺序:
mcp call TOOL SERVER --params '{}' - 使用分隔符正确放置服务器标志
-- - shell模式示例中包含exit命令
- 单行格式(尽可能避免反斜杠换行)
Example: Chrome DevTools Skill
示例:Chrome DevTools Skill
See for a complete example that follows all best practices.
skills/chrome-devtools/SKILL.mdKey features:
- Quick start patterns at the top
- 6-9x performance improvement documented
- Optimized one-liners for common tasks
- Comprehensive troubleshooting guide
- References MCP CLI guide
完整的最佳实践示例请查看。
skills/chrome-devtools/SKILL.md核心特性:
- 顶部设置快速开始模式
- 记录了6-9倍的性能提升
- 针对常见任务的优化单行命令
- 全面的故障排查指南
- 引用MCP CLI指南
Template Generator
模板生成器
Generate a basic skill structure:
bash
undefined生成基础Skill结构:
bash
undefinedSet variables
设置变量
SKILL_NAME="my-mcp-skill"
SERVER_COMMAND="bunx my-mcp-server@latest"
SERVER_PATTERN="my-mcp-server"
SKILL_NAME="my-mcp-skill"
SERVER_COMMAND="bunx my-mcp-server@latest"
SERVER_PATTERN="my-mcp-server"
Create directory
创建目录
mkdir -p "skills/$SKILL_NAME"
mkdir -p "skills/$SKILL_NAME"
Create SKILL.md with template
创建带模板的SKILL.md
cat > "skills/$SKILL_NAME/SKILL.md" << 'EOF'
name: SKILL_NAME description: TODO - Add description allowed-tools: Bash, Read, Write
cat > "skills/$SKILL_NAME/SKILL.md" << 'EOF'
name: SKILL_NAME description: TODO - 添加描述 allowed-tools: Bash, Read, Write
Skill Name
Skill名称
TODO - Add overview
📚 See also: MCP CLI Guide
TODO - 添加概述
📚 另请参阅: MCP CLI Guide
Setup
安装配置
bash
undefinedbash
undefinedTODO - Add installation
TODO - 添加安装步骤
undefinedundefinedQuick Start (FASTEST)
快速开始(最优性能)
Common Task
常见任务
bash
pkill -9 -f "SERVER_PATTERN" 2>/dev/null; sleep 1; \
echo -e 'COMMAND\nexit' | \
timeout 30 mcp shell SERVER_COMMANDbash
pkill -9 -f "SERVER_PATTERN" 2>/dev/null; sleep 1; \
echo -e 'COMMAND\nexit' | \
timeout 30 mcp shell SERVER_COMMANDKey Tools
核心工具
- tool1 - TODO
- tool1 - TODO
Important Notes
重要注意事项
- TODO
- TODO
Troubleshooting
故障排查
Problem: Issue
bash
undefined问题:Issue
bash
undefinedSolution
解决方案
EOFEOFDiscover tools
发现工具
mcp tools $SERVER_COMMAND
mcp tools $SERVER_COMMAND
Test interactively
交互式测试
mcp shell $SERVER_COMMAND
undefinedmcp shell $SERVER_COMMAND
undefinedCommon Patterns
常见模式
Pattern 1: Single Command Check
模式1:单命令检查
bash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \
echo -e 'TOOL {"param":"value"}\nexit' | \
timeout 30 mcp shell SERVER -- --isolatedbash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \
echo -e 'TOOL {"param":"value"}\nexit' | \
timeout 30 mcp shell SERVER -- --isolatedPattern 2: Multi-Command Debug
模式2:多命令调试
bash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \
echo -e 'CMD1 {"p":"v"}\nCMD2 {"p":"v"}\nCMD3 {"p":"v"}\nexit' | \
timeout 30 mcp shell SERVER -- --isolatedbash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \
echo -e 'CMD1 {"p":"v"}\nCMD2 {"p":"v"}\nCMD3 {"p":"v"}\nexit' | \
timeout 30 mcp shell SERVER -- --isolatedPattern 3: With Custom Flags
模式3:带自定义标志
bash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \
echo -e 'COMMAND\nexit' | \
timeout 30 mcp shell SERVER -- --flag1 --flag2=valuebash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \
echo -e 'COMMAND\nexit' | \
timeout 30 mcp shell SERVER -- --flag1 --flag2=valueTesting Your Skill
测试你的Skill
-
Test cleanup pattern works:bash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; echo "Cleanup OK" -
Test basic command:bash
echo -e 'list_tools\nexit' | timeout 10 mcp shell SERVER -
Test multi-command:bash
echo -e 'cmd1\ncmd2\ncmd3\nexit' | timeout 30 mcp shell SERVER -
Test with cleanup:bash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \ echo -e 'cmd1\ncmd2\nexit' | timeout 30 mcp shell SERVER -
Verify no hanging:
- Commands should complete within timeout
- Exit command should terminate session cleanly
-
测试清理模式是否正常工作:bash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; echo "清理完成" -
测试基础命令:bash
echo -e 'list_tools\nexit' | timeout 10 mcp shell SERVER -
测试多命令:bash
echo -e 'cmd1\ncmd2\ncmd3\nexit' | timeout 30 mcp shell SERVER -
测试带清理的命令:bash
pkill -9 -f "PATTERN" 2>/dev/null; sleep 1; \ echo -e 'cmd1\ncmd2\nexit' | timeout 30 mcp shell SERVER -
验证无进程挂起:
- 命令应在超时时间内完成
- Exit命令应能正常终止会话
Optimization Checklist
优化检查清单
Compare your skill against the optimized pattern:
| Aspect | Before | After |
|---|---|---|
| Commands per task | 5-10 | 1 |
| Manual cleanup | Yes | Automated |
| Failures from locks | Common | Zero |
| Execution time | 60-90s | 5-10s |
| Success rate | 60-70% | 100% |
将你的Skill与优化模式进行对比:
| 维度 | 优化前 | 优化后 |
|---|---|---|
| 每个任务的命令数 | 5-10 | 1 |
| 手动清理 | 是 | 自动 |
| 锁导致的失败 | 常见 | 零 |
| 执行时间 | 60-90秒 | 5-10秒 |
| 成功率 | 60-70% | 100% |
Resources
资源
- MCP CLI Guide - Complete MCP CLI reference
- Chrome DevTools Skill - Reference implementation
- MCP Documentation - Official MCP docs
- mcptools GitHub - CLI tool source
- MCP CLI指南 - 完整的MCP CLI参考文档
- Chrome DevTools Skill - 参考实现
- MCP官方文档 - MCP官方文档
- mcptools GitHub - CLI工具源码
Quick Reference
快速参考
Every MCP skill should have:
- Quick Start section - Copy-paste ready commands
- Optimized pattern -
cleanup; sleep; echo | timeout shell - Performance note - Document speed improvement
- MCP CLI guide reference - Link to
.docs/mcp-cli.md - Troubleshooting - Common issues and solutions
Every command should:
- Include cleanup ()
pkill -9 -f "PATTERN" - Wait after cleanup ()
sleep 1 - Use shell mode for 2+ commands
- Have timeout wrapper
- End with
exit - Use correct parameter format (no "arguments" wrapper)
每个MCP Skill都应包含:
- 快速开始区域 - 可直接复制粘贴的命令
- 优化模式 -
cleanup; sleep; echo | timeout shell - 性能说明 - 记录速度提升情况
- MCP CLI指南引用 - 链接至
.docs/mcp-cli.md - 故障排查 - 常见问题与解决方案
每个命令都应:
- 包含清理操作()
pkill -9 -f "PATTERN" - 清理后等待()
sleep 1 - 执行2个及以上命令时使用shell模式
- 添加超时包装
- 以结尾
exit - 使用正确的参数格式(无"arguments"包装)