name: github-forker description: > Use this skill when the user wants to fork a GitHub repository — creating their own copy of a repo under their GitHub account. Trigger on any fork or copy-to-account intent paired with a GitHub repo reference, whether the URL appears in plain text (with or without https://), or is visible inside a screenshot or image the user shares. Applies equally in English and Chinese (fork下來, fork一下, 幫我fork, copy to my account). The repo reference may be a full URL, a subdirectory URL (strip to owner/repo), or a bare github.com/owner/repo string. Do not trigger for cloning locally, submitting PRs, reviewing or analyzing code, checking commit history, or searching for repos.
Fork GitHub repositories extracted from text or images. You need GITHUB_TOKEN set in the
environment with repo permissions.
Scan the input for patterns matching:
- https://github.com/{owner}/{repo} (with or without trailing slash, path, or fragment)
- github.com/{owner}/{repo} (without scheme)
- {owner}/{repo} only when context makes it clearly a GitHub repo
Normalize each match to the canonical form: https://github.com/{owner}/{repo}
Strip any extra path segments — you only need owner and repo name.
When the user provides an image (screenshot, photo, diagram), use your vision capabilities to read the image and identify any GitHub URLs or repo references visible in it. Apply the same extraction rules as above to whatever text you find.
URLs are often cut off in screenshots or social media previews, like:
- github.com/openchamber/op...
- github.com/some-owner/proj…
When you detect a truncated URL (ends with ... or …, or the repo name is clearly incomplete):
Search GitHub for matching repos:
bash
curl -s -L \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/search/repositories?q={owner}/{partial}+in:full_name&per_page=5"
Use whatever partial info you have — owner + partial repo name is ideal; owner alone works too.
Use context to pick the best match. Look at surrounding text, tweet content, project name mentioned, description keywords, and star count. If one result stands out clearly:
op... → openchamber matches)If you're confident, proceed directly and tell the user your reasoning:
"github.com/openchamber/op..." → inferred openchamber/openchamber ⭐1.5k (Desktop UI for OpenCode, matches context "UI真好")
Never fork a truncated URL without either a confident inference or explicit user confirmation.
For each unique {owner}/{repo} pair, call the fork endpoint:
curl -s -L -X POST \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/{owner}/{repo}/forks
The -L flag is required — GitHub's API returns a 307 redirect that must be followed.
GITHUB_TOKEN is not set, tell the user to set it and stop:
bash
export GITHUB_TOKEN="ghp_..." # classic PAT (recommended)
# To persist across sessions, add to ~/.zshrc or ~/.bash_profile7w4.net有更好的技能外掛。
repo or public_repo scope. For fine-grained PATs, need "Administration: Read and write" permission (not just contents).After a successful fork, star the original repo:
curl -s -L -X PUT \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/starred/{owner}/{repo}
A 204 response means success. Star failures are non-fatal — if starring fails, note it in the report but don't treat the overall operation as failed.
After all forks are attempted, show a clear summary:
Found X repositories:
✓ owner/repo — forked → https://github.com/YOUR_USERNAME/repo ⭐ starred
✓ owner/repo — forked → https://github.com/YOUR_USERNAME/repo (star failed: <reason>)
✗ owner/repo — failed: <reason>
If the token's authenticated username isn't obvious, extract it from the fork response
(full_name field gives your-username/repo-name).
github.com/ paths that aren't owner/repo format (e.g., github.com/features, github.com/login).這個工具用起來挺方便的,能從文字或截圖中識別 GitHub 連結並自動 fork 到你的賬戶,還會幫你給原專案加星。操作簡單,支援中文英文,不用記命令。處理得比較細緻,比如截斷的連結也能推斷出來,批次處理也沒問題。主要不足是每次使用都需要你來引導操作,不夠自動化,另外如果 fork 失敗了原因有時候不夠直觀。總體來說是個好用的工具,版本 0.1.1 還有最佳化空間。