mcpField
G
github-workflow

github-workflow

github.com/transilienceai开发607186 次安装14 周前更新
代码仓库

关于 github-workflow

用于处理 GitHub 开发任务的技能,涵盖创建分支、提交、推送、拉取请求、问题和代码审查。它提供操作流程,并针对仓库状态、提交规范、机密信息和发布变更设定防护规则。

主要功能

  1. 01分支与提交工作流
  2. 02推送及创建拉取请求
  3. 03创建并关联问题
  4. 04拉取请求审查命令
  5. 05仓库状态与机密防护

适用场景

  1. 01创建功能分支并进行规范提交
  2. 02创建关联问题的拉取请求
  3. 03审查拉取请求及其检查结果

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/transilienceai/communitytools --skill github-workflow

安装后在 Claude Code 中输入/github-workflow确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

reference/
branch-strategy.md
commit-conventions.md
pr-workflow.md

详细介绍

GitHub 工作流

自动化完整的 GitHub 开发生命周期:分支、提交、推送、PR、议题和代码审查。

快速开始

  1. 用户请求执行 git 操作(提交、PR、分支、推送、议题)
  2. 检查仓库状态:git status、git branch、git log --oneline -5
  3. 执行下方相应的工作流
  4. 向用户确认结果

工作流

1. 分支管理
# Create feature branch from main
git checkout main && git pull origin main
git checkout -b <type>/<name>
# Types: feature/, bugfix/, docs/, refactor/, test/, chore/
  • 始终从最新的 main 创建分支
  • 使用规范的命名方式:feature/add-jwt-testing、bugfix/fix-port-detection
2. 提交
# Stage specific files (never git add -A blindly)
git add <file1> <file2>
# Commit with conventional format
git commit -m "type(scope): description"
  • 类型:feat、fix、docs、refactor、test、chore
  • 提交信息聚焦于原因,而非具体内容
  • 切勿提交 .env、凭据或密钥
  • 请参阅 reference/commit-conventions.md
3. 推送
# First push (set upstream)
git push -u origin <branch-name>
# Subsequent pushes
git push
  • 未经用户明确批准,切勿强制推送到 main/master
  • 如果推送被拒绝,先执行 git pull --rebase
4. 拉取请求
# Create PR linking to issue
gh pr create --title "Short title < 70 chars" --body "$(cat <<'EOF'
## Summary
- What changed and why

## Test plan
- [ ] How to verify

Fixes #<issue-number>
EOF
)"
  • 标题少于 70 个字符,详情写在正文中
  • 始终关联议题:Fixes #N 或 Closes #N
  • 请参阅 reference/pr-workflow.md
5. 议题
gh issue create --title "type: description" --body "$(cat <<'EOF'
## Problem
What needs to change

## Proposed solution
How to fix it

## Acceptance criteria
- [ ] Criteria 1
EOF
)"
6. 代码审查
# Review a PR
gh pr view <number>
gh pr diff <number>
gh pr checks <number>
# Comment or approve
gh pr review <number> --approve
gh pr review <number> --comment --body "feedback"

参考资料

关键规则

  • 绝不未经用户明确批准就强制推送到 main/master
  • 绝不提交密钥、.env 文件或凭据
  • 绝不在未检查暂存内容的情况下使用 git add -A
  • 绝不跳过提交前钩子(--no-verify),除非用户明确要求
  • 绝不修改已发布的提交;应创建新提交
  • 始终使用规范的提交格式:type(scope): description
  • 始终将 PR 与议题关联
  • 始终在提交前检查 git status
  • 始终在推送前拉取,以避免冲突
  • 始终从最新的 main 创建分支

评论

支持 Markdown