generate-run-commands
GitHub协助用户为当前会话设置或修改运行命令,这些命令将显示在 Run 按钮中。通过读取 tasks.json 判断是新增还是修改,若无现有命令则自动推断项目配置生成安装或启动指令,否则询问用户意图并更新文件。
触发场景
安装
npx skills add asJEI/vscode --skill generate-run-commands -g -y
SKILL.md
Frontmatter
{
"name": "generate-run-commands",
"description": "Generate or modify run commands for the current session. Use when the user wants to set up or update run commands that appear in the session's Run button."
}
Generate Run Commands
Help the user set up run commands for the current Agent Session workspace. Run commands appear in the session's Run button in the title bar.
Understanding the task schema
A run command is a tasks.json task with:
"inAgents": true— required: makes the task appear in the Agents run button"runOptions": { "runOn": "worktreeCreated" }— optional: auto-runs the task whenever a new worktree is created (use for setup/install commands)
{
"tasks": [
{
"label": "Install dependencies",
"type": "shell",
"command": "npm install",
"inAgents": true,
"runOptions": { "runOn": "worktreeCreated" }
},
{
"label": "Start dev server",
"type": "shell",
"command": "npm run dev",
"inAgents": true
}
]
}
Decision logic
First, read the existing .vscode/tasks.json to check for existing run commands (inAgents: true tasks).
If run commands already exist: treat this as a modify request — ask the user what they'd like to change (add, remove, or update a command).
If no run commands exist: try to infer the right commands from the workspace:
- Check
package.json,Makefile,pyproject.toml,Cargo.toml,go.mod,.nvmrc, or other project files to understand the stack and common commands. - If it's clear what the setup command is (e.g.,
npm install,pip install -r requirements.txt), add it with"runOptions": { "runOn": "worktreeCreated" }— no need to ask. - If it's clear what the primary run/dev command is (e.g.,
npm run dev,cargo run), add it with just"inAgents": true. - Only ask the user if the commands are ambiguous (e.g., multiple equally valid options, no recognizable project structure, or the project uses a non-standard setup).
Writing the file
Always write to .vscode/tasks.json in the workspace root. If the file already exists, merge — do not overwrite unrelated tasks.
After writing, briefly confirm what was added and how to trigger it from the Run button.
版本历史
- ce4db66 当前 2026-07-19 08:58


