Agent SkillsHmbown/Codewhale › cw-gates

cw-gates

GitHub

在代码变更合并前执行验证梯度的技能,涵盖格式检查、区域测试及CI预算校验,确保变更安全可用。

docs/skills/cw-gates/SKILL.md Hmbown/Codewhale

触发场景

确认变更完成或准备合并时 运行dogfood构建前 需证明变更安全性时

安装

npx skills add Hmbown/Codewhale --skill cw-gates -g -y
更多选项

非标准路径

npx skills add https://github.com/Hmbown/Codewhale/tree/main/docs/skills/cw-gates -g -y

不安装直接使用

npx skills use Hmbown/Codewhale@cw-gates

指定 Agent (Claude Code)

npx skills add Hmbown/Codewhale --skill cw-gates -a claude-code -g -y

安装 repo 全部 skill

npx skills add Hmbown/Codewhale --all -g -y

预览 repo 内 skill

npx skills add Hmbown/Codewhale --list

SKILL.md

Frontmatter
{
    "name": "cw-gates",
    "description": "Use before claiming any Codewhale change is done, green, or ready to land: the focused-to-broad verification ladder, the budget checks CI enforces, and the rules for what counts as a passing test."
}

cw-gates

Pick the smallest evidence that answers the actual risk, then quote the real output. This repo has been burned twice by the alternative: an exit code mistaken for a pass, and a harness whose scoring line silently reported unevaluated rows as green. Assertions without command output are not evidence.

Stage 3 of the loop: cw-orientcw-slicegatescw-dogfoodcw-landcw-handoff.

When to use

  • Before saying "done", "green", "passing", "fixed", or "ready to land".
  • Before a dogfood build — never install an ungated binary.
  • When asked to "run the gates" or to prove a change is safe.

For release work specifically, use codew-release-qa-sweep instead — it adds the version-drift gate and the manual TUI QA targets on top of this ladder.

Workflow

Climb only as far as the risk requires. Say where you stopped and what you skipped.

Rung 1 — always, and cheap

cargo fmt --all -- --check
git diff --check

Rung 2 — the area that owns the change

scripts/dev-test.sh maps an area or a source path to the fastest correct invocation, and applies the isolated build-dir topology (docs/BUILD_PERFORMANCE.md):

scripts/dev-test.sh --list
scripts/dev-test.sh crates/tui/src/elapsed.rs      # path → area + filter
scripts/dev-test.sh tui tools::                    # area + filter
scripts/dev-test.sh config

It uses cargo nextest run when nextest is on PATH (.config/nextest.toml); CODEWHALE_DEV_NEXTEST=0 forces libtest. For the TUI crate, --lib and --tests are disjoint — choose the target that owns the behavior rather than running both by reflex.

cargo test --no-run answers a compile question without executing unrelated cases. cargo test --doc covers doc examples, and is only worth running when those examples changed.

Rung 3 — the budgets and drift checks CI enforces

Run the ones your change can move. Each fails the build in CI:

python3 scripts/check-dead-code-budget.py          # #[allow(dead_code)] ceiling
python3 scripts/check-runtime-contract-budget.py
python3 scripts/check-persistence-backlog-budget.py
python3 scripts/check-provider-registry.py         # provider registry drift
python3 scripts/check-command-crate-boundaries.py  # command-contract boundary
python3 scripts/check-command-migration-manifest.py
python3 scripts/check-tui-locale-parity.py         # touched crates/tui/locales/
sh scripts/check-tui-product-vocabulary.sh
python3 scripts/check-readme-translations.py       # touched README*.md
./scripts/release/check-versions.sh                # touched a version anywhere

The dead-code budget may go down freely; raising it needs a reviewer to be told why. Lock in a win with python3 scripts/check-dead-code-budget.py --update.

Rung 4 — cross-cutting or release risk only

cargo clippy --workspace --all-targets --all-features --locked -- \
  -D warnings \
  -A clippy::uninlined_format_args \
  -A clippy::too_many_arguments \
  -A clippy::unnecessary_map_or
cargo nextest run --workspace --all-features --locked --profile ci
cargo test --workspace --all-features --locked --doc
git diff --exit-code -- Cargo.lock                 # lockfile drift guard

--all-targets matters: without it, clippy never lints test code, and the v0.9.10 release gate opened with four clippy failures on a green main, three of them in test targets.

Rung 5 — website, when web/ changed

cd web && npm ci && npm run prebuild && npm run check:facts \
  && npm run check:docs && npm run check:tokens && npm test \
  && npm run lint && npx tsc --noEmit && npm run build

Claiming a test passed

  • Quote the real test result: N passed; M failed line, and confirm N > 0 for the tests that cover your change. cargo test <filter> exits 0 having run zero tests when the filter matches nothing; an exit code alone has already been mistaken for a pass here.
  • Prefer proving a regression test fails without the fix. A test that passes either way pins the implementation, not the defect.
  • Audit any harness before trusting its score. ok = ok and X or True parses as (ok and X) or True and once reported twelve unevaluated rows as passing.
  • A focused rerun of a failing test distinguishes flake from regression in seconds. Do that before calling anything a flake, and root-cause anything that fails outside a known-flaky name — check for unisolated config-path reads or global timeout knobs first.

Red flags / don't

  • Don't say "tests pass" without the count line. Don't say "CI will catch it".
  • Don't run the full workspace suite as ritual for a leaf change, and don't re-run an unchanged suite to feel more confident.
  • Don't weaken a safety or data-integrity behavior to make a gate go green.
  • Don't call a failure a flake without a focused rerun and a named cause.
  • Don't skip the budget checks because they are "not really tests" — they are required CI contexts, and they encode migrations this repo has already paid for.
  • Don't report a green gate as permission. A passing sweep is readiness evidence; landing, tagging, and publishing need their own approval.

Output

A checklist: each command, pass/fail, and the salient line (test counts, budget numbers, the check-versions.sh verdict). Name explicitly what you did not run and why. If a step could not run in this environment, say so rather than implying coverage you do not have.

版本历史

  • aedb88b 当前 2026-09-09 04:22

同 Skill 集合

crates/tui/assets/skills/batch/SKILL.md
crates/tui/assets/skills/best-of-n/SKILL.md
crates/tui/assets/skills/contributor-onboarding/SKILL.md
crates/tui/assets/skills/dataviz/SKILL.md
crates/tui/assets/skills/debug/SKILL.md
crates/tui/assets/skills/delegate/SKILL.md
crates/tui/assets/skills/dependency-update/SKILL.md
crates/tui/assets/skills/docx/SKILL.md
crates/tui/assets/skills/feishu/SKILL.md
crates/tui/assets/skills/fleet-manager/SKILL.md
crates/tui/assets/skills/frontend-design/SKILL.md
crates/tui/assets/skills/handoff/SKILL.md
crates/tui/assets/skills/help/SKILL.md
crates/tui/assets/skills/implement/SKILL.md
crates/tui/assets/skills/interview/SKILL.md
crates/tui/assets/skills/mcp-builder/SKILL.md
crates/tui/assets/skills/mcp-discovery/SKILL.md
crates/tui/assets/skills/pdf/SKILL.md
crates/tui/assets/skills/plan/SKILL.md
crates/tui/assets/skills/plugin-creator/SKILL.md
crates/tui/assets/skills/pptx/SKILL.md
crates/tui/assets/skills/research/SKILL.md
crates/tui/assets/skills/review/SKILL.md
crates/tui/assets/skills/security-review/SKILL.md
crates/tui/assets/skills/simplify/SKILL.md
crates/tui/assets/skills/skill-creator/SKILL.md
crates/tui/assets/skills/skill-installer/SKILL.md
crates/tui/assets/skills/test/SKILL.md
crates/tui/assets/skills/v4-best-practices/SKILL.md
crates/tui/assets/skills/verify/SKILL.md
crates/tui/assets/skills/webapp-testing/SKILL.md
crates/tui/assets/skills/xlsx/SKILL.md
docs/skills/codew-release-qa-sweep/SKILL.md
docs/skills/cw-dogfood/SKILL.md
docs/skills/cw-handoff/SKILL.md
docs/skills/cw-land/SKILL.md
docs/skills/cw-orient/SKILL.md
docs/skills/cw-slice/SKILL.md
docs/skills/gh-assign-issues/SKILL.md
docs/skills/gh-close-issues/SKILL.md
docs/skills/gh-compile-issues/SKILL.md
docs/skills/gh-credit-harvest/SKILL.md
docs/skills/gh-file-issue/SKILL.md
docs/skills/gh-find-prs/SKILL.md
docs/skills/gh-treasure-hunt/SKILL.md
crates/tui/assets/skills/documents/SKILL.md
crates/tui/assets/skills/presentations/SKILL.md
crates/tui/assets/skills/spreadsheets/SKILL.md

元信息

文件数
0
版本
aedb88b
Hash
43659704
收录时间
2026-09-09 04:22

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-16 14:33
浙ICP备14020137号-1 $访客地图$