pre-pr-checks

Runs CI-enforced rebase, ruff lint, and test checks before creating or updating pull requests.

12|18|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/flagos-ai/Torch-FL --skill pre-pr-checks-flagos-ai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pre-pr-checks
Source: https://github.com/flagos-ai/Torch-FL/tree/main/.claude/skills/pre-pr-checks
Command: npx skills add https://github.com/flagos-ai/Torch-FL --skill pre-pr-checks-flagos-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Pull requests on torch_fl fail or stall when contributors skip the exact checks CI enforces: a stale base branch causes self-conflicting rebases, an unpinned local ruff disagrees with CI's pinned version, and a red lint job silently skips every downstream build and integration job. This Skill walks you through the correct order of operations so your PR passes CI on the first push. ## Core Features & Use Cases - Rebase discipline: Fetches the latest flagos/main before rebasing, detects commits that already landed upstream, and regenerates generated files instead of hand-merging conflicts. - Pinned lint gate: Runs the exact CI contract — ruff==0.15.12 with ruff check . and ruff format --check . — including the system-interpreter caveat on vendor boxes like Hygon DCU/DTK. - PR update workflow: Amends lint fixes into the existing single commit and force-pushes safely with --force-with-lease. - Use Case: Your PR's lint / Lint job went red with only "1 file would be reformatted" in the summary. Use this Skill to identify the offending file locally with ruff format --diff, fix it, amend the commit, and push again. ## Quick Start Before I run gh pr create on my torch_fl branch, walk me through the pre-PR checks: rebase onto the latest flagos/main, run the pinned ruff lint and format checks, and confirm my diff is clean.

Frequently Asked Questions about pre-pr-checks

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

FAQPage Schema
How do I run the same ruff checks locally that CI enforces?▼

Install the pinned version with pip install ruff==0.15.12, then run ruff check . and ruff format --check . from the repo root. The pin matters because formatting rules shift between ruff releases and an unpinned local ruff can disagree with CI.

How do I rebase a PR branch onto the latest upstream main?▼

Run git fetch flagos main first, verify the ref date with git log, then git rebase flagos/main. Check git log --oneline <old-base>..flagos/main for your own commit subjects, since a commit already merged upstream will conflict with itself and should be dropped.

Why does my CI lint job fail without running the build jobs?▼

The lint workflow runs first and every other job declares needs: lint, so a formatting slip skips the build and integration jobs entirely. Run the two ruff commands locally before pushing to avoid a red lint that tells you nothing about the actual change.

Why do I get "No module named ruff" on a Hygon DCU machine?▼

On vendor boxes the torch environment lives in the system interpreter while bare python resolves to a conda install without torch, so pip installs ruff into the wrong environment. Use /usr/bin/python3 -m pip install ruff==0.15.12 and /usr/bin/python3 -m ruff check . instead.

How do I fix a red ruff format check on an existing PR?▼

Run ruff format --check . locally to name the files and ruff format --diff <file> to see the exact change, then apply ruff format. Amend the fix into the existing commit with git commit --amend --no-edit and push with git push --force-with-lease.

How should I resolve conflicts in generated files during a rebase?▼

Do not hand-merge conflict markers in generated artifacts like csrc/aten/generated or backends configs. Take the upstream side with git checkout flagos/main -- <paths>, port only the generator change, re-run codegen, and confirm a second run produces no diff.