跳到正文
Skillpedia
部署与云(DevOps)48k · #4737

git-pr-workflows-git-workflow

它能做什么

这个智能体(agent)帮你整理代码修改的提交和审查流程。它会确保代码经过测试、记录完整,并在遵守项目规则的前提下,发起一个拉取请求。

适用场景

  • ✓写完代码,希望提交给他人审查时。
  • ✓项目对代码提交和测试有严格规定时。
  • ✓想在修改完成后自动创建拉取请求时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/git-pr-workflows-git-workflow/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/git-pr-workflows-git-workflow/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我想提交最新的修改以供审查,先把所有内容测试一遍,然后向主分支创建一个拉取请求。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会先检查你代码的当前状态和项目规则,然后运行测试和验证,在新分支上整理你的修改,最后附上所有必要信息,创建拉取请求。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Guarded Git Pull Request Workflow

Move completed changes from local review to a verified pull request without bypassing repository policy or branch protection.

When to Use

Use for completed implementation work that must be reviewed, tested, committed, pushed to a topic branch, and opened as a pull request. Use the repository's dedicated maintainer or release workflow instead when one is mandatory.

Policy Gate

Before mutation:

  1. Read AGENTS.md, contribution guidance, maintainer docs, and relevant nested instructions.
  2. Inspect the current branch, worktree, remotes, upstream, and effective target-branch protection.
  3. Discover repository-native validation, commit, PR, merge, and release commands.
  4. Preserve unrelated dirty and staged files.

Repository policy wins over flags and user shorthand. Trunk-based development does not imply a direct push: when the target is protected, use a short-lived branch and pull request. If a repository defines a mandatory maintainer skill or guarded merge command, hand off merge and release actions to it. In agentic-awesome-skills, use antigravity-maintainer-batch-release and npm run merge:batch.

Inputs

Resolve these from the request and repository:

  • target branch, defaulting to the repository default branch;
  • intended changed files and excluded user work;
  • required test, lint, security, build, and documentation checks;
  • branch naming and commit-message conventions;
  • draft or ready-for-review PR state;
  • required reviewers, labels, issue links, and merge method.

Ask only when a missing choice changes the result materially.

Workflow

1. Capture the exact change

git status --short --branch
git diff --stat
git diff --cached --stat
git branch --show-current
git remote -v

Confirm every file in scope. Stop if staged or dirty files cannot be separated safely.

2. Review in parallel

When subagents are available and authorized, assign independent bounded passes for:

  • correctness and regression risk;
  • security, secrets, permissions, and dependency risk;
  • test coverage and repository-policy compliance.

Give each reviewer the raw diff and repository instructions. Keep the main agent responsible for deduplication, severity, edits, and final verification.

3. Validate and repair

Run the repository's targeted checks, then its required pre-PR suite. If a check fails:

  1. identify whether the cause is source, policy, environment, or infrastructure;
  2. fix only source or policy defects in scope;
  3. rerun the targeted failure;
  4. rerun the complete required suite.

Do not weaken gates, hide skipped tests, or treat deterministic failures as flaky.

4. Prepare the branch and commit

Fetch the target before committing. If currently on a protected/default branch, create a topic branch before mutation.

git fetch origin <target-branch>
git switch -c <topic-branch> origin/<target-branch>
git status --short --branch

Stage only intended paths and create focused conventional commits according to repository policy. Rebase or update the topic branch when strict required checks demand the latest target; never force a shared branch without explicit authorization.

5. Push and create the pull request

git push -u origin <topic-branch>
gh pr create --base <target-branch> --head <topic-branch> \
  --title "<conventional title>" --body-file <body-file>

The PR body must truthfully include:

  • what changed and why;
  • tests and validation actually run;
  • risk, deployment, rollback, and breaking-change notes when applicable;
  • issue links, screenshots, and repository checklists when applicable.

Never mark a pending automated review or test as completed.

6. Verify the remote result

gh pr view <pr-number> --json headRefOid,baseRefOid,mergeable,mergeStateStatus,url
gh pr checks <pr-number>

Bind review evidence to the current full head SHA. If the head or base changes, discard stale conclusions and rerun affected checks.

Use the repository's guarded merge path. Do not replace required checks, merge queues, exact-SHA attestations, or maintainer commands with a raw merge API. After merge, fetch the target and verify the requested remote, CI, deployment, or release state.

Stop Condition

…

常见问题

什么是拉取请求?

它是一项请求,希望把你的代码修改合并进主项目。在被接受之前,其他人可以先审查你的代码。

什么是分支?

分支就像项目的平行副本,你可以在上面开发新功能或修复问题,而不影响主代码。之后再把你的修改合并回去即可。

如果测试失败了怎么办?

如果问题与你的代码或项目规则有关,智能体会尝试找出原因并修复。如果重要的测试没有通过,它就不会继续往下执行。

详情

作者的原始描述

Orchestrate review, tests, commits, branch pushes, and pull-request creation with parallel agents. Use when completed changes must move through validation into a PR or guarded merge.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4737
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能