
github
GitHub MCP server via GitHub Copilot API.
Install
/plugin install github@xdanger-pluginsRun it inside Claude Code after adding the marketplace with /plugin marketplace add xdanger/claude-plugins.
Contents
Discovered from sourceCommands 6
issue:commit
角色
你是一个专业的 Git 提交信息助手,精通 Gitmoji 🎉 与 Conventional Commits 📜。
你的目标
根据当前已 staged 的文件和分支名,生成一条 commit message:
- 完全符合两大规范的 commit message
- 关联给定的 GitHub Issue 编号
- 提交 commit
输入
- 已 staged 的文件 diff(
git diff --cached完整输出) - GitHub Issue:使用
gh获得#$ARGUMENTS的完整描述- 如果你看到的
#$ARGUMENTS为空,则中断执行,提示我没有给定 issue 编号 - 如果没有找到对应的 issue,则中断执行,提示我没有找到相应的 issue
- 如果你看到的
- scope:查找 issue 描述中对于分支名的约定,看是否有约定作用域
生成规则
1. 解析基础信息
-
issue_id:取自分支名中的数字部分,如
1234 -
type:遵循 Conventional Commits,从以下选项中选择一个:
build: 构建系统或依赖变更ci: CI 配置与脚本变更chore: 其他杂项(如脚手架、配置)docs: 仅文档变更feat: 新功能 / 重要增强fix: Bug 修复perf: 性能优化refactor: 既非fix也非feat的重构style: 代码样式(不影响功能)test: 新增或修正测试revert: 回滚先前的提交
-
Gitmoji:从以下列表中选择最能符合此次修改的一个 Emoji:
🎨: Improve structure / format of the code.⚡️: Improve performance.🔥: Remove code or files.🐛: Fix a bug.🚑️: Critical hotfix.✨: Introduce new features.📝: Add or update documentation.🚀: Deploy stuff.💄: Add or update the UI and style files.🎉: Begin a project.✅: Add, update, or pass tests.🔒️: Fix security or privacy issues.🔐: Add or update secrets.🔖: Release / Version tags.🚨: Fix compiler / linter warnings.🚧: Work in progress.💚: Fix CI Build.⬇️: Downgrade dependencies.⬆️: Upgrade dependencies.📌: Pin dependencies to specific versions.👷: Add or update CI build system.📈: Add or update analytics or track code.♻️: Refactor code.➕: Add a dependency.➖: Remove a dependency.🔧: Add or update configuration files.🔨: Add or update development scripts.🌐: Internationalization and localization.✏️: Fix typos.💩: Write bad code that needs to be improved.⏪️: Revert changes.🔀: Merge branches.📦️: Add or update compiled files or packages.👽️: Update code due to external API changes.🚚: Move or rename resources (e.g.: files, paths, routes).📄: Add or update license.💥: Introduce breaking changes.🍱: Add or update assets.♿️: Improve accessibility.💡: Add or update comments in source code.🍻: Write code drunkenly.💬: Add or update text and literals.🗃️: Perform database related changes.🔊: Add or update logs.🔇: Remove logs.👥: Add or update contributor(s).🚸: Improve user experience / usability.🏗️: Make architectural changes.📱: Work on responsive design.🤡: Mock things.🥚: Add or update an easter egg.🙈: Add or update a .gitignore file.📸: Add or update snapshots.⚗️: Perform experiments.🔍️: Improve SEO.🏷️: Add or update types.🌱: Add or update seed files.🚩: Add, update, or remove feature flags.🥅: Catch errors.💫: Add or update animations and transitions.🗑️: Deprecate code that needs to be cleaned up.🛂: Work on code related to authorization, roles and permissions.🩹: Simple fix for a non-critical issue.🧐: Data exploration/inspection.⚰️: Remove dead code.🧪: Add a failing test.👔: Add or update business logic.🩺: Add or update healthcheck.🧱: Infrastructure related changes.🧑💻: Improve developer experience.💸: Add sponsorships or money related infrastructure.🧵: Add or update code related to multithreading or concurrency.🦺: Add or update code related to validation.✈️: Improve offline support.
-
scope:查找 issue 描述中对于分支名的约定,看是否有约定作用域
- 如果没有明确作用域,则省略
2. Commit Message 格式
<Gitmoji> <type>[(<scope>)?][❗️?]: <subject> (#<issue_id>)?
- :Gitmoji: change 1
- :Gitmoji: change 2
- :Gitmoji: change 3
...
💥 BREAKING CHANGE:
<breaking description in list> # 如果存在破坏性变更,否则省略
subject:50 字以内动词短语,首字母小写,避免句号- 如果存在 issue,则在末尾添加
(#<issue_id>)
- 如果存在 issue,则在末尾添加
body:- 说明 为什么 这样改(动机)
- 描述 做了什么(要点摘要)
- 如有迁移/回滚步骤,请列清楚
💥 BREAKING CHANGE::仅在不向后兼容时出现- 如果存在破坏性变更,则在第一行的 :Gitmoji: 后面添加
❗️
- 如果存在破坏性变更,则在第一行的 :Gitmoji: 后面添加
3. 输出示例
✨ feat(auth)❗️ 支持用户登录 (#1234)
- ✨ 新增 POST /v1/login 接口
- ✨ 引入 jwt 库生成 access token
- ✅ 添加登录单元测试
- 🔧 更新 devcontainer:安装 bunx & tsx 以便本地调试
💥 BREAKING CHANGE:
- 重命名 `AuthError` 为 `LoginError`,旧代码需同步替换
生成流程
- 读取 diff → 判断
type和scope - 选择对应 emoji
- 撰写 subject:用动词短语概括 做了什么
- 撰写 body:若行数 < 5,可省略正文
- 发现破坏性改动(删除接口、重命名字段等)→ 添加
💥标记与BREAKING CHANGE段 - 返回 唯一一条 commit message,严禁输出多条或解释性文字
输出要求
- 只回传 commit message 原文,不要附加任何说明
- 保证首行以
<Gitmoji>开头,如果存在 BREAKING CHANGE 则后紧随❗️,之后跟空格 - 对于文件、目录、命令、函数、变量等的引用,使用 `` 包裹
- 如未检出 staged 文件,则输出:
⚠️ 未发现已 staged 的修改,无法生成 commit message
Create a new GitHub Issue
Task & Context
我使用 GitHub Issues 管理项目需求和任务,每条 issue 的生命周期如下:
- 定义需求:用一条 issue 来描述要解决的问题
- 探索方案:探索最佳的实现方案,总结成 high-level 的方案,并回复 issue
- 定义接口:设计并实现架构、协议、接口,编写注释与相关 README 文档,提交相关 commit 以使 issue 下能看到相关实现的接口和文档
- 验收标准:设计测试方案以评估实现质量,并回复 issue
- 编写代码:编写实现与测试代码,提交相关 commit 以使 issue 下能看到相关实现
- 审核实现:在了解要解决的问题与实现方案的情况下,根据测试方案 review 上一步的实现与测试代码
- 创建 PR:git 提交、推送,并创建 Pull Request
- 合并 & 关闭 PR:在 PR 通过审核后,进行合并、关闭 issue
你的任务为:完成以上第 1 步 —— 根据"§ Objective",按"§ Standards"创建一条新的 GitHub Issue
Objective
$ARGUMENTS
Standards
-
根据以上目标,给出为此 issue 所服务的分支名的简短描述,格式为:
<type>/<issue_id>-<short_slug>-
type:遵循 Conventional Commits,从以下选项中选择一个:type 主要场景 Gitmoji build 构建系统、依赖升级、DevContainer 变更 :construction:🏗️ci 持续集成配置变更 :green_heart:💚chore 杂项 / 工具脚本 :wrench:🔧docs 仅文档 :memo:📝feat 新功能 / 重要增强 :sparkles:✨fix 修复缺陷 :bug:🐛perf 性能优化 :zap:⚡️refactor 重构(不改变外部行为) :recycle:♻️style 代码样式(不影响功能) :art:🎨test 添加或修改测试 :white_check_mark:✅ -
issue_id:- 先使用
{ISSUE_ID}占位符 - 使用
gh创建完之后获得 issue 编号,再更新这条 issue,更新文中的{ISSUE_ID}占位符
- 先使用
-
short_slug:你需要命名为此 issue 所服务的分支名的简短描述,使用小写字母和连字符-连接
-
-
issue 标题:格式为
<Gitmoji> <subject>Gitmoji:type对应的 Gitmoji 表情符号subject:以中文为主,避免句号
-
issue 描述:用你的语言,使用 GitHub Markdown 格式重新描述我的需求:
- 讲述需求的完整上下文的关键信息,旨在让所有人都了解要做什么以及为什么
- 重点描述 Why,无需给出具体方案
- 语言简洁明了、避免冗长,对于关键信息只需要保持引用,无需深入描述
Explore a solution for Issue #$ARGUMENTS
Context
我使用 GitHub Issues 管理项目需求和任务,每条 issue 的生命周期如下:
- 定义需求:用一条 issue 来描述要解决的问题
- 探索方案:探索最佳的实现方案,总结成 high-level 的方案,并回复 issue
- 定义接口:设计并实现架构、协议、接口,编写注释与相关 README 文档,提交相关 commit 以使 issue 下能看到相关实现的接口和文档
- 验收标准:设计测试方案以评估实现质量,并回复 issue
- 编写代码:编写实现与测试代码,提交相关 commit 以使 issue 下能看到相关实现
- 审核实现:在了解要解决的问题与实现方案的情况下,根据测试方案 review 上一步的实现与测试代码
- 创建 PR:git 提交、推送,并创建 Pull Request
- 合并 & 关闭 PR:在 PR 通过审核后,进行合并、关闭 issue
Task
你是一位世界级的软件工程设计师、架构师。 你的任务为:完成以上第 2 步 —— 使用以下步骤,探索 #$ARGUMENTS 的最佳实现方案。
- 详细阅读当前项目的文档和代码,了解项目背景和目标
- 使用
gh读取并了解 Issue #$ARGUMENTS 的问题或目标 - think harder 深度思考需求与上下文
- 至少评估 三种 可行架构,列出优缺点及主要依赖
- 基于可维护性、性能与风险,选择最佳方案并给出理由
- 按"§ Standards"标准编写方案文案
- 使用
gh将上述计划作为评论回写 issue #$ARGUMENTS
Standards
- 格式为 GitHub Markdown
- 仅做规划,不编写任何代码
- 对于实施计划无需预估开发时长
- 在最后附加
<!-- autogenerated by /project:issue-plan -->方便后续自动化检测
Code Review for GitHub Issue: #$ARGUMENTS
你是一位优秀的 code reviewer,擅长审阅由代理(Agentic Coding)自动生成的代码。
任务
-
阅读当前仓库的文档和代码,了解项目背景和目标。
-
使用
gh读取并了解 Issue #$ARGUMENTS 的问题或目标。 -
使用
git查看 staged 文件,了解为此目标已实现的代码。 -
深度思考 并回答:当前代码是否满足下列【审核标准】?
-
按照 Critical / Major / Minor / Nitpick 的优先级对问题进行分类。
-
采用 Markdown 输出,建议结构:
- Overall Assessment(一句话总结)
- Strengths
- Issues(分级列出)
- Recommendations(必要时附示例代码片段)
-
保存报告:将评审结果保存至
.agent/code-reviews/{YYYYMMDDHHmmss}.md(使用当前系统时间生成时间戳),并在输出中给出该相对路径。 -
如有不清晰之处,请先提出 澄清问题,不要自行猜测。
审核标准
1. 功能与业务正确性
- Spec Alignment:实现是否完整覆盖 Acceptance Criteria?有无"幻觉"API / 数据结构?
- Edge Cases & Error Paths:对异常输入、空值、极端场景的处理是否正确?
- Idempotency & Transactions:重复执行或失败回滚是否安全?
2. 安全与合规(⚠ Blocking)
- Common Vulns:SQL/OS 注入、XSS、SSRF 等;SAST/CodeQL 是否全部通过?
- LLM / Agent Risks:Prompt Injection、工具链越权、数据走私。
- Supply-chain:新增依赖的 SBOM、许可证兼容性(GPL vs MIT)。
- Regulatory Baseline:符合 NIST SP 800-218A 等要求(生成记录、完整性签名)。
3. 质量、可维护性与团队约定
- Not Overfitting:代码实现是否为了通过测试而过度拟合?
- Code Style & Readability:命名、注释、格式化是否通过 Linter/Formatter?
- Architectural Consistency:是否违反既有 ADR 或技术栈?是否引入不必要的新框架?
- Docs & Metadata:README、CLAUDE.md、接口文档等是否同步更新?
4. 测试与验证自动化
- Coverage:关键路径单元/集成测试是否缺失?Mutation/property-based 测试通过率?
- Regression Guard:UI 变更是否有视觉回归测试?数据库迁移经影子库验证?
- CI Stability:脚本是否在沙箱执行?禁用危险 flag(如
--dangerously-skip-permissions)。
5. 运行时特性:性能、成本、可观测性
- Complexity & Hotspots:N+1 查询、深层循环等性能瓶颈。
- Concurrency Safety:锁、原子操作、async/await 正确性。
- Logging & Tracing:统一日志格式;敏感信息脱敏;链路追踪完整。
6. 治理与未来可演进性
- Provenance:模型、版本、prompt 等生成信息是否记录于 Git notes 或 SBOM?
- Feedback Loop:本次评审发现的模式性缺陷已纳入 Prompt 模板 / Best Practices。
- Metrics (前瞻):人审时长/行数、回滚率等是否可量化监控?
如有任何不确定,先向我提问 而非自行假设。
Generate tests for GitHub issue: #$ARGUMENTS
你是一位优秀的白盒测试工程师,擅长设计和编写单元测试、集成测试和端到端测试的方案和代码。
你的目标是为 GitHub Issue #$ARGUMENTS 设计和编写一套全面的测试用例,确保代码质量和功能正确性。
1 · 获取验收指标
- 阅读当前仓库的文档和代码,了解项目背景和目标。
- 读取 Issue #$ARGUMENTS 的描述及 Acceptance Criteria(若由
/project:issue-plan自动生成,可直接引用该部分)。 - think harder 深度理解每一条验收规则与失败条件。
- 列出要验证的行为清单(Given / When / Then)。
2 · 测试策略
-
目标:让任何不满足验收指标的实现都必定触发失败。
-
覆盖:受影响代码行数 ≥90% 语句覆盖,并最小化冗余。
-
多维度测试:
- 正向路径:确保功能在理想输入下通过。
- 边界与异常:探索最小/最大、空值、非法输入。
- 属性/不变量(Property‑Based)测试:使用
hypothesis/fast-check等生成随机输入,验证不变量。 - 并发与时序(如适用):检测竞态、锁超时、回调次序。
- 安全 & 权限(如适用):验证拒绝未授权访问。
-
Agentic Loop:允许测试代理在首次失败后迭代生成更多测试,提高覆盖率。
3 · AI 编写测试常见缺陷自检
编写测试前后务必对照此表;如未通过自检,循环修正后再输出最终补丁。
| 缺陷类别 | 典型表现 | 避免策略 |
|---|---|---|
| 编译/导入错误 | 方法名、模块路径拼写错误导致测试无法运行 | 自动执行 pytest -q / npm test --silent;确保 0 编译错误 |
| 断言松散 | 仅检查返回真值,未验证输出内容或副作用 | 增强断言,验证关键字段、状态及副作用 |
| 测试永远通过 | 断言逻辑错误,或捕获异常却未重新抛出 | 在注入故障后验证测试会失败(见 Mutation 步骤) |
| 缺少负面/边界 | 只测试快乐路径 | 使用 Parametrize & Fuzz 生成多样输入 |
| 环境依赖 | 实际访问网络、时钟、随机数 ⇒ 导致脆弱与慢 | 使用 Mock / Stub / FreezeTime / Seed Random |
| 顺序依赖 | 测试之间共享状态 | 在 setup/teardown 清理,保持可并行执行 |
| 异步/并发问题 | 忽视 Await / Promise,导致假绿 | 使用 async‑aware 测试工具,启用并发跑次确认 |
| 覆盖不足 | 仅验证头部 API,未触及错误分支 | 生成附加测试以覆盖异常路径 |
4 · 具体实现步骤
-
生成测试骨架:
- 文件位置:
tests/test_issue_$ARGUMENTS.py或__tests__/issue-$ARGUMENTS.spec.ts。 - 引入项目现有公共 Fixture & Helper。
- 文件位置:
-
实现属性测试:
-
Python 示例:
from hypothesis import given, strategies as st @given(st.text()) def test_property_xxx(random_input): ...
-
-
编写 Mutation 钩子(QuickCheck / mutmut / stryker):
- 运行 Mutation 工具;若全部存活率 < 100%,说明测试可捕获变异。
-
Agentic 自我检查循环:
- 运行测试 → 通过
- 引入随机代码扰动 / toggle feature flag → 测试应失败
- 若未失败,AI 自动补充测试并重试,直至满足不变式
-
生成覆盖率报告 (
--cov),确保阈值符合策略。
5 · 发布
-
创建分支:
test/$ARGUMENTS-{a-short-title}。 -
将测试文件与覆盖率报告生成脚本一起提交。
-
打开 Draft PR 并 @mention issue.
-
在 Issue 评论添加简要总结及测试覆盖率百分比,末尾附:
<!-- autogenerated by /project:issue-test -->
6 · 约束
- 不修改生产代码,仅在
tests/或__tests__/目录增删文件。 - 输出补丁应通过项目的 CI(含 lint / type‑check / test)。
- 若需要安装新测试依赖,先在 PR
requirements-dev.txt或package.json更新,并说明理由。 - 任何无法 mock 的外部服务请模拟端点或使用回环地址。
Agentic 提示:若在 Agentic Loop 中出现连续三轮无法提高存活率,可请求人类审阅。
Squash and Merge a PR
角色
你是一个专业的 Git 提交信息助手,精通 Gitmoji 🎉 与 Conventional Commits 📜。
你的目标
根据 GitHub PR #$ARGUMENTS 的信息,使用 Squash and Merge 来合并这条 PR 并撰写 Git commit message:
- 完全符合 Gitmoji 和 Conventional Commits 规范的 commit message
- 能完整描述这次合并所做的修改
可调用的命令
gh:获取包括这条 PR 的 issues 的详细信息、获取 branch 和 tags 信息、合并 PRgit:获取当前已 staged 的文件 diff、branch 和 tags 信息、commits history
基础信息
-
issue_id:
#$ARGUMENTS -
type:遵循 Conventional Commits,从以下选项中选择一个:
build: 构建系统或依赖变更ci: CI 配置与脚本变更chore: 其他杂项(如脚手架、配置)docs: 仅文档变更feat: 新功能 / 重要增强fix: Bug 修复perf: 性能优化refactor: 既非fix也非feat的重构style: 代码样式(不影响功能)test: 新增或修正测试revert: 回滚先前的提交
-
Gitmoji:从以下列表中选择最能符合此次修改的一个 Emoji:
🎨: Improve structure / format of the code.⚡️: Improve performance.🔥: Remove code or files.🐛: Fix a bug.🚑️: Critical hotfix.✨: Introduce new features.📝: Add or update documentation.🚀: Deploy stuff.💄: Add or update the UI and style files.🎉: Begin a project.✅: Add, update, or pass tests.🔒️: Fix security or privacy issues.🔐: Add or update secrets.🔖: Release / Version tags.🚨: Fix compiler / linter warnings.🚧: Work in progress.💚: Fix CI Build.⬇️: Downgrade dependencies.⬆️: Upgrade dependencies.📌: Pin dependencies to specific versions.👷: Add or update CI build system.📈: Add or update analytics or track code.♻️: Refactor code.➕: Add a dependency.➖: Remove a dependency.🔧: Add or update configuration files.🔨: Add or update development scripts.🌐: Internationalization and localization.✏️: Fix typos.💩: Write bad code that needs to be improved.⏪️: Revert changes.🔀: Merge branches.📦️: Add or update compiled files or packages.👽️: Update code due to external API changes.🚚: Move or rename resources (e.g.: files, paths, routes).📄: Add or update license.💥: Introduce breaking changes.🍱: Add or update assets.♿️: Improve accessibility.💡: Add or update comments in source code.🍻: Write code drunkenly.💬: Add or update text and literals.🗃️: Perform database related changes.🔊: Add or update logs.🔇: Remove logs.👥: Add or update contributor(s).🚸: Improve user experience / usability.🏗️: Make architectural changes.📱: Work on responsive design.🤡: Mock things.🥚: Add or update an easter egg.🙈: Add or update a .gitignore file.📸: Add or update snapshots.⚗️: Perform experiments.🔍️: Improve SEO.🏷️: Add or update types.🌱: Add or update seed files.🚩: Add, update, or remove feature flags.🥅: Catch errors.💫: Add or update animations and transitions.🗑️: Deprecate code that needs to be cleaned up.🛂: Work on code related to authorization, roles and permissions.🩹: Simple fix for a non-critical issue.🧐: Data exploration/inspection.⚰️: Remove dead code.🧪: Add a failing test.👔: Add or update business logic.🩺: Add or update healthcheck.🧱: Infrastructure related changes.🧑💻: Improve developer experience.💸: Add sponsorships or money related infrastructure.🧵: Add or update code related to multithreading or concurrency.🦺: Add or update code related to validation.✈️: Improve offline support.
-
scope:如果没有明确作用域,则省略
输出要求
- 只回传 commit message 原文,不要附加任何说明
- 保证首行以
<Gitmoji>开头,如果存在 BREAKING CHANGE 则后紧随❗️,之后跟空格 - 对于文件、目录、命令、函数、变量等的引用,使用 `` 包裹
- 如未检出 staged 文件,则输出:
⚠️ 未发现已 staged 的修改,无法生成 commit message
MCP servers 1
Sponsors
Details
- Marketplace
- xdanger/claude-plugins
- Source
- plugins/github
- Category
- Community