部署与云(DevOps)10k · #12003
speckit-git-validate
它能做什么
这个技能检查你当前的 Git 分支名是否遵循项目使用的编号格式。适合在功能分支中使用 Spec Kit 方法的开发者。
适用场景
- ✓你想在修改前确认自己在正确的功能分支上工作的时候。
- ✓分支名看起来不符合项目的功能命名格式的时候。
- ✓你想确认与分支对应的规格文件夹是否存在的时候。
技能链接
https://github.com/unoplatform/uno/blob/master/.claude/skills/speckit-git-validate/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
请用这个技能帮我:https://github.com/unoplatform/uno/blob/master/.claude/skills/speckit-git-validate/SKILL.md
阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
npx skills add unoplatform/uno --skill speckit-git-validate
下载 SKILL.md,放进智能体的技能文件夹。
curl -L https://raw.githubusercontent.com/unoplatform/uno/master/.claude/skills/speckit-git-validate/SKILL.md -o SKILL.md
可以这样问 AI
“请检查我当前的 Git 分支是否符合我们的功能命名规则,并确认其规格文件夹是否存在。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能读取当前分支名,并对照两种可接受的格式进行检查。然后查找编号或时间戳相同的规格文件夹。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Validate Feature Branch
Validate that the current Git branch follows the expected feature branch naming conventions.
Prerequisites
- Check if Git is available by running
git rev-parse --is-inside-work-tree 2>/dev/null - If Git is not available, output a warning and skip validation:
[specify] Warning: Git repository not detected; skipped branch validation
Validation Rules
Get the current branch name:
git rev-parse --abbrev-ref HEAD
The branch name must match one of these patterns:
- Sequential:
^[0-9]{3,}-(e.g.,001-feature-name,042-fix-bug,1000-big-feature) - Timestamp:
^[0-9]{8}-[0-9]{6}-(e.g.,20260319-143022-feature-name)
Execution
If on a feature branch (matches either pattern):
- Output:
✓ On feature branch: <branch-name> - Check if the corresponding spec directory exists under
specs/:- For sequential branches, look for
specs/<prefix>-*where prefix matches the numeric portion - For timestamp branches, look for
specs/<prefix>-*where prefix matches theYYYYMMDD-HHMMSSportion
- For sequential branches, look for
- If spec directory exists:
✓ Spec directory found: <path> - If spec directory missing:
⚠ No spec directory found for prefix <prefix>
If NOT on a feature branch:
- Output:
✗ Not on a feature branch. Current branch: <branch-name> - Output:
Feature branches should be named like: 001-feature-name or 20260319-143022-feature-name
Graceful Degradation
If Git is not installed or the directory is not a Git repository:
- Check the
SPECIFY_FEATUREenvironment variable as a fallback - If set, validate that value against the naming patterns
- If not set, skip validation with a warning
常见问题
接受哪些命名格式?
分支名可以以三位或更多位数字开头,也可以以日期和时间戳开头。
如果我不在功能分支上会怎样?
这个技能会说明这一点,并给出可用的示例名称。
如果规格文件夹缺失怎么办?
这个技能会提醒你,没有找到对应的规格文件夹。
详情
热度
- GitHub 星标
- 10k
- 排名
- #12003
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …