github-forker

by chat2dev

>

3.7k编码与调试未扫描2026年3月23日

安装

claude skill add --url github.com/openclaw/skills/tree/main/skills/chat2dev/github-forker

文档

GitHub Forker

Fork GitHub repositories extracted from text or images. You need GITHUB_TOKEN set in the environment with repo permissions.

What you do

  1. Extract all GitHub repository URLs from the input (text, image, or both)
  2. Fork each repository via the GitHub API
  3. Star the original repository after a successful fork
  4. Report results clearly

Step 1: Extract GitHub URLs

From text

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.

From images

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.

Truncated URLs

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):

  1. 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.

  2. 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:

    • The repo name starts with the visible partial (e.g. op...openchamber matches)
    • The description aligns with what the user said (e.g. "UI真好" → pick the UI-focused one)
    • It has significantly more stars than the others

    If you're confident, proceed directly and tell the user your reasoning:

    code
    "github.com/openchamber/op..." → inferred openchamber/openchamber ⭐1.5k (Desktop UI for OpenCode, matches context "UI真好")
    
  3. Ask the user only when genuinely uncertain — when multiple results are plausible and context doesn't help distinguish them:

    code
    Found truncated URL "github.com/foo/bar..." — which repo did you mean?
    1. foo/barista ⭐420 — Coffee shop POS system
    2. foo/baroque ⭐38 — Baroque music generator
    Enter number (or 0 to skip):
    

    Never fork a truncated URL without either a confident inference or explicit user confirmation.

Step 2: Fork via GitHub API

For each unique {owner}/{repo} pair, call the fork endpoint:

bash
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.

  • If 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_profile
    
  • Fork requests are async on GitHub's side — a 202 response means "accepted", not "done".
  • If a repo is already forked, GitHub returns the existing fork (not an error) — that's fine.
  • Handle HTTP errors:
    • 401: bad or expired token
    • 403: token lacks fork permission. For classic PATs, need repo or public_repo scope. For fine-grained PATs, need "Administration: Read and write" permission (not just contents).
    • 404: repo not found or private (token has no access)

Step 3: Star the original repository

After a successful fork, star the original repo:

bash
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.

Step 4: Report results

After all forks are attempted, show a clear summary:

code
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).

Edge cases

  • No URLs found: Tell the user clearly — "No GitHub repository URLs found in the input."
  • Private repos: Fork will fail with 404 if the token doesn't have access; report the error.
  • Duplicate URLs: Deduplicate before forking — fork each unique repo once.
  • Non-repo URLs: Ignore github.com/ paths that aren't owner/repo format (e.g., github.com/features, github.com/login).

相关 Skills

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描109.6k

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描109.6k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描109.6k

相关 MCP 服务

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
82.9k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
51.5k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
46.2k

评论