gitcode-toolkit

Provides shared GitCode API references, git workflows, and deterministic scripts for PR and Issue collaboration.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill gitcode-toolkit-wangwindow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gitcode-toolkit
Source: https://github.com/WangWindow/CANN-BatchMatMulMaxsum/tree/main/.agents/skills/gitcode-toolkit
Command: npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill gitcode-toolkit-wangwindow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, and includes scripts (resource) and references (resource) components.

What problem does it solve? Working with GitCode repositories requires juggling API endpoints, token handling, PR branch fetching, merge-base diffs, and safe write operations. This Skill centralizes that shared knowledge and tooling so GitCode collaboration skills (PR handlers, Issue generators, Issue handlers) can reuse one consistent, verified foundation instead of duplicating fragile logic. ## Core Features & Use Cases - GitCode API Reference: Complete v5 API documentation for PRs, Issues, comments, repository contents, and user accounts, including error-code handling and rate-limit (429) recovery policy. - Deterministic Scripts: URL parsing to JSON, environment preflight checks, one-shot PR context fetching (clone + diff + log), a shared HTTP client with cross-process rate limiting, and CI pipeline triggering. - Safe Write Workflows: Authorization contracts requiring explicit user confirmation before comments, pushes, or PR creation, plus post-write verification via GET or git ls-remote. - Use Case: When reviewing a GitCode PR, run the fetch_pr_context script to clone the repo, check out the PR branch via refs/merge-requests, compute the merge-base, and get changed files and commit history in one JSON output. ## Quick Start Ask the assistant to fetch the context of a GitCode pull request by providing its URL, for example to clone and summarize the changes of a PR in a repository like cann/ops-math.

Frequently Asked Questions about gitcode-toolkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch a GitCode PR branch locally for review?

Fetch the PR through the merge-requests ref with git fetch origin +refs/merge-requests/{n}/head:pr_{n}, then check out pr_{n}. GitCode uses refs/merge-requests, not GitHub's refs/pull. A fallback fetches from the fork remote if the main method fails.

How do I get a GitCode API token and pass it to requests?

Token resolution priority is: user-provided value, then the GITCODE_TOKEN environment variable, then asking the user. Pass it either as a PRIVATE-TOKEN header or as an access_token query parameter. Reporter-level permission or higher is required to create Issues.

How do I view PR changes relative to the base branch in git?

Compute the merge-base with git merge-base base_branch pr_{n}, then run git diff --stat or git diff $MERGE_BASE pr_{n}. If the merge-base is missing in a shallow clone, deepen history with git fetch --deepen=500 rather than diffing against the base branch directly.

Does this toolkit work with GitHub or GitLab repositories?

No, it only supports the GitCode platform at gitcode.com. The URL parser rejects other domains, and the API references target api.gitcode.com v5 endpoints exclusively.

What happens when the GitCode API returns HTTP 429?

The shared client honors Retry-After or rate-limit reset headers and publishes a cross-process cooldown so other callers pause. Retries are bounded to at most 3 attempts; exceeding the budget returns a rate-limited status instead of retrying indefinitely.

Why must write operations like comments or pushes be confirmed first?

The authorization contract requires explicit user confirmation bound to the exact target, operation type, and full content before any write. After execution, results are verified with GET or git ls-remote, since an HTTP success code alone does not prove the write completed.