‹ 首页

command-creator

@feiskyer · 收录于 1 周前 · 上游提交 2 个月前

Create Claude Code custom slash commands with proper structure, frontmatter, and best practices. Use this skill whenever the user wants to create a new command, add a slash command, build a custom command, or mentions "create-command", "new command", "add command", or "make a command" for Claude Code. Also trigger when the user wants to turn a workflow into a reusable command.

适合你,如果经常在 Claude Code 里做重复操作想一键完成

/ 下载安装
command-creator.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add feiskyer/claude-code-settings/command-creator
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- feiskyer/claude-code-settings/command-creator
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify feiskyer/claude-code-settings/command-creator
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
1585GitHub stars
~1K上下文体积 · 单文件
镜像托管

怎么用

商店整理自技能原文 · 版本 4863dd2 · 表述以原文为准
它做什么

安装后,Claude 会根据你的需求创建自定义斜杠命令。它会生成一个 Markdown 文件,包含命令说明、参数提示和步骤,让你能通过输入 /命令名 来重复执行复杂任务。

什么时候触发

当你说“创建一个新命令”、“添加斜杠命令”或提到“create-command”、“new command”等关键词时触发。也适用于你想把工作流程变成可复用命令时。

装好后可以这样说
Claude 会生成一个 review-pr 命令文件。
Claude 会生成一个包含格式化与测试步骤的命令。
技能原文 SKILL.md作者撰写 · MIT · 4863dd2

Command Creator

Create Claude Code custom slash commands with proper structure and best practices.

Understanding Commands

Claude Code commands are Markdown files with YAML frontmatter that define reusable workflows invoked via /command-name. They live in specific locations depending on scope:

  • Project-level: .claude/commands/ in the project root (shared via git)
  • User-level: ~/.claude/commands/ (personal, available everywhere)
  • Categorized: Nest under subdirectories for namespacing (e.g., gh/review-pr.md becomes /gh:review-pr)
Process
1. Clarify Intent

Before writing anything, understand:

  • What should the command do? (single clear purpose)
  • Who uses it — just this user, or the whole team? (determines project vs user-level)
  • Does it need arguments? What kind?
  • What tools does it need access to?
  • Is there a category it belongs to? (e.g., gh for GitHub, cc for Claude Code meta-commands)
2. Write the Command

Every command file follows this structure:

---
description: Brief description shown in command list
argument-hint: [expected-arguments]
allowed-tools: Tool1, Tool2, Bash(prefix:*)
---

# Command Name

What this command does and when to use it.

## Process:

Step-by-step instructions for the agent to follow.

## Your Task:

Act on "$ARGUMENTS" following these guidelines.
Frontmatter fields

| Field | Required | Purpose | |-------|----------|---------| | description | Yes | Short description shown when listing commands | | argument-hint | No | Hint for expected arguments (shown in autocomplete) | | allowed-tools | No | Restrict which tools the command can use |

Key conventions
  • $ARGUMENTS is replaced with whatever the user types after the command name. Always reference it in the "Your Task" section so the command acts on user input.
  • allowed-tools uses patterns: exact names (Read, Write), or prefix globs for Bash (Bash(git:*), Bash(npm:*)).
  • Keep commands focused and single-purpose — one command, one job.
  • Write instructions in the imperative form ("Analyze the code", not "You should analyze the code").
  • Include concrete examples of usage and expected behavior.
3. Choose the Right Location

| Scope | Path | When to use | |-------|------|-------------| | Project (shared) | .claude/commands/ | Team workflows, project-specific tasks | | Project (categorized) | .claude/commands/<category>/ | Grouped commands (e.g., gh/, db/) | | User (personal) | ~/.claude/commands/ | Personal productivity, cross-project tools |

4. Validate

After creating the command file:

  • Verify the YAML frontmatter parses correctly (no syntax errors)
  • Confirm the file is in the right directory
  • Check that $ARGUMENTS is referenced if the command accepts input
  • Ensure allowed-tools includes everything the command needs
Example: A Simple Command
---
description: Review a pull request with detailed analysis
argument-hint: [PR-number-or-URL]
allowed-tools: Bash(gh:*), Read, Grep, Glob
---

# Review PR

Perform a thorough code review of a GitHub pull request.

## Process:

1. Fetch PR details and diff using `gh pr view` and `gh pr diff`
2. Read changed files for full context
3. Analyze changes for:
   - Correctness and potential bugs
   - Code style consistency
   - Missing tests or edge cases
   - Security concerns
4. Provide a structured review summary

## Your Task:

Review PR "$ARGUMENTS" following these guidelines. If no PR number is given,
use `gh pr list` to show recent PRs and ask which one to review.
Best Practices
  • Descriptive names: The filename becomes the command name — make it clear (fix-issue.md not fi.md)
  • Graceful argument handling: Always handle the case where $ARGUMENTS is empty
  • Minimal tool permissions: Only list tools the command actually needs in allowed-tools
  • Follow existing patterns: Look at other commands in the same directory for conventions
  • Test before shipping: Try the command with different inputs to verify it works
Your Task

Create a new command based on "$ARGUMENTS":

  1. If the purpose is unclear, ask clarifying questions
  2. Determine the appropriate location and category
  3. Create the command file with proper structure
  4. Explain what was created and how to use it
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。