Agent 生成器
- 作者仓库星标 435
- 作者更新于 实时读取
- 作者仓库 nvim
- 领域
- 运维部署
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @benbrastmckie · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: skill-tag
description: Create and push semantic version tags for CI/CD deployment. User-only command - agents cannot in…
category: 运维部署
runtime: 无特殊运行时
---
# skill-tag 输出预览
## PART A: 任务判断
- 适用问题:部署、CI、环境检查、发布或运维排障。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Command Syntax / Execution / Step 1: Parse Arguments”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于部署、CI、环境检查、发布或运维排障,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Command Syntax / Execution / Step 1: Parse Arguments”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/tag` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Command Syntax / Execution / Step 1: Parse Arguments”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: skill-tag
description: Create and push semantic version tags for CI/CD deployment. User-only command - agents cannot in…
category: 运维部署
source: benbrastmckie/nvim
---
# skill-tag
## 什么时候使用
- 把部署运维方向的常用动作沉淀成 Agent 可调用的技能 适合处理部署、CI、发布、回滚、环境检查和运维排障,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤…
- 面向部署、CI、环境检查、发布或运维排障,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Command Syntax / Execution / Step 1: Parse Arguments」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "skill-tag" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Command Syntax / Execution / Step 1: Parse Arguments
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Tag Skill (Direct Execution)
Direct execution skill for creating and pushing semantic version tags to trigger CI/CD deployment. This command is user-only - agents MUST NOT invoke it.
CRITICAL: Deployment timing is user-controlled. This command creates and pushes git tags which immediately trigger CI/CD deployment to production.
Command Syntax
/tag [--patch|--minor|--major] [--force] [--dry-run]
| Flag | Description |
|---|---|
--patch |
Increment patch version (default): v0.2.3 -> v0.2.4 |
--minor |
Increment minor version, reset patch: v0.2.3 -> v0.3.0 |
--major |
Increment major version, reset minor and patch: v0.2.3 -> v1.0.0 |
--force |
Skip confirmation prompt |
--dry-run |
Show what would be done without executing |
Execution
Step 1: Parse Arguments
Extract flags from command input:
# Parse from command input
increment="patch" # default
force=false
dry_run=false
if [[ "$*" == *"--minor"* ]]; then
increment="minor"
fi
if [[ "$*" == *"--major"* ]]; then
increment="major"
fi
if [[ "$*" == *"--force"* ]]; then
force=true
fi
if [[ "$*" == *"--dry-run"* ]]; then
dry_run=true
fi
Step 2: Validate Git State
Check that the repository is in a valid state for tagging:
echo "=== Validating Git State ==="
echo ""
# Check for uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
echo "Error: Working tree has uncommitted changes."
echo ""
echo "Uncommitted files:"
git status --short
echo ""
echo "Resolution: Commit or stash changes before tagging."
exit 1
fi
# Check if we're on a branch
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" = "HEAD" ]; then
echo "Error: Detached HEAD state. Checkout a branch before tagging."
exit 1
fi
# Check if local is behind remote
git fetch origin "$current_branch" --quiet 2>/dev/null || true
local_sha=$(git rev-parse HEAD)
remote_sha=$(git rev-parse "origin/$current_branch" 2>/dev/null || echo "")
if [ -n "$remote_sha" ] && [ "$local_sha" != "$remote_sha" ]; then
# Check if we're behind
behind=$(git rev-list --count "HEAD..origin/$current_branch" 2>/dev/null || echo "0")
if [ "$behind" -gt 0 ]; then
echo "Error: Local branch is $behind commit(s) behind remote."
echo ""
echo "Resolution: Pull latest changes with 'git pull' before tagging."
exit 1
fi
fi
echo "Git state: OK (clean working tree, up-to-date with remote)"
Step 3: Compute New Version
Get current version and compute new version based on increment type:
echo ""
echo "=== Computing Version ==="
echo ""
# Get current version (latest tag)
current_version=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "Current version: $current_version"
# Parse version components
major=$(echo "$current_version" | sed 's/v\([0-9]*\).*/\1/')
minor=$(echo "$current_version" | sed 's/v[0-9]*\.\([0-9]*\).*/\1/')
patch=$(echo "$current_version" | sed 's/v[0-9]*\.[0-9]*\.\([0-9]*\)/\1/')
# Increment based on type
case "$increment" in
patch)
patch=$((patch + 1))
;;
minor)
minor=$((minor + 1))
patch=0
;;
major)
major=$((major + 1))
minor=0
patch=0
;;
esac
new_version="v${major}.${minor}.${patch}"
echo "New version: $new_version ($increment release)"
# Check if tag already exists
if git rev-parse "$new_version" >/dev/null 2>&1; then
echo ""
echo "Error: Tag $new_version already exists."
echo ""
echo "Existing tags:"
git tag -l 'v*' --sort=-v:refname | head -5
echo ""
echo "Resolution: Use a different increment type or check tag history."
exit 1
fi
Step 4: Display Summary
Show what will be deployed:
echo ""
echo "=== Deployment Summary ==="
echo ""
echo "Version: $current_version -> $new_version"
echo "Branch: $current_branch"
echo "Commit: $(git rev-parse --short HEAD)"
echo ""
# Show commits since last tag
commits_since=$(git log "$current_version"..HEAD --oneline 2>/dev/null | wc -l)
if [ "$commits_since" -gt 0 ]; then
echo "Commits since $current_version ($commits_since total):"
git log "$current_version"..HEAD --oneline | head -10
if [ "$commits_since" -gt 10 ]; then
echo " ... and $((commits_since - 10)) more"
fi
else
echo "No commits since $current_version"
fi
echo ""
echo "This will trigger CI/CD deployment to production."
Step 5: Execute Based on Mode
Dry-Run Mode
If --dry-run is set:
if [ "$dry_run" = true ]; then
echo ""
echo "=== DRY RUN MODE ==="
echo ""
echo "Would execute:"
echo " git tag $new_version"
echo " git push origin $new_version"
echo ""
echo "No changes made."
exit 0
fi
Force Mode
If --force is set, skip confirmation and proceed to Step 6.
Interactive Mode (Default)
If neither flag is set, prompt for confirmation using AskUserQuestion:
{
"question": "Create and push version tag?",
"header": "Version Tag Confirmation",
"multiSelect": false,
"options": [
{
"label": "Yes, create and push {new_version}",
"description": "Triggers CI/CD deployment to production"
},
{
"label": "No, cancel",
"description": "Do not create tag"
}
]
}
If user selects "No, cancel":
echo ""
echo "Tag creation cancelled."
exit 0
Step 6: Create and Push Tag
Create the tag locally:
echo ""
echo "=== Creating Tag ==="
echo ""
# Create tag
if ! git tag "$new_version"; then
echo "Error: Failed to create tag $new_version"
exit 1
fi
echo "Created tag: $new_version"
Push the tag to remote:
echo ""
echo "=== Pushing Tag ==="
echo ""
# Push tag to origin
if ! git push origin "$new_version"; then
echo ""
echo "Error: Failed to push tag to remote."
echo ""
echo "The tag was created locally but not pushed."
echo "To recover:"
echo " 1. Fix network/auth issues"
echo " 2. Run: git push origin $new_version"
echo ""
echo "Or to undo the local tag:"
echo " git tag -d $new_version"
exit 1
fi
echo "Pushed tag: $new_version to origin"
Step 7: Update state.json
Update the deployment_versions section in state.json:
echo ""
echo "=== Updating State ==="
echo ""
state_file="specs/state.json"
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
commit_sha=$(git rev-parse HEAD)
mkdir -p specs/tmp
# Check if deployment_versions section exists
if jq -e '.deployment_versions' "$state_file" >/dev/null 2>&1; then
# Update existing section
jq --arg version "$new_version" \
--arg timestamp "$timestamp" \
--arg sha "$commit_sha" \
'.deployment_versions.last_deployed = $version |
.deployment_versions.last_deployed_at = $timestamp |
.deployment_versions.deployment_history = ([{
"version": $version,
"deployed_at": $timestamp,
"commit_sha": $sha
}] + .deployment_versions.deployment_history[0:9])' \
"$state_file" > "specs/tmp/state.json" && mv "specs/tmp/state.json" "$state_file"
else
# Create new section
jq --arg version "$new_version" \
--arg timestamp "$timestamp" \
--arg sha "$commit_sha" \
'.deployment_versions = {
"last_deployed": $version,
"last_deployed_at": $timestamp,
"deployment_history": [{
"version": $version,
"deployed_at": $timestamp,
"commit_sha": $sha
}]
}' \
"$state_file" > "specs/tmp/state.json" && mv "specs/tmp/state.json" "$state_file"
fi
echo "Updated state.json with deployment version $new_version"
Step 8: Display Success
Show completion message with next steps:
echo ""
echo "========================================"
echo " Tag Created and Pushed Successfully"
echo "========================================"
echo ""
echo "Version: $new_version"
echo "Commit: $(git rev-parse --short HEAD)"
echo "Pushed to: origin"
echo ""
echo "CI/CD deployment has been triggered."
echo ""
echo "Verify deployment:"
echo " - CI/CD pipeline: Check pipeline status in your CI provider"
echo " - Hosting platform: Check deployment status"
echo " - Live site: Verify changes are live"
echo ""
Error Handling
Dirty Working Tree
=== Validating Git State ===
Error: Working tree has uncommitted changes.
Uncommitted files:
M src/pages/index.astro
?? src/components/New.astro
Resolution: Commit or stash changes before tagging.
Behind Remote
=== Validating Git State ===
Error: Local branch is 3 commit(s) behind remote.
Resolution: Pull latest changes with 'git pull' before tagging.
Tag Already Exists
=== Computing Version ===
Current version: v0.2.3
New version: v0.2.4 (patch release)
Error: Tag v0.2.4 already exists.
Existing tags:
v0.2.4
v0.2.3
v0.2.2
v0.2.1
v0.2.0
Resolution: Use a different increment type or check tag history.
Agent Restrictions
CRITICAL: This command is user-only. Agents MUST NOT invoke /tag.
Enforcement layers:
- Frontmatter flag:
user-only: truein skill YAML - Documentation: Clear CRITICAL warnings in this file
- No agent mapping: Not listed in Skill-to-Agent Mapping table in AGENTS.md
Rationale: Deployment timing is a business decision that requires human judgment. Agents prepare code changes but never control when those changes go to production.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核