Structured pull-request preparation: small commits, clear title/body, test evidence, risk notes, and checklist aligned with upstream contribution guidelines when present.
How this skill is triggered — by the user, by Claude, or both
Slash command
/polyglot-agent-harness:pr-workflowThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The user asks to open a PR, prepare a patch for upstream, or finish a feature branch for review.
The user asks to open a PR, prepare a patch for upstream, or finish a feature branch for review.
Declare the workflow (visible, mandatory) — The first line of every user-facing response while applying this skill MUST be exactly:
Applying pr-workflow
(or Applying pr-workflow skill). Subagents delegated PR or delivery work must declare which skill(s) they apply at the start of their final summary the same way (e.g. Applying pr-workflow, Applying report-generator). Do not bury the declaration mid-response or omit it when tools cannot natively “invoke skills”.
Then track completion items. Before marking the PR ready, confirm this blocking order (do not skip or reorder):
cargo fmt --all -- --check (exit 0)Scope — One logical change per PR when possible. Split unrelated edits.
Sync upstream first — Before finalizing the PR, fetch the upstream base branch and merge/rebase per project policy. Stop on conflicts and request human review (use experiment-guard).
Local verification — Ensure local checks and tests pass in the same environment as CI (prefer Docker/DevContainer). Do not claim “ready” without runnable commands and evidence. Run gates in this order: fmt → clippy → tests → E2E (step 4).
Before telling the user the PR is ready, before any commit intended for upstream, and before preparing the final draft — formatting must pass. This is not optional; a green local test run does not excuse a failed fmt job.
.github/workflows/ci.yml fmt job): cargo fmt --all -- --checkcargo fmt --all (or cargo fmt -p <crate> when changes are scoped to one crate), then re-run cargo fmt --all -- --check until exit 0Skipping this step is the most common avoidable CI failure on Rust PRs.
cargo xtask clippy); otherwise: cargo clippy --all-targets --all-features -- -D warningsE2E test case (mandatory for each PR) — Every PR must include at least one end-to-end test that exercises the changed behavior (e.g. ArceOS/Starry QEMU case under test-suit/, host script with clear pass criteria, or equivalent runner-visible check). Unit tests alone are not sufficient when the change affects runtime, build, or xtask workflows.
cargo fmt / rustfmt commands or fmt pass/fail in the Test plan — formatting is an agent/local preflight gate (step 0 / §3), not upstream-facing PR documentation, unless the user explicitly asks.cargo xtask arceos test qemu --arch x86_64 --test-case backtrace-raw-normal → expect BACKTRACE_BEGIN … BT 0/BT 1 with non-zero ip, then === host backtrace symbolize === with demangled function names (when auto-symbolize is enabled).Artifact inventory — List newly created files/dirs and what they do. If any were experimental or unrelated, remove them from the branch (stash or separate PR).
Commit messages — Imperative subject line (~72 chars), body explains why when non-obvious. Do not add Co-authored-by:, Co-Authored-By:, or other co-author attribution trailers unless the user explicitly requests them.
Report update (mandatory) — Invoke report-generator and update a report artifact for this change (default: local-only; do not include in upstream PR unless explicitly requested). PRs must not be opened with a stale/missing report when policy requires reporting.
Description template — Always prepare paste-ready PR content for the user (see Manual PR submission and PR title below):
type(scope): imperative descriptioncargo fmt / rustfmt — local gate only, unless user explicitly asks)PR-1, PR-4, TODO-2, etc.) from files like issue-146-backtrace-plan.md in upstream PR title or body. For follow-up work, use neutral wording (后续完成, follow-up PR) without numbering.Tracking issue: https://github.com/rcore-os/tgoskits/issues/146 (before Summary or as the first line).Diff review — Scan for secrets, debug prints, accidental file additions.
Upstream alignment — Apply experiment-guard sync before final push unless user declined.
Prepare for submission (default: manual) — Write the PR draft (English title + Chinese body per step 8) to a local file outside any git-tracked project directory (see Manual PR submission). The user tests locally and submits the PR manually on upstream. Do not run gh pr create, push for PR creation, or open a PR on the upstream/original repo unless the user explicitly asks.
English PR titles must follow Conventional Commits: type(scope): imperative description
| Part | Rules |
|---|---|
| type | Same family as commit messages: feat, fix, test, docs, refactor, ci, chore, perf, etc. |
| scope | Crate or area in parentheses — match what the PR actually touches, e.g. axbuild, axbacktrace, starry-kernel |
| description | Lowercase imperative mood, ~72 chars total for the full title, no period at the end |
Examples:
feat(axbuild): stream host backtrace symbolize on block endfix(axbuild): delete qemu log only after successful symbolizetest(arceos): add backtrace raw block e2e casesDo not use bare scope prefixes like axbuild: … without a type.
This is the default workflow unless the user explicitly requests automated PR creation.
gh pr create, do not push a branch for PR creation, and do not open a PR on the original/upstream repo. The user verifies locally first and submits manually.type(scope): imperative description) and Chinese body (Summary, Test plan with commands + expected output — no cargo fmt / rustfmt lines unless the user explicitly asks, Risk, issue links) ready to paste when the user opens the PR.tgoskits/). Examples:
/Users/hanjiaxin/Desktop/操作系统/pr-drafts/<repo-or-feature>-pr-draft.md操作系统/ is acceptable if it is not inside a git-tracked project folderCo-authored-by:, Co-Authored-By:, etc.) unless the user explicitly asks. Mandatory before any upstream-bound commit or “ready” message: cargo fmt --all -- --check must pass; if not, run cargo fmt --all, re-check, and include the diff in the same commit.Automation exception — Only when the user explicitly asks: push the branch and run gh pr create with the prepared title/body. Even then, prefer a fork or user-specified remote over opening directly on upstream unless they confirm.
When preparing a PR draft for backtrace work (Issue #146):
## Summary): Tracking issue: https://github.com/rcore-os/tgoskits/issues/146PR-1, PR-4, …) in title or body; refer to follow-up work as 后续完成 / follow-up PR without numbers.If touching fatal paths (panic/oops/trap) or logging/console code:
axpanic::enter_panic, enter_oops, oops_in_progress, backtrace one-shot gating).cargo check -p <crate> --target <triple>) and record it in the report.Applying pr-workflow as the first line of the response, or at the start of a subagent final summary) when doing PR-prep or delivery work.axbuild: … instead of feat(axbuild): …).gh pr create, no push-for-PR) unless the user explicitly asks.pr-draft.md or similar PR drafts inside a git-tracked project directory (e.g. tgoskits/).PR-1, PR-4, TODO-2, …) from local planning docs in upstream PR title or body — use neutral follow-up wording instead.cargo fmt --all -- --check passing locally first.cargo fmt commands, rustfmt check results, or “fmt passed” in PR draft title/body/Test plan (local preflight only; see step 8), unless the user explicitly asks.Co-authored-by:, Co-Authored-By:, or similar co-author attribution trailers to commit messages unless the user explicitly requests them.Agent troubleshooting only — do not paste these fmt steps into PR draft Test plan or body unless the user explicitly asks.
fmt job)Typical symptom in CI logs:
fmt job fails with Diff in path/to/file.rs (or cargo fmt --all -- --check exits non-zero locally)Fix:
cargo fmt --allcargo fmt --all -- --check until exit 0 before pushCommon gotcha (tgoskits axbuild): multi-line if with let chains rustfmt collapses to a single line, e.g. if cond && let Some(x) = y { in scripts/axbuild/src/arceos/test.rs. Local edit may look fine; CI still fails until you run cargo fmt --all and commit the formatter output.
Typical symptom in logs:
No space left on device (os error 28) while copying a rootfs imagetarget/<triple>/qemu-cases/<case>/cache/rootfs/.<hash>.img.<runid>.tmpChecklist:
CI=1, and/or allow an explicit kill-switch env (e.g. AXBUILD_DISABLE_ROOTFS_CACHE=1).SbiRet)Typical symptom in logs:
expected rustsbi::SbiRet, found sbi_rt::SbiRet (or other crate-path variants)Checklist:
rustsbi::Pmu / other RustSBI traits).SbiRet type consistently:
sbi_spec::binary::SbiRet (the canonical type used by RustSBI traits), or explicitly use rustsbi::SbiRet which re-exports it.sbi_rt::SbiRet into the impl signature.cargo check -p riscv_vcpu --target riscv64gc-unknown-none-elfProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub jiaxin2006/polyglot-agent-harness --plugin polyglot-agent-harness