SuperAPI AI 工具集

contributor-setup

编程与开发

查看项目

更新于 10-16 07:29

技能介绍

用途

contributor-setup 用于帮助贡献者把本地环境准备好,以便向公开的 timescale/marketing-skills 仓库提交更改。该技能本身不提交任何更改,只确保所需工具存在。一旦检查通过,贡献者就可以使用 /skill-contributor,或直接让 Claude 协助提交更改。

主要能力

该技能检查三件事:

  • gh:GitHub 的命令行工具,用于不离开终端即可打开 PR。
  • gh auth:机器上已认证的 GitHub 会话。
  • git 用户身份:user.name 和 user.email,使提交记录带上贡献者的名字。

使用方式

第 0 步:运行时检查(若为 Cowork 则退出)

通过工具可用性检测运行时:

  • 如果 google_drive_search 工具可用 → 判定为 Cowork。该技能仅限 Claude Code。此时告知用户:

    “This skill is Claude Code only — it probes and modifies your local machine, which I can't do from Cowork. If you're ready to submit changes from Cowork, just run /skill-contributor and it'll walk you through everything.”

    在此停止,不再继续。

  • 否则 → 判定为 Claude Code,继续第 1 步。

第 1 步:检查 gh CLI

通过 Bash 运行 which gh。

  • 已安装:运行 gh --version 确认可用。告知用户安装的版本,然后进入第 2 步。
  • 未安装:通过 $CLAUDE_CODE_HOST_PLATFORM 检测宿主操作系统:
    • darwin(macOS)→ 建议 brew install gh。先用 which brew 确认 Homebrew 可用。若缺少 brew,引导用户访问 https://brew.sh 并停止,请其安装 Homebrew 后再回来。
    • linux → 建议使用 cli.github.com/manual/installation 中针对用户发行版的安装命令。若不知道发行版,询问用户。
    • win32 → 建议 winget install --id GitHub.cli 或 scoop install gh。

询问用户:“Want me to run the install command for you, or would you rather run it yourself?” 若用户同意,通过 Bash 运行。若失败(权限错误、密码提示、缺少包管理器),展示错误并询问用户希望如何处理。

若安装命令挂起或因权限/密码提示失败:某些安装器(尤其是使用 sudo 的 Linux 发行版)需要 Bash 无法提供的交互输入。告知用户在新终端窗口中自行运行该命令,完成后回来说“done”,用户返回后会重新检查 gh --version。

一旦 gh --version 正常返回,继续下一步。

第 2 步:检查 gh auth

通过 Bash 运行 gh auth status。

  • 已认证:gh auth status 会打印已登录的用户名。确认后进入第 3 步。

  • 未认证:引导用户完成 gh auth login --web。用一句话说明将要发生的事:

    “This will open your browser, give you a short code to paste, and sign you into GitHub. I'll wait while you finish.”

    运行 gh auth login --web,让用户完成浏览器流程。用户返回后,重新运行 gh auth status 确认成功。

若用户不接受 --web(例如更偏好个人访问令牌),提供不带该标志的 gh auth login,让用户自行选择方式。不要强制使用网页流程。

第 3 步:检查 git 用户配置

通过 Bash 并行运行 git config --global user.name 和 git config --global user.email。

  • 两者均已设置:用一行向用户确认这些值,然后继续。
  • 任一缺失:向用户询问缺失的值:
    • “What name should show up on your commits?”(可建议使用第 2 步得到的 GitHub 用户名作为默认值)
    • “What email should I use for commits? (if you use GitHub's noreply email, that's at GitHub email settings)”

按需运行 git config --global user.name "<their name>" 和 git config --global user.email "<their email>"。设置后验证这些值。

第 4 步:完成

确认三项检查全部通过。告知用户已就绪:

“You're set up. gh is installed and authenticated as <username>, and your commits will show up as <name> <email>. When you've got changes to submit, run /skill-contributor and I'll walk you through the rest.”

如果用户是由 /skill-contributor 引导而来,可主动提出返回:

“Want me to jump back into /skill-contributor to submit what you were working on?”

适用场景

适用于准备向 timescale/marketing-skills 仓库提交更改、且使用 Claude Code 的贡献者。该技能面向的可能是愿意使用终端但并非日常使用命令行的营销人员,因此每一步都会先用一句通俗英语解释再运行命令。

限制

  • 仅限 Claude Code 使用;在 Cowork 中会停止并提示改用 /skill-contributor。
  • 不提交任何更改,只做环境检查与准备。
  • 某些安装器需要交互输入,Bash 无法提供,需用户自行在终端运行。
  • 关于收费、价格、平台支持范围等更多信息,资料中暂未提供。