一键导入
preflight
Run all preflight checks (format, lint, build, tests) to make sure the current work is ready for review. Auto-detects project type.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run all preflight checks (format, lint, build, tests) to make sure the current work is ready for review. Auto-detects project type.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Check and fix milestones on PRs and their associated issues. Sets PR milestones based on the branch they merged into, and issue milestones based on the smallest version with a merged fix. Triggers on: check milestones, fix milestones, /check-milestones.
Delete local branches whose PRs have been merged upstream. Checks GitHub PR status for each branch. Triggers on: clean branches, delete merged branches, prune branches, branch cleanup.
Force-push a branch and all its downstream branches to origin. Auto-detects the downstream tree and skips branches already up-to-date. Triggers on: force push downstream, push chain, push all branches.
Implement review feedback on a PR. Checks out the branch, applies reviewer-requested changes, runs preflight, commits, and pushes. Triggers on: impl-review, implement review, implement review feedback, address review comments.
Re-run failed GitHub Actions CI jobs for a PR. Detects failure type (build vs test) and reruns only failed jobs. Triggers on: make ci green, retry ci, rerun ci, fix ci, re-run failed jobs, retrigger ci.
Create a pull request for the current branch using `gh`.
| name | preflight |
| description | Run all preflight checks (format, lint, build, tests) to make sure the current work is ready for review. Auto-detects project type. |
Run all preflight checks to make sure the current work is ready for review. Execute each step sequentially and stop immediately if any step fails.
all -- Run all discovered test suites without filters, instead of only
running tests affected by the change. Usage: /preflight allgit branch --show-currentgit status --shortDetect the default branch:
BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@refs/remotes/origin/@@' || echo "main")
If on the default branch, create a new branch off of it before proceeding (use a descriptive branch name based on the changes).
Identify the project type by checking for config files in the repo root:
| File | Project type |
|---|---|
pyproject.toml / setup.py / setup.cfg | Python |
package.json | JavaScript/TypeScript |
Cargo.toml | Rust |
go.mod | Go |
CMakeLists.txt / Makefile | C/C++ |
If multiple are present, run checks for each detected type. Announce the detected project type(s) before proceeding.
Run the appropriate formatter. If formatting changes any files, stage and include them in the commit later.
| Project type | Command |
|---|---|
| Python | ruff format . or black . (whichever is configured) |
| JavaScript/TypeScript | npx prettier --write . or per package.json scripts (npm run format if it exists) |
| Rust | cargo fmt |
| Go | gofmt -w . |
| C/C++ | find . -name '*.cpp' -o -name '*.h' | xargs clang-format -i (if .clang-format exists) |
Run the appropriate linter. Fix any issues found and re-run until it passes.
| Project type | Command |
|---|---|
| Python | ruff check . --fix or flake8 . |
| JavaScript/TypeScript | npx eslint . or per package.json scripts (npm run lint if it exists) |
| Rust | cargo clippy -- -D warnings |
| Go | golangci-lint run or go vet ./... |
| C/C++ | (skip if no linter config found) |
Check git status. If there are any uncommitted changes (staged, unstaged, or
untracked files relevant to the work), create a commit. The commit message
should be short and succinct, describing what was done. If there are no changes,
skip this step.
DO NOT include any Co-Authored-By line in commit messages.
Run the appropriate build command. If it fails, fix the build errors, amend the commit, and retry.
| Project type | Command |
|---|---|
| Python | (skip — Python has no build step unless setup.py / pyproject.toml defines one) |
| JavaScript/TypeScript | npm run build (if the script exists in package.json) |
| Rust | cargo build |
| Go | go build ./... |
| C/C++ | cmake --build build or make |
If the all argument was provided: Run the full test suite.
Otherwise (default): Determine which tests are affected by the changes in this branch (compare against the base branch). Look at the changed files and identify the corresponding test files or test targets.
| Project type | Full suite | Filtered / affected |
|---|---|---|
| Python | pytest | pytest <test_files> |
| JavaScript/TypeScript | npm test | npx jest --findRelatedTests <changed_files> or npx vitest run <test_files> |
| Rust | cargo test | cargo test <test_name> |
| Go | go test ./... | go test ./<changed_packages> |
| C/C++ | ctest --test-dir build | ctest --test-dir build -R <test_name> |
If no tests are affected, note that and move on.
If any step required fixes (build errors, test failures, format/lint issues), amend the commit with the fixes and re-run checks until everything passes cleanly.