← Back to Skills Marketplace
autoxj

GitCode PR Audit

by do_while_true · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
241
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install gitcode-pr-audit
Description
Quality audit for merged GitCode PRs: sample by time range or repo list, check compliance (labels, comments, tests, size, etc.), output table. Use when user...
README (SKILL.md)

GitCode 合入 PR 质量抽检

对指定时间范围内合入主分支的 PR 进行抽检,按多维度判断质量并输出表格。支持多仓库、可配置阈值与必选标签,输出可写为 Markdown 或 CSV。

何时使用

  • 用户表达以下任一意图时使用本 skill:
    • 规范性抽检/质量抽检:如「对已合入的 PR 进行质量抽检」「最近 30 天合入的 PR 抽检」「已合入 PR 规范性检查」;
    • 多仓库/仓库列表:如「对以下仓库的 PR 抽检」「对owner组织下某几个仓库的 PR 检查」;
    • 输出形式:如「将抽检结果整理成表格」「输出表格形式」。
  • 需提供 至少一个仓库(格式 owner/repo);可多仓库、可选时间(默认最近 30 天)与分支、可选抽检数量或「全部」检查。

认证

GITCODE_TOKEN:按以下优先级读取。

优先级 来源
1 进程环境变量 GITCODE_TOKEN
2 Windows 用户级环境变量
3 Windows 系统级环境变量
  • Linux/macOS:在 ~/.bashrc~/.zshrcexport GITCODE_TOKEN="..."
  • 未配置时:脚本报错并提示到 GitCode 个人访问令牌 创建并设置环境变量。

路径与跨平台

  • 技能根目录SKILL_ROOT):本 SKILL.md 所在目录。脚本通过 __file__ 定位,不依赖当前工作目录。
  • 支持 Linux / macOS / Windows;执行时使用脚本绝对路径(如 python \x3CSKILL_ROOT>/scripts/pr_audit.py ...)。

固化流程

  1. 解析参数:从用户输入提取 --repo(可多个)、--pr(可多个)、--branch--since--until--days--all--output 等。
  2. 调用脚本
    python \x3CSKILL_ROOT>/scripts/pr_audit.py --repo owner/repo [--pr N] [--pr N2 ...] [--branch BRANCH] [--since YYYY-MM-DD] [--until YYYY-MM-DD] [--days N] [--all] [--output path.md|path.csv]
    
    • 指定 PR 时:使用 --pr N(可多次)并且仅指定一个 --repo,脚本只检查这些 PR,不按时间范围拉取。
    • 未指定 --pr 时:未指定时间则默认 最近 30 天--days 30);指定 --since/--until 则按用户时间。
    • 未指定分支时,每个仓库依次尝试 master → develop → main,都不存在则报错;指定则用指定分支,不存在则报错。
    • 未指定抽检数量时,每个仓库随机抽 5~10 条分析,不足 5 条则全部分析;用户明确「全部」或「所有」或传 --all 时,该时间范围内合入的 PR 全部检查。
  3. 读取结果:脚本将表格输出到 stdout(Markdown 格式);若指定 --output 则同时写入该文件(.md 或 .csv)。退出码非 0 或 stderr 有错误时,向用户展示错误并结束。
  4. 成功:将 stdout 表格呈现给用户;若写入了文件,说明路径。

脚本参数

参数 必填 说明
--repo 是(可多次) 仓库,格式 owner/repo,可多次传入多仓库
--pr 否(可多次) 指定 PR 编号;与时间范围二选一,使用时常需且仅需一个 --repo
--branch 目标分支;未传时自动尝试 master → develop → main
--since 起始日期 YYYY-MM-DD(含该日 00:00 上海时间)
--until 结束日期 YYYY-MM-DD(含该日 24:00 前)
--days 最近 N 天(默认 30);与 since/until 二选一,未指定 since/until 时生效
--all 不抽样,该时间范围内合入的 PR 全部检查
--output 输出文件路径,扩展名 .md 或 .csv,UTF-8(CSV 带 BOM)
--config 配置文件路径,未传则使用技能根目录下 config.json
  • 指定 PR:传 --pr N(可多个)时仅检查这些 PR,需且仅需一个 --repo,不按时间筛选。
  • 时间约定:仅用 --days、或仅用 --since/--until。若同时传,脚本按 --since/--until 优先。
  • 多仓库时:每个仓库各自按上述规则抽样或全部检查(方案 A)。

