Skip to content

docs: 新增 Claude Code github-pr skill,规范贡献者向上游提交 Issue 和 PR 的工作流#82

Merged
opensourceways-bot merged 1 commit intoopensourceways:mainfrom
ZhengZhenyu:main
Feb 26, 2026
Merged

docs: 新增 Claude Code github-pr skill,规范贡献者向上游提交 Issue 和 PR 的工作流#82
opensourceways-bot merged 1 commit intoopensourceways:mainfrom
ZhengZhenyu:main

Conversation

@ZhengZhenyu
Copy link
Collaborator

关联 Issue

Closes #81

变更概述

新增 .claude/skills/github-pr/SKILL.md,封装向 opensourceways/openGecko 提交 Issue + PR 的完整工作流;同步更新 CLAUDE.md,新增「Contributing to Upstream」章节。

主要变更

文档

  • 新增 .claude/skills/github-pr/SKILL.md
    • 自动推断 fork 用户名(支持 SSH / HTTPS 两种远端格式,不硬编码用户名)
    • commit 前缀 → Issue 模板映射(feat: / fix: / docs: / [Governance]:
    • 各模板 body 结构(手动组织,兼容项目 .yml 格式模板)
    • gh CLI 替代方案:Option A curl + PAT、Option B GitHub Web UI、Option C hub
    • Edge case 处理表、Key Rules、完整示例调用
  • 更新 CLAUDE.md
    • 新增「Contributing to Upstream (Issue + PR Workflow)」章节
    • 说明何时触发 /github-pr skill 及 upstream/origin 远端约定

测试

测试验证

文档类变更,无需运行测试套件。

测试计划

@opensourceways-bot
Copy link
Contributor

CLA Signature Pass

ZhengZhenyu, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot
Copy link
Contributor

CLA Signature Pass

ZhengZhenyu, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot
Copy link
Contributor

CLA Signature Pass

ZhengZhenyu, thanks for your pull request. All authors of the commits have signed the CLA. 👍

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive documentation for contributing to the upstream opensourceways/openGecko repository through a new Claude Code skill. The documentation establishes a standardized workflow for creating GitHub issues and pull requests from contributor forks.

Changes:

  • New .claude/skills/github-pr/SKILL.md defining the complete Issue + PR submission workflow with runtime fork detection, commit-to-template mapping, and CLI alternatives
  • Updated CLAUDE.md with a new "Contributing to Upstream" section explaining when and how to use the github-pr skill
  • Documentation of single-commit requirement and squashing workflow

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.claude/skills/github-pr/SKILL.md Comprehensive skill documentation covering fork detection, issue template selection, workflow steps, CLI alternatives, and edge case handling
CLAUDE.md Added "Contributing to Upstream" section with skill overview, remote conventions, and squash requirement

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

6. **Match commit prefix to template** — `feat:` → Feature Request, `fix:` → Bug Report, `docs:` → Documentation, `[Governance]:` → Governance Task.
7. **PR body language** — section headers and user-facing text in Chinese; code, variable names, and CLI output in English (matches project language conventions).
8. **YAML templates can't be used with `--template`** — compose body manually to mirror template sections, or use the web UI.
9. **Single commit per PR (no `needs-squash`)** — the upstream CI bot adds a `needs-squash` label that **blocks merging** when a PR contains more than one commit. Always squash all commits into one before pushing:
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation claims "the upstream CI bot adds a needs-squash label that blocks merging when a PR has more than one commit" (line 300, 366, and 609), but there is no evidence of such a CI bot in the repository's GitHub Actions workflows (.github/workflows/pr-checks.yml does not check commit count or add this label).

Either:

  1. Add the CI workflow that implements this check, or
  2. Clarify that this is a manual/external process, or
  3. Remove the claim that a CI bot automatically adds this label

This affects multiple locations: SKILL.md lines 300 and 320, CLAUDE.md lines 366, 370, and 609.

Copilot uses AI. Check for mistakes.
Comment on lines +338 to +341
# 3. Push
git push origin "$BRANCH"

# 4. PR
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Example Invocation section does not include the squashing step that is described as critical in Key Rule #9 and in CLAUDE.md line 366. Step 3 in the example just pushes without squashing first, which contradicts the claim that the skill "squashes all commits into one before pushing."

Add the squashing commands between step 2 and 3 to match the workflow described elsewhere in the documentation.

Suggested change
# 3. Push
git push origin "$BRANCH"
# 4. PR
# 3. Squash commits into one
git fetch upstream
git reset --soft upstream/main
git commit -m 'feat: ...'
# 4. Push
git push origin "$BRANCH" --force-with-lease
# 5. PR

Copilot uses AI. Check for mistakes.

1. **Auto-detects fork identity** from `git remote get-url origin` — no username is ever hardcoded.
2. **Creates an issue** on `opensourceways/openGecko` describing the feature/fix.
3. **Squashes all commits into one** before pushing — the upstream CI bot adds a `needs-squash` label that **blocks merging** when a PR has more than one commit.
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The claim that the skill "squashes all commits into one before pushing" is inconsistent with the actual Step-by-Step Workflow (lines 128-236) and Example Invocation (lines 324-346), which both omit the squashing step entirely.

Either update this description to accurately reflect what the workflow does, or ensure the workflow sections include the squashing step as claimed here.

Copilot uses AI. Check for mistakes.
| `feat:` | New feature or enhancement | Feature Request | `[Feature]: ` |
| `fix:` | Bug fix | Bug Report | `[Bug]: ` |
| `docs:` | Documentation improvement | Documentation | `[Docs]: ` |
| `refactor:` | Code refactoring (no behaviour change) | Feature Request (or skip issue) | `[Feature]: ` |
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spelling: "behaviour" should be "behavior" to match the American English spelling used consistently throughout the codebase (see other .md files in the project).

Suggested change
| `refactor:` | Code refactoring (no behaviour change) | Feature Request (or skip issue) | `[Feature]: ` |
| `refactor:` | Code refactoring (no behavior change) | Feature Request (or skip issue) | `[Feature]: ` |

Copilot uses AI. Check for mistakes.
Comment on lines +179 to +193
### Step 3 — Push the branch to fork

Check whether origin is up to date first; pull+rebase if behind.

```bash
# Check if ahead/behind
git fetch origin "$BRANCH" 2>/dev/null
BEHIND=$(git rev-list --count "HEAD..origin/$BRANCH" 2>/dev/null || echo 0)

if [ "$BEHIND" -gt 0 ]; then
git pull origin "$BRANCH" --rebase
fi

git push origin "$BRANCH"
```
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Step-by-Step Workflow is missing the critical squashing step mentioned in Key Rule #9 and in CLAUDE.md line 366. According to the documentation, the skill should "squash all commits into one before pushing," but Step 3 only checks if origin is ahead and pushes without squashing.

Add a squashing step between the current Step 2 (Create issue) and Step 3 (Push branch), or integrate it into Step 3. The step should include the commands from Key Rule #9 to ensure all commits are squashed into one before pushing.

Copilot uses AI. Check for mistakes.
@sunshuang1866
Copy link
Contributor

/lgtm
/approve

@opensourceways-bot
Copy link
Contributor

Review Code Feedback

  • The label lgtm was added to this pull request. It means that sunshuang1866 reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄

@opensourceways-bot
Copy link
Contributor

Review Code Feedback

  • The label approved was added to this pull request. It means that sunshuang1866 reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄

@opensourceways-bot
Copy link
Contributor

PR Merge Failed

@opensourceways-bot opensourceways-bot merged commit ddcb4e6 into opensourceways:main Feb 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs]: 新增 Claude Code github-pr skill,规范贡献者向上游提交 Issue 和 PR 的工作流

4 participants