gates-and-baselines
Governs quality gates and the unified-baseline snapshots. Use when authoring a baseline refresh commit (coverage, CRAP, maintainability, duplication, dead-exports), when setting up or modifying CI quality gates, or when introducing a new gate that asserts on pre-existing state without turning the base branch red.
- License 许可
- MIT
- 所属仓库
- dsj1984/mandrel
- 最近更新
- 2026-11-13
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- gates-and-baselines
- description
- Governs quality gates and the unified-baseline snapshots. Use when authoring a baseline refresh commit (coverage, CRAP, maintainability, duplication, dead-exports), when setting up or modifying CI quality gates, or when introducing a new gate that asserts on pre-existing state without turning the base branch red.
- allowed_tools
- [ "Read", "Write", "Bash" ]
02 资源文件 1
- 参考文档reference.md4.9 KB
03 SKILL.md 正文
Gates and Baselines
Policy Capsule
- No gate may be skipped. Failing lint means fix lint; a failing test means fix the code, not
.skipor delete the test. Feed CI failure output back verbatim and reproduce locally before re-pushing. - Introducing a gate that asserts on pre-existing state (doc-drift, lint-vocabulary, dependency-cycle, missing-coverage) MUST land green at merge: either advisory-first (report-only until the backlog is burned down) or with the populated baseline committed in the same change that turns the gate on. Never wire a gate into
requiredChecksthat lands red on latent findings nobody authored. - Refresh a baseline only when the change is deliberate — a rename/move, an operator-approved complexity bump, a signed-off perf delta, an intentional API-surface change. Never refresh to paper over an unintentional regression; fix the regression instead.
- Pick the refresh that matches why you are refreshing — the wrong scope silently no-ops.
npm run <kind>:updateis diff-scoped: it re-scores only files changed inorigin/main..HEADand preserves every other row verbatim; that is what you want after changing code.npm run <kind>:reanchoris the same script with--full-scopeand re-scores every file in every target dir; that is what you want when the baseline is stale (a scorer-version bump, a coverage-shape change, accumulated drift), because a diff-scoped run would leave the stale rows exactly as they were. - Kinds carrying both scopes:
coverage,crap,maintainability,duplication. Dead-exports has no scope axis — knip scores the whole graph, sonpm run dead-exports:update(both passes) is the only sanctioned way to writebaselines/dead-exports.json/baselines/dead-exports-production.json; never hand-edit them. Run any refresh on the Story branch, never onmain. - Verify the refresh diff is scoped to the relevant
baselines/<kind>.json(plus cosmeticpackage-lock.jsonchurn only). If unrelated files appear, STOP — the refresh is contaminated. Stage baseline files explicitly (git add baselines/<kind>.json); nevergit add -Ain a refresh commit. - Commit-subject contract: the Conventional-Commits subject
chore(baselines): refresh <kind> snapshot for <reason>— never an ad-hoc leading token likebaseline-refresh:(commitlint and the planner validator reject it). The body is mandatory and non-empty: what changed, why the new floor is correct, and the Story that triggered it. - Add the machine-readable trailer
baseline-refresh: true(git-trailerKey: valuestyle) andStory: #<storyId>to that body. Never pass--no-verify; thecommit-msghook (commitlint) MUST run and pass. - After the refresh lands, re-run
node .agents/scripts/check-baselines.jsto confirm the gate passes against the new snapshot; if it still fails, a sibling kind drifted — refresh that kind too. - Open a
reference.mdsection only when the task engages it: the baseline roster, the per-kind refresh table, and the step-by-step procedure live there.
04 同仓库更多 Skills
no-capsule-skill
Fixture without a Policy Capsule section.
qa-harness
Conventions for agent-driven QA driving — the one driving-conventions reference behind both `/qa-run` (the known-scenario sweep through a real browser) and `/qa-explore` (agent-led exploratory driving). Use when instrumenting a live surface — covers navigation-first execution, per-surface console and network capture, design-token visual checks, the `F#` finding shape, per-environment resolution, and static driving as the documented interim. The run procedures live in `.agents/workflows/qa-run.md` and `.agents/workflows/qa-explore.md`; this skill is the conventions reference they lean on.
playwright
Robust E2E browser testing with Playwright. Use when writing browser-driven tests — leverage auto-waiting (no `waitForTimeout`), prefer user-visible locators (`getByRole`, `getByText`, `getByLabel`) over CSS/XPath, reuse `storageState` for auth, and enable trace-on-first-retry for CI debugging. Also carries the `data-testid` contract a UI change states in its acceptance criteria.
playwright-bdd
Wires Gherkin `.feature` files to Playwright via the `playwright-bdd` library. Use when running BDD scenarios on a Playwright runtime — pairs with the `gherkin-authoring` skill (scenario prose) and the `playwright` skill (browser conventions). Drives execution by tag expression with trace-first debugging and Playwright-native sharding.
gherkin-authoring
Authors `.feature` files that stay business-readable, translate cleanly from PRD acceptance criteria, and reuse a shared step-definition library. Use when writing or editing scenarios — the SSOT enforcement rules live in `.agents/rules/gherkin-standards.md`; this skill shows authors how to apply them.
security-and-hardening
Hardens code against vulnerabilities. Use when handling user input, authentication, data storage, or external integrations. The non-negotiable security MUSTs live in `.agents/rules/security-baseline.md`; this skill shows how to apply them, with the project's surfacing and validation-response process.