分析维度(8 项)

维度 说明 判定
评论未解决 是否存在未解决的 diff 检视意见 PR 评论中 comment_type == "diff_comment"resolved == false 则记为「是」
流水线/标签 是否缺少必选标签(含流水线通过) 配置的 required_labels 缺任一则「是」
缺必选标签 同上,与「流水线」合并为配置的必选标签集合 见 config.json required_labels
新增超行数 新增代码行是否超过阈值 超过 max_additions(默认 1000)则「是」
无测试 修改文件是否包含测试 变更文件路径中均不包含 testut 则「是」
多 Issue 是否关联超过 1 个 Issue 关联 Issue 数 > 1 则「是」
缺检视 大 PR 是否缺乏检视意见 新增行数 > review_lines_threshold(默认 500)且 diff 评论数为 0 则「是」
标题/描述不清晰 标题与描述是否过短或过于笼统 标题长度 \x3C title_min_length(默认 5)或描述长度 \x3C body_min_length(默认 10)则「是」;满足长度后若标题/描述明显含糊(如仅「fix」「修改」无实质说明),则判为「是」
  • 表格列:仓库、PR(以 #编号 带链接,无单独链接列)、标题、各维度详情、问题汇总。
  • 维度列为详情文案
    • 评论未解决:否(已解决数/总 diff 评论数)是(未解决数/总数),如 否(1/10)是(2/5)
    • 缺必选标签:是(缺:label1、label2)
    • 新增超行数:否(实际行数)是(实际行数)
    • 多 Issue:否(0)是(N)
    • 缺检视:是(新增 N 行,0 个检视)
    • 标题/描述不清晰:是(原因,如标题过短、描述过短、描述笼统)
  • 最后一列「问题汇总」为该项 PR 所有不通过维度的简短罗列。

配置(config.json)

位于技能根目录,或通过 --config 指定。字段说明:

字段 含义 默认
required_labels 必选标签列表(缺一即不通过) ["ci-pipeline-passed", "approved", "lgtm"]
max_additions 新增行数阈值,超过记为「新增超行数」 1000
review_lines_threshold 超过此行数且无 diff 评论则记为「缺检视」 500
title_min_length 标题最小字符数 5
body_min_length 描述最小字符数 10
test_substrings 判定「含测试」时路径需包含的子串 ["test", "ut"]

输出格式

  • 表格列:仓库、PR(#编号 带链接)、标题、评论未解决、缺必选标签、新增超行数、无测试、多 Issue、缺检视、标题/描述不清晰、问题汇总(无单独链接列,链接在 PR 列)。
  • stdout:始终输出 Markdown 表格(便于控制台查看)。
  • --output .md:与 stdout 相同的 Markdown 表格写入文件。
  • --output .csv:同一内容写入 CSV,UTF-8 带 BOM,便于 Excel 打开。

禁止

  • 禁止在未得到脚本输出前猜测或伪造数据。
  • 禁止在用户未提供至少一个 --repo 时执行脚本。

示例

用户意图 命令
最近 30 天单仓抽检 python \x3CS> --repo owner/repo
指定 PR 检查 python \x3CS> --repo owner/repo --pr 2905 --pr 2606
指定时间多仓抽检 python \x3CS> --repo org/a --repo org/b --since 2026-02-01 --until 2026-03-10
全部检查不抽样 python \x3CS> --repo owner/repo --days 7 --all
指定分支并写 CSV python \x3CS> --repo owner/repo --branch main --output report.csv
自定义配置 python \x3CS> --repo owner/repo --config /path/to/config.json

其中 \x3CS>\x3CSKILL_ROOT>/scripts/pr_audit.py 的绝对路径。

历史版本

v1.0.0 (2026-03-11)

  • 🎉 初始版本发布
  • 📊 支持按时间范围抽检、8 维度质量分析
Usage Guidance
This skill appears coherent and limited to GitCode PR auditing. Before installing or running: 1) review the bundled scripts (they are included) to ensure no local modifications were made; 2) supply a least-privilege GITCODE_TOKEN (personal access token scoped only to read repositories/PRs); 3) run in an environment where writing the chosen --output path cannot overwrite sensitive files; 4) if you use Windows, note the script invokes PowerShell to read user/system environment variables—if you prefer, set the token only in the process environment before running. If you want higher assurance, run the script on a copy of the repository metadata or in an isolated/test account first.
Capability Analysis
Type: OpenClaw Skill Name: gitcode-pr-audit Version: 1.0.0 The gitcode-pr-audit skill is a legitimate utility for auditing the quality of merged Pull Requests on GitCode. It uses the official GitCode API (api.gitcode.com) to analyze PRs based on criteria like label compliance, comment resolution, and code size. The core logic in `scripts/pr_audit.py` is transparent, uses only Python standard libraries, and handles authentication tokens safely, including a Windows-specific helper that retrieves environment variables via PowerShell without exposing the system to injection. There are no signs of data exfiltration, malicious execution, or harmful instructions.
Capability Assessment
Purpose & Capability
Name/description ask for GitCode PR audits and the code/README only use the GitCode API (GITCODE_TOKEN). Requested credential (GITCODE_TOKEN) and behaviors (listing PRs, comments, labels, writing report files) match the declared purpose.
Instruction Scope
SKILL.md instructs running the bundled Python script with repository/time arguments. The instructions and script operate on PR data from api.gitcode.com and write Markdown/CSV outputs; they do not request unrelated files or network endpoints. The README explicitly forbids faking results and requires at least one --repo before running.
Install Mechanism
No install spec is provided; this is an instruction-only skill with a local Python script that relies only on the standard library. No remote downloads or archive extraction occur.
Credentials
Only GITCODE_TOKEN is required and declared as the primary credential. The script attempts to read process env and (on Windows) user/system env via a powershell call—this is consistent with the documented token resolution and appropriate for accessing the GitCode API.
Persistence & Privilege
The skill is not always-included and does not request system-wide changes. It writes output files only when the user specifies an --output path and reads a config.json from its own skill root by default; these behaviors are appropriate for a reporting tool.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install gitcode-pr-audit
  3. After installation, invoke the skill by name or use /gitcode-pr-audit
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
🎉 Initial release of gitcode-pr-audit - Provides quality audit for merged GitCode PRs across multiple repositories. - Samples PRs by time range or PR list, analyzes 8 key compliance dimensions (labels, comments, tests, size, etc.). - Outputs results as a Markdown or CSV table; command-line tool, Python 3.7+ stdlib only. - Flexible parameter parsing, with robust multi-repo and branch support. - Requires GITCODE_TOKEN for authentication; supports Linux/macOS/Windows.
Metadata
Slug gitcode-pr-audit
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is GitCode PR Audit?

Quality audit for merged GitCode PRs: sample by time range or repo list, check compliance (labels, comments, tests, size, etc.), output table. Use when user... It is an AI Agent Skill for Claude Code / OpenClaw, with 241 downloads so far.

How do I install GitCode PR Audit?

Run "/install gitcode-pr-audit" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is GitCode PR Audit free?

Yes, GitCode PR Audit is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does GitCode PR Audit support?

GitCode PR Audit is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created GitCode PR Audit?

It is built and maintained by do_while_true (@autoxj); the current version is v1.0.0.

💬 Comments