create-command
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate New Slash Command
创建新的Slash命令
Create a new slash command in both (with prefix) and directories based on user requirements.
.cursor/commands/trellis-.claude/commands/trellis/根据用户需求,在(带有前缀)和两个目录中创建新的slash命令。
.cursor/commands/trellis-.claude/commands/trellis/Usage
使用方法
/trellis:create-command <command-name> <description>Example:
/trellis:create-command review-pr Check PR code changes against project guidelines/trellis:create-command <command-name> <description>示例:
/trellis:create-command review-pr Check PR code changes against project guidelinesExecution Steps
执行步骤
1. Parse Input
1. 解析输入
Extract from user input:
- Command name: Use kebab-case (e.g., )
review-pr - Description: What the command should accomplish
从用户输入中提取:
- 命令名称:使用kebab-case格式(例如:)
review-pr - 描述:该命令需要完成的操作
2. Analyze Requirements
2. 分析需求
Determine command type based on description:
- Initialization: Read docs, establish context
- Pre-development: Read guidelines, check dependencies
- Code check: Validate code quality and guideline compliance
- Recording: Record progress, questions, structure changes
- Generation: Generate docs, code templates
根据描述确定命令类型:
- 初始化类:读取文档,建立上下文
- 预开发类:读取规范,检查依赖
- 代码检查类:验证代码质量和规范合规性
- 记录类:记录进度、问题、结构变更
- 生成类:生成文档、代码模板
3. Generate Command Content
3. 生成命令内容
Based on command type, generate appropriate content:
Simple command (1-3 lines):
markdown
Concise instruction describing what to doComplex command (with steps):
markdown
undefined根据命令类型生成对应的内容:
简单命令(1-3行):
markdown
描述操作内容的简洁指令复杂命令(包含步骤):
markdown
undefinedCommand Title
命令标题
Command description
命令描述
Steps
步骤
1. First Step
1. 第一步
Specific action
具体操作
2. Second Step
2. 第二步
Specific action
具体操作
Output Format (if needed)
输出格式(如有需要)
Template
undefined模板
undefined4. Create Files
4. 创建文件
Create in both directories:
.cursor/commands/trellis-<command-name>.md.claude/commands/trellis/<command-name>.md
在两个目录中创建文件:
.cursor/commands/trellis-<command-name>.md.claude/commands/trellis/<command-name>.md
5. Confirm Creation
5. 确认创建
Output result:
[OK] Created Slash Command: /<command-name>
File paths:
- .cursor/commands/trellis-<command-name>.md
- .claude/commands/trellis/<command-name>.md
Usage:
/trellis:<command-name>
Description:
<description>输出结果:
[OK] 已创建Slash命令: /<command-name>
文件路径:
- .cursor/commands/trellis-<command-name>.md
- .claude/commands/trellis/<command-name>.md
使用方法:
/trellis:<command-name>
描述:
<description>Command Content Guidelines
命令内容规范
[OK] Good command content
[√] 优质命令内容
- Clear and concise: Immediately understandable
- Executable: AI can follow steps directly
- Well-scoped: Clear boundaries of what to do and not do
- Has output: Specifies expected output format (if needed)
- 清晰简洁:一目了然
- 可执行:AI可直接遵循步骤操作
- 范围明确:清晰界定操作边界
- 有输出:指定预期输出格式(如有需要)
[X] Avoid
[×] 需避免的情况
- Too vague: e.g., "optimize code"
- Too complex: Single command should not exceed 100 lines
- Duplicate functionality: Check if similar command exists first
- 过于模糊:例如:"优化代码"
- 过于复杂:单个命令内容不应超过100行
- 功能重复:先检查是否存在类似命令
Naming Conventions
命名规范
| Command Type | Prefix | Example |
|---|---|---|
| Session Start | | |
| Pre-development | | |
| Check | | |
| Record | | |
| Generate | | |
| Update | | |
| Other | Verb-first | |
| 命令类型 | 前缀 | 示例 |
|---|---|---|
| 会话启动 | | |
| 预开发 | | |
| 检查类 | | |
| 记录类 | | |
| 生成类 | | |
| 更新类 | | |
| 其他 | 动词开头 | |
Example
示例
Input
输入
/trellis:create-command review-pr Check PR code changes against project guidelines/trellis:create-command review-pr Check PR code changes against project guidelinesGenerated Command Content
生成的命令内容
markdown
undefinedmarkdown
undefinedPR Code Review
PR Code Review
Check current PR code changes against project guidelines.
Check current PR code changes against project guidelines.
Steps
Steps
1. Get Changed Files
1. Get Changed Files
bash
git diff main...HEAD --name-onlybash
git diff main...HEAD --name-only2. Categorized Review
2. Categorized Review
Frontend files ():
apps/web/- Reference
.trellis/spec/frontend/index.md
Backend files ():
packages/api/- Reference
.trellis/spec/backend/index.md
Frontend files ():
apps/web/- Reference
.trellis/spec/frontend/index.md
Backend files ():
packages/api/- Reference
.trellis/spec/backend/index.md
3. Output Review Report
3. Output Review Report
Format:
Format:
PR Review Report
PR Review Report
Changed Files
Changed Files
- [file list]
- [file list]
Check Results
Check Results
- [OK] Passed items
- Issues found
- [OK] Passed items
- Issues found
Suggestions
Suggestions
- [improvement suggestions]
undefined- [improvement suggestions]
undefined