Git Kit
A unified entry point for common Git operations. First understand what the user intends through "Intent Routing," select exactly one route, execute that route, and then finish according to its acceptance criteria.
This skill uses a multi-file structure. The main file contains only intent routing. After matching a route, follow the "Load on Demand" instructions to read the corresponding child file and execute its complete workflow, avoiding loading everything at once.
Intent Routing (Decision Tree)
Parse the user's intent from the message and route it to exactly one branch. Do not skip routing and execute an operation directly.
| Route key | Matching signals (present in the user's message) | Corresponding child file |
|---|
| Commit or push current changes ("commit," "push," "commit," or "push"); if the starting point is a stable branch, automatically create a working branch | references/commit-push.md
(includes ) |
| Only needs commit message copy ("write a commit message," "generate commit information," or the user explicitly says "do not commit, just give me the text") | references/commit-message.md
(includes ) |
| A branch plus a Chinese description ("create a branch…," "switch to a new branch…," "create a branch to do XX") | |
| Create or update a PR/MR ("open a PR," "create a merge request," "update the MR") | |
| Merge a PR/MR and update the main branch ("merge the PR," "merge the MR," "merge PR," or "merge it into the main branch"); after matching, retain and do not delete the head when it is a stable branch | |
| Only tag a branch with a version and push it ("create a tag," "tag it," "add a tag," "release tag," or "tag the branch") | |
| The release phase after ("publish a release," "publish a version," "release a new version," "put this version live," or "run the release process"); tag an already merged stable branch → create a GitHub/GitLab Release by default → track other downstream effects and verify them one by one (do not assume it is npm) | |
| Slim down the repository, perform a shallow clone, or reduce repository size ("slim it down," "clean up Git history," or "shallow clone") | |
| Pull and categorize the user's starred GitHub repositories ("categorize my starred repositories" or "organize my starred repositories into a list") | references/star-classify.md
|
For ambiguous requests, directly handle overlaps according to the matched intent:
- Both "commit" and "push" → (including message generation); only "information/text" or an explicit "do not commit" → .
- For PR/MR-related requests: "merge request" used as a GitLab noun → ; "merge" used as a verb (merge XX, merge into XX, or merge) → .
- The boundary between and : only tags a branch and then ends (any branch, at any time, with no platform Release creation); is the phase after —the version is already present on a stable branch, and it is responsible for creating a tag, creating a GitHub/GitLab Release by default, tracking other downstream effects (release workflows, npm, etc., based on detection results), and producing a receipt. When the user wants to "bump the version/open a PR/merge," this does not belong to ; use + + .
- If no signal matches → stop and ask the user which Git operation they want; do not take action without explicit intent.
Parameter conventions (extracted from the user's message and taking priority over any context):
- : extract the Chinese description (the sole basis for candidate branch names).
- : the target branch name is optional; if absent, detect the target repository's default branch.
- : prioritize an explicitly provided number or URL; if absent, detect an open PR/MR associated with the current branch. Regardless of the source, before merging, display the "number + title + target branch + head branch and its destination (will be deleted / retained because it is a stable branch)" and ask the user to confirm using three options (yes / no / custom ID). If nothing can be detected, require the user to provide a number and do not guess. When the head is a stable branch, always retain it and do not delete it; see
references/stable-branch.md
and for detection and override rules.
- : provide at least
--version <v> [--version-file <path>]
or . Determine which file is the version source by reading the repository (the script does not recognize any manifest format; first identify the applicable existing commands for each convention in references/version-conventions.md
): for literal constant versions, use + (perform boundary-match verification and report the line number); for derived or injected versions (Go ldflags, setuptools-scm, , Composer), use only ; for repositories whose release workflows strictly validate versions, add . means the target version has not yet been determined (this does not mean asking the user for a tag). Handle according to (including the multi-version-line : a complete tag must be provided explicitly). Do not change version numbers on your own.
- : the branch name or tag name () is optional; if absent, detect the latest tag and its source branch, candidate branches, and candidate version numbers, then display them for the user to select and confirm before deciding which branch or version to tag. For repositories where the target is a release, additionally align the version number (the tag version must exactly match the value declared in the version source file; otherwise the release workflow will reject the release). Determine the version source file by reading the repository. If they do not match, first follow + to bump the version; see the "Release Constraints" section in .
- : the retention period is optional; if absent, default to .
Context constraints for the two message types:
- When matching the or route, process only the wording or description provided by the user and ignore all code, files, Git diffs, Git status, and other context.
- When matching , , , , , or , proactively reading Git status is necessary (diff, remote, and history).
Load on Demand
After confirming the route, execute the complete workflow in the corresponding child file:
- or : first
read references/commit-format.md
, then read references/<corresponding route>.md
, and finally execute the instructions in that file. additionally requires read references/stable-branch.md
first (automatically create a branch when the starting point is a stable branch, including when bumping a version for a release).
- :
read references/branch.md
.
- : first
read references/repo-id.md
(repository parameter rules for gh/glab), then read references/pr-create.md
.
- : first
read references/stable-branch.md
(determine whether to retain the head) and read references/repo-id.md
(repository parameter rules for gh/glab), then read references/pr-merge.md
.
- : first
read references/stable-branch.md
(stable branch preference for candidate branches), then (including "Release Constraints": version alignment and version bump order), and use scripts/changelog.sh --link-to <tag>
to generate the annotation body (have the user review it before pushing).
- : first
read references/ask-options.md
(always ask questions at decision points using options, rather than printing the current state and waiting for a natural-language answer), then read references/version-conventions.md
(first identify the repository's version convention and collect evidence using the corresponding commands), then read references/release.md
(release phase workflow and plan card), then the "Release Constraints" section of (version alignment and annotation tag). Run scripts/release-preflight.sh
for a read-only preflight check (read the version source from the repository's declarations: --version <v> --version-file <path>
or ; the script only verifies whether the declared file contains that version). The returned determines whether to create a tag, perform verification only, or first identify the version source; / / determine whether the Release should be created or only verified, and provides the original publishing steps. If is non-empty, stop; report items honestly. Use scripts/changelog.sh --link-to <tag>
to generate and persist the release notes (the is used for both the tag annotation and the Release body, and must be reviewed before pushing; do not recalculate it afterward). The Release is created by default as part of the workflow (when , only verify it and do not create it again). After creating the tag and creating or verifying the Release, use scripts/release-verify.sh --platform <p> --tag <tag> [--probe-url <artifact URL>]
and other workflows to verify the Release and artifacts (produce a receipt in one pass; if an artifact has no public URL, do not pass the option and use the workflow result as authoritative; for npm repositories, the alias is available; defaults are 3 minutes / 5 seconds, and explains failures or unknown outcomes). If the user chooses to write the changes into : changelog.sh --from <previous tag> --to <BASE_REF> --version <tag> --link-to <tag> --write CHANGELOG.md
→ create a branch → → → run the preflight check again, then create the tag (the body remains the previously frozen version).
- : and follow its instructions to run (the script is the single source of truth and is shared with the command).
- :
read references/star-classify.md
and follow its instructions to run .