Gherkin 特性文件编写
gherkin-authoring
编写 `.feature` 文件,使其保持业务可读性、能够从 PRD 验收标准清晰转换,并复用共享的步骤定义库。在编写或编辑场景时使用——SSOT 强制规则位于 `.agents/rules/gherkin-standards.md`;本技能向编写者展示如何应用这些规则。
- License 许可
- MIT
- 所属仓库
- dsj1984/mandrel
- 最近更新
- 2026-11-14
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- gherkin-authoring
- description
- 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.
02 资源文件 5
- 其他examples/invoice-issue.feature1.5 KB
- 许可证LICENSE1.0 KB
- 参考文档reference.md2.5 KB
- 参考文档SOURCE.md343 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Skill: gherkin-authoring
Policy Capsule
- Write
Givenclauses as stative preconditions,Whenas a single business action, andThenas a user-visible outcome. - Allow exactly one
Whenper scenario; if you need two, split into two scenarios. - Never assert on HTTP status codes, SQL state, DOM selectors, URLs, or JSON payloads inside
.featureprose — push those to contract tests. - Tag every Scenario or Outline with exactly one canonical
@domain-*tag and the appropriate risk/platform tags from the gherkin-standards taxonomy. - Use
Backgroundonly when every scenario in the file genuinely shares the precondition with no per-scenario variation. - Complete the step-reuse sequence in
gherkin-standards.md§ Step Reuse before authoring any scenario text; that rule is the only home for it. - Author one scenario per PRD acceptance criterion; for bounded matrices, use a Scenario Outline with ≤12 Examples rows.
- Use third-person present-tense, role-qualified actors (
the billing-admin), never first person.
The enforcement rules — tag taxonomy, forbidden patterns, Outline conventions,
selector discipline, step reuse — live in
.agents/rules/gherkin-standards.md,
which is the SSOT. This skill shows authors how to apply those rules; read
the rule for the what.
Long-form reference — read on demand
The step-definition library layout and the pre-PR authoring checklist live in
the on-demand sibling reference.md. Open a section only when
the task engages it.
Cross-References
- SSOT rules:
.agents/rules/gherkin-standards.md. - Runtime wiring:
playwright-bdd. - Browser-level conventions:
playwright. - Test-layer scope:
testing-standards.md. - Example feature:
examples/invoice-issue.feature.
04 同仓库更多 Skills
无策略胶囊测试夹具
no-capsule-skill
不含 Policy Capsule(策略胶囊)章节的测试夹具(fixture)。
智能体驱动 QA 测试规范
qa-harness
面向智能体驱动 QA 测试的约定规范——是 `/qa-run`(通过真实浏览器对已知场景进行扫描)和 `/qa-explore`(智能体主导的探索式驱动)共同依赖的统一驱动约定参考。在对线上界面进行检测和埋点时使用——涵盖导航优先的执行方式、按界面进行的控制台与网络抓取、设计令牌(design-token)视觉检查、`F#` 发现项格式、按环境解析,以及作为记录在案过渡方案的静态驱动。运行流程位于 `.agents/workflows/qa-run.md` 和 `.agents/workflows/qa-explore.md`;本技能是它们所依赖的约定参考。
Playwright E2E 浏览器测试
playwright
使用 Playwright 进行健壮的端到端(E2E)浏览器测试。在编写浏览器驱动的测试时使用——充分利用自动等待(不使用 `waitForTimeout`),优先选择用户可见的定位器(`getByRole`、`getByText`、`getByLabel`)而非 CSS/XPath,复用 `storageState` 处理认证,并为 CI 调试启用首次重试时记录追踪(trace-on-first-retry)。同时承载 UI 变更在其验收标准中声明的 `data-testid` 契约。
Playwright BDD 场景执行
playwright-bdd
通过 `playwright-bdd` 库将 Gherkin `.feature` 文件接入 Playwright。在 Playwright 运行时上执行 BDD 场景时使用——与 `gherkin-authoring` 技能(场景文本)和 `playwright` 技能(浏览器约定)配合使用。基于标签表达式驱动执行,支持追踪优先调试与 Playwright 原生分片(sharding)。
代码安全加固与漏洞防范
security-and-hardening
加固代码以防范漏洞。适用于处理用户输入、认证、数据存储或外部集成。不可妥协的安全强制要求(MUST)位于 `.agents/rules/security-baseline.md`;本技能展示如何应用这些要求,以及项目的问题上报与验证响应流程。
创意想法迭代精炼
idea-refinement
迭代精炼想法。通过结构化的发散思维与收敛思维来精炼想法。使用 "idea-refine" 或 "ideate" 触发。