create-command
它能做什么
这项技能说明如何为 Forge 编程应用编写自定义命令。每个命令是一个 markdown 文件,包含名称、描述和一系列步骤。适合希望在 Forge 中使用可重复工作流程的人。
适用场景
- ✓当你想把一个可重复的工作流程保存为 Forge 命令,例如提交前检查代码的时候。
- ✓当你想修改现有的 Forge 命令的时候。
- ✓当你需要了解 Forge 命令文件结构的时候。
技能链接
https://github.com/tailcallhq/forgecode/blob/main/.forge/skills/create-command/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“你能做一个 Forge 命令,在我提交之前运行 linter 和测试吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体编写一个 markdown 文件,包含简短的头部和一系列步骤。特殊标签标记 lint 和测试步骤,使 Forge 能够自动运行它们。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Create Commands
Create and manage commands for the code-forge application. Commands are modular workflows that can be invoked to perform specific tasks.
File Location
CRITICAL: All command files must be created in the <cwd>/.forge/commands directory, where <cwd> is the current working directory of your code-forge project.
- Directory:
<cwd>/.forge/commands - File format:
{command-name}.md - Example: If your project is at
/home/user/my-project, commands go in/home/user/my-project/.forge/commands/
This is the only location where forge will discover and load custom commands.
Command File Structure
Every command file must have:
YAML Frontmatter (required):
name: Command identifier (use hyphens for multi-word names)description: What the command does
Command Body (required):
- List of steps to execute
- Special tags for automated workflows
- Clear instructions for each step
Example Command File
---
name: check
description: Checks if the code is ready to be committed
---
- Run the `lint` and `test` commands and verify if everything is fine.
<lint>cargo +nightly fmt --all; cargo +nightly clippy --fix --allow-staged --allow-dirty --workspace</lint>
<test>cargo insta test --accept --unreferenced=delete</test>
- Fix every issue found in the process
Complete Sample Command
This sample demonstrates all three tag types:
---
name: sample-command
description: Sample command demonstrating the command file structure
---
This is a sample command that demonstrates the structure of command files.
- First step: Perform an initial action
<lint>echo "Running linting..."</lint>
- Second step: Execute tests
<test>echo "Running tests..."</test>
- Third step: Complete the workflow
<shell>echo "Workflow complete!"</shell>
- Final step: Verify everything worked correctly
Creating a New Command
Step 1: Determine Command Purpose
Identify what the command should accomplish:
- What task will it perform?
- What steps are involved?
- Are there automated checks or tests needed?
- What should the user do with the results?
Step 2: Choose Command Name
Use verb-based names with hyphens for multi-word commands:
- Good:
check,fixme,pr-description,run-tests - Bad:
checker,fixing,PRdescription
Step 3: Write the Command File
Create the file in the <cwd>/.forge/commands directory with the format: {command-name}.md
IMPORTANT: The file MUST be in <cwd>/.forge/commands where <cwd> is your current working directory. Commands placed anywhere else will not be discovered by forge.
Frontmatter
---
name: your-command-name
description: Clear, concise description of what this command does
---
Command Body
Use markdown lists for steps. Each step should:
- Start with a clear action verb
- Be specific and actionable
- Include context about what to do
Special Command Tags
Use these tags for automated workflows:
<lint> Tag
For linting/formatting commands:
<lint>cargo +nightly fmt --all; cargo +nightly clippy --fix --allow-staged --allow-dirty --workspace</lint>
<test> Tag
For testing commands:
<test>cargo insta test --accept --unreferenced=delete</test>
<shell> Tag
For general shell commands (not linting or testing):
<shell>rm -rf target/debug</shell>
Using Tags
Tags should be placed on their own line after the step description:
- Run linting and testing
<lint>your-lint-command</lint>
<test>your-test-command</test>
Command Types
Simple Commands
Single-step or instruction-only commands:
---
name: fixme
description: Looks for all the fixme comments in the code and attempts to fix them
---
Find all the FIXME comments in source-code files and attempt to fix them.
Multi-Step Commands
Commands with multiple sequential steps:
---
name: pr-description
description: Updates the description of the PR
---
- I have created a Pull Request with all the accepted changes
- Understand the current PR deeply using the GH CLI and update the PR title and description
- Make sure the title follows conventional commits standard
- Top-level summary should contain 2-3 lines about the core functionality improvements
Automated Workflow Commands
Commands that include automated checks:
---
name: check
description:
常见问题
命令保存在哪里?
保存在项目的 forge 文件夹下的 commands 文件夹中。
什么是特殊标签?
像 lint 或 test 这样的标签会标记某个步骤,由 Forge 在项目中作为命令运行。
命令需要名称吗?
需要。头部必须有名称,多个单词的名称使用连字符连接。
详情
作者的原始描述
Create new commands for the code-forge application. Commands are stored as .md files in the <cwd>/.forge/commands directory with YAML frontmatter (name, description) and markdown body containing command steps. Use when users need to add new commands, modify existing commands, or understand the command file structure. Supports special command tags like <lint> and <test> for automated workflows.
repo: tailcallhq/forgecode
热度
- GitHub 星标
- 7.6k
- 排名
- #13109
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
create-agent
7.6k教你的智能体为 Forge 编程应用创建或修改自定义智能体,这些智能体以 markdown 文件保存,顶部为设置。
create-github-issue
7.6k帮你的智能体提交一个遵循代码仓库自身议题模板的 GitHub 议题,并填写正确的字段和标签。
create-plan
7.6k帮你的智能体在修改任何代码之前,为一项复杂任务编写详细的实施计划,包括步骤、风险和备选方案。
github-pr-comments
7.6k帮你的智能体处理 GitHub 拉取请求上的每一条行内评论,逐一完成每项要求的修改。