GitHub Star 管理器:AI 驱动的 Star 整理工具 - Openclaw Skills

作者:互联网

2026-03-30

AI教程

什么是 GitHub Star 管理器?

GitHub Star 管理器是 Openclaw Skills 集合中的一个专门工具,旨在帮助开发人员大规模管理其收藏的仓库。该技能不使用手动整理,而是结合使用 GitHub CLI (gh) 和 jq 来导出、分析和处理 Star 数据。它允许用户全局查看已保存的仓库,并应用标准 GitHub UI 无法实现的组织逻辑。

通过综合仓库元数据(如语言、主题和活跃程度),该技能可帮助您保持个人资料的整洁和实用。无论您是想通过移除归档项目来清理冗余,还是尝试为特定技术构建精选 GitHub 列表,该技能都提供了安全有效地自动化该流程所需的编程接口。

下载入口:https://github.com/openclaw/skills/tree/main/skills/cosformula/github-star-manager-skill

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install github-star-manager-skill

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 github-star-manager-skill。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

GitHub Star 管理器 应用场景

  • 根据技术或领域,自动将收藏的仓库分类到语义化的 GitHub 列表中。
  • 识别并批量取消关注超过两年未更新的陈旧仓库。
  • 将收藏仓库的完整备份导出为 JSON 文件,以便进行离线分析或迁移。
  • 针对收藏列表中最常出现的编程语言和主题生成详细统计数据。
  • 清理已归档或已弃用的项目,以保持收藏列表的相关性和高质量。
GitHub Star 管理器 工作原理
  1. 该技能利用您现有的本地 gh CLI 身份验证来访问 GitHub API,无需手动管理 Token。
  2. 它通过分页的 REST API 调用获取您的整个 Star 历史记录,并通过 jq 管道处理结果以生成结构化的 JSON 数据集。
  3. 该技能分析仓库元数据(如归档状态、上次推送日期和星标数),以识别需要清理或分类的对象。
  4. 利用 GraphQL 变异 (mutations),该技能会创建新的 GitHub 列表并根据您的确认将仓库映射到其中。
  5. 取消关注或列表更新等批量操作会通过内置的速率限制延迟执行,以确保符合 GitHub API 政策。

GitHub Star 管理器 配置指南

要使用 Openclaw Skills 库中的这个 GitHub Star 管理器技能,您必须在系统中安装 GitHub CLI 和 jq。

# 安装依赖 (macOS)
brew install gh jq

# 验证 CLI 登录
gh auth login

# 确保拥有用于列表管理的 'user' 权限范围
gh auth refresh -s user

GitHub Star 管理器 数据架构与分类体系

该技能将仓库信息整理成简洁的 JSON 架构,以便于处理和 AI 分析:

属性 类型 描述
full_name 字符串 所有者和仓库标识符(例如 'owner/repo')
description 字符串 作者提供的仓库摘要
language 字符串 仓库的主要编程语言
stars 整数 仓库的星标总数
archived 布尔值 指示项目是否处于只读归档状态
pushed_at 字符串 仓库最后一次代码推送的 ISO 8601 时间戳
name: github-star-manager
description: Manage GitHub stars with AI-powered categorization and cleanup. Use when a user wants to organize their starred repos into GitHub Lists, clean up stale/deprecated stars, export star data for analysis, or get stats about their GitHub stars. Supports semantic categorization via LLM and bulk operations (unstar, add-to-list).
metadata:
  {
    "openclaw":
      {
        "emoji": "?",
        "requires": { "bins": ["gh", "jq"] },
        "notes": "Requires `gh auth login` (authenticated GitHub CLI). For Lists operations (create/add), the token needs `user` scope — use a Classic token. The skill uses the existing `gh` auth session; no separate env var is needed.",
        "install":
          [
            {
              "id": "brew-gh",
              "kind": "brew",
              "formula": "gh",
              "bins": ["gh"],
              "label": "Install GitHub CLI (brew)",
            },
            {
              "id": "apt-gh",
              "kind": "apt",
              "package": "gh",
              "bins": ["gh"],
              "label": "Install GitHub CLI (apt)",
            },
            {
              "id": "brew-jq",
              "kind": "brew",
              "formula": "jq",
              "bins": ["jq"],
              "label": "Install jq (brew)",
            },
            {
              "id": "apt-jq",
              "kind": "apt",
              "package": "jq",
              "bins": ["jq"],
              "label": "Install jq (apt)",
            },
          ],
      },
  }

GitHub Star Manager

Requires gh (authenticated) + jq. For Lists operations: token needs user scope (Classic token recommended).

Authentication

This skill uses the gh CLI's existing auth session. Before using:

  1. Run gh auth login if not already authenticated
  2. For read-only operations (export, stats): default token scopes are sufficient
  3. For Lists operations (create list, add to list): token needs user scope — run gh auth refresh -s user or use a Classic token with user scope

No separate API key or environment variable is needed.

Export Stars

gh api user/starred --paginate --jq '.[] | {
  full_name, description, url: .html_url, language,
  topics, stars: .stargazers_count, forks: .forks_count,
  archived, updated_at, pushed_at
}' | jq -s '.' > stars.json

Slow for 1000+ stars (~1 min per 1000). Quick count: gh api user/starred --paginate --jq '. | length' | jq -s 'add'.

View Existing Lists

gh api graphql -f query='{
  viewer {
    lists(first: 100) {
      nodes { id name description isPrivate items { totalCount } }
    }
  }
}' --jq '.data.viewer.lists.nodes'

Create a List

gh api graphql -f query='
mutation($name: String!, $desc: String) {
  createUserList(input: {name: $name, description: $desc, isPrivate: false}) {
    list { id name }
  }
}' -f name="LIST_NAME" -f desc="LIST_DESCRIPTION" --jq '.data.createUserList.list'

Save the returned id for adding repos.

Add Repo to List

REPO_ID=$(gh api repos/OWNER/REPO --jq '.node_id')

# Note: listIds is a JSON array, use --input to pass variables correctly
echo '{"query":"mutation($itemId:ID!,$listIds:[ID!]!){updateUserListsForItem(input:{itemId:$itemId,listIds:$listIds}){user{login}}}","variables":{"itemId":"'$REPO_ID'","listIds":["LIST_ID"]}}' r
  | gh api graphql --input -

Add ~300ms delay between calls to avoid rate limits.

Unstar

gh api -X DELETE user/starred/OWNER/REPO

Always confirm with user before unstarring.

Organize Workflow

  1. Export stars to JSON
  2. Analyze the JSON — suggest categories based on language, topics, purpose, domain
  3. Present suggestions to user for review
  4. Create Lists and add repos after confirmation
  5. Batch operations with delays between API calls

Cleanup Workflow

  1. Export stars to JSON
  2. Use jq to find archived, stale (2+ years no push), low-star, or deprecated repos
  3. Present candidates to user, confirm before unstarring