/ 目录 / 演练场 / wshobson commands
● 社区 wshobson ⚡ 即开即用

wshobson commands

作者 wshobson · wshobson/commands

60+ 个 Claude Code slash 命令——/commit、/review、/test、/docs、/refactor——在项目间保持一致。

wshobson/commands 是一套为 Claude Code 精心设计的 slash 命令。每个命令都是 ~/.claude/commands 中的一个 Markdown 文件,带有精准的 prompt 和说明。运行 /commit 可基于 diff 获得规范的 conventional commits 消息,/review 可进行结构化 PR 审查,等等。与 wshobson/agents 天然配合。

为什么要用

核心特性

实时演示

实际使用效果

就绪

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "wshobson-commands-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/wshobson/commands",
        "~/.claude/commands"
      ],
      "_inferred": true
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "wshobson-commands-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/wshobson/commands",
        "~/.claude/commands"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "wshobson-commands-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/wshobson/commands",
        "~/.claude/commands"
      ],
      "_inferred": true
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "wshobson-commands-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/wshobson/commands",
        "~/.claude/commands"
      ],
      "_inferred": true
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "wshobson-commands-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/wshobson/commands",
        "~/.claude/commands"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "wshobson-commands-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/wshobson/commands",
          "~/.claude/commands"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add wshobson-commands-skill -- git clone https://github.com/wshobson/commands ~/.claude/commands

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: wshobson commands

无需手写,获得干净的 conventional commit 消息

👤 提交习惯随意的开发者 ⏱ ~5 min beginner

何时使用: 你提交速度快,commit 日志满是「wip」「fix」「wip2」。

前置条件
  • 已安装命令 — git clone https://github.com/wshobson/commands ~/.claude/commands
步骤
  1. 暂存变更
    git add -p the relevant hunks (or full files).✓ 已复制
    → 暂存的 diff 可见
  2. 生成提交消息
    /commit✓ 已复制
    → 提出 conventional 风格的消息
  3. 审查并提交
    Edit if needed, then git commit -m '...'✓ 已复制
    → 干净的日志条目

结果: 在 PR 描述中不让你感到羞耻的提交日志。

注意事项
  • 自动检测的 scope 有误 — 显式传入 scope:/commit feat auth
搭配使用: wshobson-agents-skill

用 /test 从最新 diff 生成测试

👤 排斥 TDD 但想要测试覆盖的开发者 ⏱ ~15 min beginner

何时使用: 你完成了逻辑,现在想在 PR 前补充测试。

步骤
  1. 运行 /test
    /test✓ 已复制
    → 测试文件已生成,覆盖新逻辑
  2. 运行测试
    Run the test suite. Fix anything that fails.✓ 已复制
    → 测试全绿

结果: 不手动写就不会有的测试覆盖。

用带内置安全 prompt 的 /refactor 重构热点代码

👤 想要重构不回归行为的开发者 ⏱ ~30 min intermediate

何时使用: 函数比较混乱;你想清理它,但不想引入回归。

步骤
  1. 识别
    /refactor src/auth.ts:authenticate✓ 已复制
    → 带理由和测试计划的 diff
  2. 验证
    Run tests after each step✓ 已复制
    → 逐步验证

结果: 代码更干净,行为不变。

搭配使用: wshobson-agents-skill

组合

与其他 MCP 搭配,撬动十倍杠杆

wshobson-commands-skill + wshobson-agents-skill

命令触发特定 agent

wshobson-commands-skill + wshobson-skills-skill

命令用于快速触发,skill 用于更深入的专业指导

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
/commit type? scope? 任何 git commit 之前 0
/review (diff implied) 开 PR 之前 0
/test (diff implied) 按需补充覆盖 0
/refactor target 代码清理 0
/docs target? 功能完成后 0

成本与限制

运行它的成本

API 配额
不适用——本地
每次调用 Token 数
因命令而异(/commit 较小,/refactor 较大)
费用
免费(MIT 协议)
提示
编辑单个命令 Markdown 文件,裁剪冗长的模板

安全

权限、密钥、影响范围

最小权限: filesystem-read filesystem-write
凭据存储:
数据出站: 无——纯 prompt

故障排查

常见错误与修复

/command 无法识别

确保文件在 ~/.claude/commands/ 目录中,带 .md 扩展名;重启 Claude Code

验证: 在对话中用 / 列出命令
参数解析失败

部分命令期望位置参数,部分期望具名参数——读取命令文件确认

输出格式不一致

每个命令都有固定模板;如有漂移,是模型覆盖了模板——确保没有全局系统 prompt 干扰

替代方案

wshobson commands 对比其他方案

替代方案何时用它替代权衡
wshobson/agents (sibling)你想要 subagent 而非 slash 命令不同的调用方式
Hesreallyhim/awesome-claude-code你想要精选的命令和 skill 索引列表目录,而非运行时

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills