技能工作流程
- 作者仓库星标 435
- 作者仓库 nvim
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @benbrastmckie · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 读取环境变量
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Git Workflow Skill
Create properly scoped git commits for task operations.
## Context Loading
Load context on-demand when needed:
- `@.claude/context/standards/git-safety.md` - Git safety rules and best practices
- `@.claude/context/index.json` - Full context discovery index
## Trigger Conditions
This skill activates when:
- Task status changes (research, plan, implement complete)
- Artifacts are created
- Task lifecycle operations occur
## Commit Message Formats
### Task Operations
| Operation | Format | CI Triggered |
|-----------|--------|--------------|
| Create task | `task {N}: create {title}` | No |
| Complete research | `task {N}: complete research` | No |
| Create plan | `task {N}: create implementation plan` | No |
| Complete phase | `task {N} phase {P}: {phase_name}` | No |
| Complete task | `task {N}: complete implementation` | No |
| Complete task (with CI) | `task {N}: complete implementation [ci]` | Yes |
| Revise plan | `task {N}: revise plan (v{V})` | No |
### System Operations
| Operation | Format |
|-----------|--------|
| Archive tasks | `todo: archive {N} completed tasks` |
| Error fixes | `errors: create fix plan for {N} errors` |
| Code review | `review: {scope} code review` |
| State sync | `sync: reconcile TODO.md and state.json` |
## Execution Flow
```
1. Receive commit request:
- operation_type
- task_number (if applicable)
- scope (files to include)
- message_template
2. Stage appropriate files:
- git add {scope}
3. Create commit:
- Format message
- Add co-author
- Execute commit
4. Verify success:
- Check exit code
- Log result
5. Return result
```
## Commit Scope Rules
### Task-Specific Commits
Include only task-related files:
```
specs/TODO.md
specs/state.json
specs/{NNN}_{SLUG}/**
```
### Implementation Commits
Include source files modified:
```
Logos/**/*.lean (for Lean tasks)
src/**/* (for general tasks)
```
### Phase Commits
Scope to phase changes only:
```
Files modified in that phase
Updated plan with phase status
```
## Safety Checks
### Before Commit
```
1. git status - verify staged files
2. Check no sensitive files staged (.env, credentials)
3. Verify commit message format
```
### Never Run
- `git push --force`
- `git reset --hard` (without explicit request)
- `git rebase -i`
## Message Template
```
{scope}: {action} {description}
```
## CI Triggering
### Overview
CI is **skipped by default** on push events. To trigger CI, add `[ci]` marker to the commit message.
### trigger_ci Parameter
When creating commits, the `trigger_ci` parameter controls whether CI runs:
| Value | Behavior | Use Case |
|-------|----------|----------|
| `false` (default) | No CI marker added | Routine commits, research, planning |
| `true` | Append `[ci]` to message | Lean changes, implementation completion |
### CI Decision Criteria
Trigger CI (`trigger_ci: true`) when:
- **Lean files modified** (.lean) - Ensures build passes
- **Implementation completed** - Final verification before merge
- **CI configuration changed** (.github/workflows/) - Validate workflow changes
- **Mathlib dependencies updated** (lakefile.lean, lake-manifest.json) - Ensure compatibility
- **Critical bug fixes** - Verify fix works
Skip CI (default) when:
- Documentation changes only (.md files)
- Research/planning artifacts
- Configuration changes (non-CI)
- Routine task management operations
### Commit Message with CI Marker
```
task {N}: complete implementation [ci]
```
### When CI Always Runs
CI runs regardless of marker on:
- Pull request events (all PRs run CI)
- Manual workflow_dispatch trigger
- Commits with `[ci]` marker
## Execution Commands
### Standard Commit
```bash
git add {files}
git commit -m "$(cat <<'EOF'
{message}
EOF
)"
```
### Task Commit
```bash
git add specs/
git commit -m "$(cat <<'EOF'
task {N}: {action}
EOF
)"
```
## Return Format
```json
{
"status": "completed|failed",
"summary": "Created commit: {short_message}",
"commit_hash": "abc123",
"files_committed": [
"path/to/file1",
"path/to/file2"
],
"message": "Full commit message",
"ci_triggered": true|false
}
```
## Error Handling
### Nothing to Commit
```json
{
"status": "committed",
"summary": "No changes to commit",
"commit_hash": null
}
```
### Pre-Commit Hook Failure
```json
{
"status": "failed",
"error": "Pre-commit hook failed",
"recovery": "Fix issues and retry (do not use --no-verify)"
}
```
### Git Error
```json
{
"status": "failed",
"error": "Git command failed: {error}",
"recovery": "Check git status and resolve manually"
}
```
## Non-Blocking Behavior
Git failures should NOT block task operations:
- Log the failure
- Continue with task
- Report to user that commit failed
- Task state is preserved regardless
章节与文件索引
按说明文件中的顺序排列。
上下文加载
触发条件
任务操作
系统操作
特定于任务的提交
文件/命令 -> @.claude/context/standards/git-safety.md · @.claude/context/index.json · task {N}: create {title} · task {N}: complete research · task {N}: create implementation plan · task {N} phase {P}: {phase_name} · task {N}: complete implementation · task {N}: complete implementation [ci]
内容校验值 -> 5fac3b8933e8
当前原文的自动摘译,尚未人工审校。
上下文加载
在需要时按需加载上下文:
@.claude/context/standards/git-safety.md- Git 安全规则和最佳实践@.claude/context/index.json- 完整的上下文发现索引触发条件
该技能在以下情况下激活: 任务状态发生变化(研究、计划、实施完成) 创建工件 发生任务生命周期操作
任务操作
操作 · 格式 · CI 触发 创建任务 ·
task {N}: create {title}· 否 完成研究 ·task {N}: complete research· 否 创建计划 ·task {N}: create implementation plan· 否 完成阶段 ·task {N} phase {P}: {phase_name}· 否系统操作
操作 · 格式化存档任务 ·
todo: archive {N} completed tasks错误修复 ·errors: create fix plan for {N} errors代码审查 ·review: {scope} code review状态同步 ·sync: reconcile TODO.md and state.json特定于任务的提交
仅包含与任务相关的文件: