lov-gh-contribute
БесплатноБез исполняемых скриптовНе проверенContribute a clean, professional pull request to someone else's GitHub repository: fork → clone → branch → commit → push → open PR, with smart splitting into…
от lovstudio★ 72 звезды на GitHubОб этом скилле
开源贡献助手 · Open Source Contributor
Turn local changes into a clean, professional pull request against an upstream repo you don't own. Handles the full fork → branch → commit → push → PR pipeline, and splits work into multiple PRs when the changes span unrelated concerns.
When to Use
- User wants to contribute to an open-source project they don't have write access to
- User already has local edits and needs them shipped as a PR upstream
- User asks to "fork this repo and send a PR"
- User has mixed changes (e.g. docs + feature + refactor) and wants them split properly
Non-Goals
- Does not write code changes — assumes the user (or a prior step) already has the desired modifications in the working tree or in their head
- Does not review the project's own PRs (see
gh-tidy) - Does not mirror to GitLab/Gitea — GitHub only
Workflow (MANDATORY)
Execute steps in order. Do not skip confirmations.
Step 1: Identify the target repo
Determine the upstream owner/repo:
- If the user pasted a URL or
owner/repostring → use it - Otherwise run
git remote -vin the current directory and pick theorigin(if origin is already the user's fork, find the upstream viagh repo view --json parent)
Record three facts:
UPSTREAM— e.g.ZenMux/zenmux-docDEFAULT_BRANCH— fromgh repo view $UPSTREAM --json defaultBranchRef -q .defaultBranchRef.nameUSER_LOGIN— fromgh api user -q .login
Step 2: Read the contribution rules
Fetch CONTRIBUTING.md and CODE_OF_CONDUCT.md from upstream (if present) and
skim for: commit message format, DCO/CLA requirements, branch naming, PR template.
Carry these constraints into subsequent steps.
gh api repos/$UPSTREAM/contents/CONTRIBUTING.md -q .content 2>/dev/null | base64 -d
If the repo has .github/PULL_REQUEST_TEMPLATE.md, use it as the PR body skeleton.
Step 3: Survey the changes
Gather the change set that needs to become PR(s):
git status --porcelain
git diff --stat $DEFAULT_BRANCH...HEAD # committed
git diff --stat # unstaged
git diff --stat --cached # staged
Classify files into logical groups. Typical axes:
- By concern: docs / feature / bugfix / refactor / test / chore
- By subsystem: unrelated top-level directories usually = separate PRs
- By dependency: if PR B needs PR A merged first, split and note the dependency
Step 4: Propose a PR plan and confirm
Use AskUserQuestion to present the plan. Options must include at least:
- Single PR — all changes together. Recommended when changes are cohesive.
- Split into N PRs — show the proposed titles and file groupings.
- Abort — something is off, let the user redirect.
Show the plan like:
PR #1 (docs): Update CLAUDE.md to reflect current scripts
- CLAUDE.md
PR #2 (feat): Add gh-contribute skill bootstrap
- scripts/new.ts
- .prompts/contribute.xml
Do not proceed until the user picks an option.
Step 5: Fork (idempotent)
gh repo view $USER_LOGIN/$REPO_NAME >/dev/null 2>&1 \
|| gh repo fork $UPSTREAM --clone=false --remote=false
Ensure a fork remote exists in the local clone:
git remote get-url fork 2>/dev/null \
|| git remote add fork [email protected]:$USER_LOGIN/$REPO_NAME.git
If origin already points at the user's fork, skip the fork remote and use origin.
Step 6: Create branches and commits per PR
For each PR in the plan:
- Start from a clean, up-to-date base:
git fetch origin $DEFAULT_BRANCH git checkout -b $BRANCH_NAME origin/$DEFAULT_BRANCH - Apply only the files belonging to this PR (use
git checkout <sha> -- <paths>orgit stash+ selectivegit checkoutfrom a working branch). - Commit with a conventional message. If upstream uses Conventional Commits,
match:
<type>(<scope>): <subject>. Otherwise mirror the style of the last 10 commits on$DEFAULT_BRANCH. - Sign off if
CONTRIBUTING.mdrequires DCO:git commit -s ....
Branch naming (when upstream doesn't dictate): <type>/<short-slug>, e.g.
docs/update-claude-md, feat/add-contribute-skill.
Step 7: Push to fork
git push -u fork $BRANCH_NAME
If origin is already the fork, use origin instead.
Step 8: Open the PR
gh pr create \
--repo $UPSTREAM \
--base $DEFAULT_BRANCH \
--head $USER_LOGIN:$BRANCH_NAME \
--title "$TITLE" \
--body "$BODY"
PR body template (adapt to PR template if present):
## Summary
<1-3 bullets explaining what and why>
## Changes
- <bullet per logical change>
## Test plan
- [ ] <how to verify>
## Related
<!-- Link follow-up PRs if split, e.g. "Depends on #123" or "Part 2 of 3" -->
When opening multiple PRs, cross-link them in each body:
## Related
- PR 1/3: #<url>
- PR 2/3: (this PR)
- PR 3/3: #<url>
Step 9: Report back
Output a compact summary:
Opened 2
Установить lov-gh-contribute в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл lov-gh-contribute?
Contribute a clean, professional pull request to someone else's GitHub repository: fork → clone → branch → commit → push → open PR, with smart splitting into one or multiple PRs based on the scope of changes. Trigger when the user says "给这个 repo 提 PR"、"贡献代码"、"fork 然后改再 PR"、 "contribute to this repo", "open a PR to upstream", "submit a PR to <owner>/<repo>".
Как установить скилл lov-gh-contribute?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lov-gh-contribute запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic