Perform spot checks on PRs merged into the main branch within a specified time range, assess quality across multiple dimensions, and output a table. Supports multiple repositories, configurable thresholds, and required labels; output can be written as Markdown or CSV.
When to Use
- Use this skill when the user expresses any of the following intentions:
- Compliance spot check/quality spot check: such as "perform a quality spot check on merged PRs", "spot check PRs merged in the last 30 days", "compliance check on merged PRs";
- Multiple repositories/repository list: such as "spot check PRs of the following repositories", "check PRs of several repositories under the owner organization";
- Output format: such as "organize the spot check results into a table", "output in table form".
- Must provide at least one repository(format
owner/repo); multiple repositories are supported, with optional time (default last 30 days) and branch, and optional spot check count or "all" check.
Authentication
GITCODE_TOKEN: read according to the following priority.
| Priority | Source |
|---|---|
| 1 | Process environment variable GITCODE_TOKEN |
| 2 | Windows user-level environment variable |
| 3 | Windows system-level environment variable |
- Linux/macOS: in
~/.bashrcor~/.zshrc,export GITCODE_TOKEN="..."。 - When not configured: the script reports an error and prompts to GitCode personal access token create and set the environment variable.
Paths and Cross-Platform
- Skill root directory(
SKILL_ROOT): the directory where this SKILL.md is located. The script is located via__file__and does not depend on the current working directory. - Supports Linux / macOS / Windows; when executing, use the script'sabsolute path(such as
python <SKILL_ROOT>/scripts/pr_audit.py ...)。
Fixed Process
- Parse parameters: extract from user input
--repo(may be multiple),--pr(may be multiple),--branch、--since、--until、--days、--all、--output, etc. - Call the script:
python <SKILL_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]- When specifying PRs: use
--pr N(may be repeated) andand specify only one--repo; the script only checks these PRs and does not fetch by time range. - When
--pris not specified: if time is not specified, the default is last 30 days(--days 30); if--since/--untilis specified, use the user's time. - When no branch is specified, try each repository in turn with master → develop → main; if none exist, report an error; if specified, use the specified branch, and if it does not exist, report an error.
- When no spot check count is specified,each repositoryrandomly samples 5-10for analysis; if fewer than 5, analyze all; when the user explicitly says "all" or "all" or passes
--all, PRs merged within that time range are allchecked.
- When specifying PRs: use
- Read results: the script willoutput the table to stdout(Markdown format); if
--outputis specified, also write to that file (.md or .csv). If the exit code is non-zero or there is an error on stderr, show the error to the user and end. - Success: Present the stdout table to the user; if a file was written, indicate the path.
Script parameters
| Parameter | Required | Description |
|---|---|---|
--repo |
Yes (can be multiple) | Repository, format owner/repo, can be passed multiple times for multiple repositories |
--pr |
No (can be multiple) | Specify PR number; choose one of PR number or time range, when used usually requires exactly one --repo |
--branch |
No | Target branch; when not passed, automatically tries master → develop → main |
--since |
No | Start date YYYY-MM-DD (inclusive of that day 00:00 Shanghai time) |
--until |
No | End date YYYY-MM-DD (inclusive up to that day 24:00) |
--days |
No | Most recent N days (default 30); choose one of N days or since/until, effective when since/until is not specified |
--all |
No | No sampling, check all PRs merged within the time range |
--output |
No | Output file path, extension .md or .csv, UTF-8 (CSV with BOM) |
--config |
No | Config file path, if not passed use config.json in the skill root directory |
- Specify PRs: When passing
--pr N(can be multiple), only these PRs are checked, requiring exactly one--repo, without filtering by time. - Time convention: use only
--days, or use only--since/--until. If both are passed, the script gives priority to--since/--until. - For multiple repositories:each repositorysamples or fully checks according to the above rules (Option A).
Analysis dimensions (8 items)
| Dimension | Description | Judgment |
|---|---|---|
| Unresolved comments | Whether there are unresolved diff review comments | In PR comments comment_type == "diff_comment" and resolved == false then recorded as "Yes" |
| Pipeline/Labels | Whether required labels are missing (including pipeline passed) | Configured required_labels if any is missing then "Yes" |
| Missing required labels | Same as above, merged with "Pipeline" into the configured required label set | See config.json required_labels |
| Added lines over limit | Whether added code lines exceed the threshold | Exceeds max_additions(default 1000) then "Yes" |
| No tests | Whether modified files include tests | None of the changed file paths contain test or ut then "Yes" |
| Multiple Issues | Whether more than 1 Issue is associated | Number of associated Issues > 1 then "Yes" |
| Missing review | Whether a large PR lacks review comments | Added lines > review_lines_threshold(default 500) and diff comment count is 0 then "Yes" |
| Unclear title/description | Whether the title and description are too short or too vague | Title length < title_min_length(default 5) or description length < body_min_length(default 10), then "yes"; after the length is satisfied, if the title/description is obviously vague (e.g., only "fix" or "modify" with no substantive explanation), it is judged as "yes" |
- Table columns: repository,PR(with
#编号with links, no separate link column), title, details for each dimension, issue summary. - Dimension columns are detail text:
- Unresolved comments:
否(已解决数/总 diff 评论数)or是(未解决数/总数), such as否(1/10)、是(2/5)。 - Missing required label:
否or是(缺:label1、label2)。 - Exceeded added lines:
否(实际行数)or是(实际行数)。 - Multiple Issues:
否(0)or是(N)。 - Missing review:
否or是(新增 N 行,0 个检视)。 - Title/description unclear:
否or是(原因,如标题过短、描述过短、描述笼统)。
- Unresolved comments:
- The last column, "Issue Summary", is a brief listing of all failed dimensions for that PR.
Configuration (config.json)
Located in the skill root directory, or specified via --config . Field descriptions:
| Field | Meaning | Default |
|---|---|---|
required_labels |
Required label list (missing any one means fail) | ["ci-pipeline-passed", "approved", "lgtm"] |
max_additions |
Added lines threshold; exceeding it is recorded as "Exceeded added lines" | 1000 |
review_lines_threshold |
If this number of lines is exceeded and there is no diff comment, it is recorded as "Missing review" | 500 |
title_min_length |
Minimum number of characters for the title | 5 |
body_min_length |
Minimum number of characters for the description | 10 |
test_substrings |
Substring that the path must contain when determining "contains tests" | ["test", "ut"] |
Output format
- Table columns: repository, PR (
#编号with links), title, unresolved comments, missing required label, exceeded added lines, no tests, multiple Issues, missing review, title/description unclear, issue summary (no separate link column; links are in the PR column). - stdout: always output a Markdown table (for easy console viewing).
- --output .md: write the same Markdown table as stdout to a file.
- --output .csv: write the same content to CSV, UTF-8 with BOM, for easy opening in Excel.
Prohibited
- It is prohibited to guess or fabricate data before obtaining script output.
- It is prohibited to execute the script when the user has not provided at least one
--repo.
Examples
| User intent | Command |
|---|---|
| Single-repository sampling inspection for the last 30 days | python <S> --repo owner/repo |
| Check specified PR | python <S> --repo owner/repo --pr 2905 --pr 2606 |
| Multi-repository sampling inspection for a specified time | python <S> --repo org/a --repo org/b --since 2026-02-01 --until 2026-03-10 |
| Check all without sampling | python <S> --repo owner/repo --days 7 --all |
| Specify branch and write CSV | python <S> --repo owner/repo --branch main --output report.csv |
| Custom configuration | python <S> --repo owner/repo --config /path/to/config.json |
Where <S> is the absolute path of <SKILL_ROOT>/scripts/pr_audit.py .
Historical versions
v1.0.0 (2026-03-11)
- 🎉 Initial version release
- 📊 Supports sampling inspection by time range and 8-dimension quality analysis