mcpField
G
generate_command

generate_command

github.com/everyincAgent 工作流25.8k63 次安装今天更新
代码仓库

关于 generate_command

用于在 `.claude/skills/` 中创建任务专用 Skill 的 Claude Code 技能,提供结构、必需的 YAML frontmatter 和验证步骤指引。

主要功能

  1. 01Skill 创建模板
  2. 02必需的 YAML frontmatter
  3. 03任务步骤编写指引
  4. 04验证建议

适用场景

  1. 01创建可复用的任务 Skill
  2. 02定义参数和成功标准

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/everyinc/compound-engineering-plugin --skill generate_command

安装后在 Claude Code 中输入/generate_command确认已加载。

详细介绍

创建自定义 Claude Code 命令

在 .claude/skills/ 中为请求的任务创建一项新技能。

目标

#$ARGUMENTS

可利用的关键能力

文件操作:

  • Read、Edit、Write——精确修改文件
  • Glob、Grep——搜索代码库
  • MultiEdit——原子化地进行多项更改

开发:

  • Bash——运行命令(git、测试、代码检查工具)
  • Task——为复杂任务启动专用 Agent
  • TodoWrite——使用待办事项列表跟踪进度

Web 与 API:

  • WebFetch、WebSearch——查阅文档
  • GitHub(gh cli)——PR、问题、评审
  • Playwright——浏览器自动化、截图

集成:

  • AppSignal——日志和监控
  • Context7——框架文档
  • Stripe、Todoist、Featurebase(如相关)

最佳实践

  1. 明确具体——详细的说明能带来更好的结果
  2. 拆分复杂任务——使用分步计划
  3. 使用示例——参考现有的代码模式
  4. 加入成功标准——测试通过、代码检查无误等
  5. 先思考——处理复杂问题时使用“think hard”或“plan”等关键词
  6. 迭代推进——逐步引导整个流程

必需:YAML Frontmatter

每个命令都必须以 YAML frontmatter 开头:

---
name: command-name
description: Brief description of what this command does (max 100 chars)
argument-hint: "[what arguments the command accepts]"
---

字段:

  • name:小写的命令标识符(内部使用)
  • description:清晰简洁地概述命令用途
  • argument-hint:向用户说明预期参数(例如 [file path]、[PR number]、[optional: format])

组织命令结构

# [Command Name]

[Brief description of what this command does]

## Steps

1. [First step with specific details]
   - Include file paths, patterns, or constraints
   - Reference existing code if applicable

2. [Second step]
   - Use parallel tool calls when possible
   - Check/verify results

3. [Final steps]
   - Run tests
   - Lint code
   - Commit changes (if appropriate)

## Success Criteria

- [ ] Tests pass
- [ ] Code follows style guide
- [ ] Documentation updated (if needed)

编写有效命令的提示

  • 使用 $ARGUMENTS 占位符传入动态输入
  • 参考 AGENTS.md 中的模式和约定
  • 包含验证步骤——测试、代码检查、视觉检查
  • 明确约束——不要修改 X,使用模式 Y
  • 使用 XML 标签组织结构化提示:<task>、<requirements>、<constraints>

示例模式

Implement #$ARGUMENTS following these steps:

1. Research existing patterns
   - Search for similar code using Grep
   - Read relevant files to understand approach

2. Plan the implementation
   - Think through edge cases and requirements
   - Consider test cases needed

3. Implement
   - Follow existing code patterns (reference specific files)
   - Write tests first if doing TDD
   - Ensure code follows AGENTS.md conventions

4. Verify
   - Run tests: `bin/rails test`
   - Run linter: `bundle exec standardrb`
   - Check changes with git diff

5. Commit (optional)
   - Stage changes
   - Write clear commit message

创建命令文件

  1. 创建目录 .claude/skills/[name]/SKILL.md
  2. 添加 YAML frontmatter(参见上文)
  3. 使用上面的模板组织技能结构
  4. 测试技能,并为其提供合适的参数

命令文件模板

---
name: command-name
description: What this command does
argument-hint: "[expected arguments]"
---

# Command Title

Brief introduction of what the command does and when to use it.

## Workflow

### Step 1: [First Major Step]

Details about what to do.

### Step 2: [Second Major Step]

Details about what to do.

## Success Criteria

- [ ] Expected outcome 1
- [ ] Expected outcome 2

评论

支持 Markdown