bdd-specs
Writes behavior-driven executable specs (Feature > Scenario > Specification, one assertion per test) from a feature's STORIES.md and PLAN.md, in C# or Lit/TypeScript, using the project's existing test framework. Use when stories are final and it's time to write the tests, or when asked to spec out, write tests first, or do BDD/TDD.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- bdd-specs
- description
- Writes behavior-driven executable specs (Feature > Scenario > Specification, one assertion per test) from a feature's STORIES.md and PLAN.md, in C# or Lit/TypeScript, using the project's existing test framework. Use when stories are final and it's time to write the tests, or when asked to spec out, write tests first, or do BDD/TDD.
02 资源文件 2
- 参考文档references/backend-csharp.md5.4 KB
- 参考文档references/frontend-lit.md3.7 KB
03 SKILL.md 正文
BDD specs
Specs are written before the builder subagent implements a task — see "Open question"
below if your team wants to relax that. The spec is the design artifact: it encodes the
intended behavior from the stories, is marked pending until the code exists, and is
feature-build's definition of done for the task.
This skill states the discipline once and applies it to whichever layer(s) a feature actually touches — backend (C#), frontend (Lit + TypeScript), or both. The shape (Feature > Scenario > Specification, one assertion, happy-then-sad, pending by default, a real-entry-point spec) is identical either way; only the syntax it's expressed in differs. Don't duplicate this discipline into a second, stack-specific skill — extend the relevant reference file instead.
🎯 Why: Design for Change
One assertion per Specification means a failing spec names exactly what broke. Segregating happy path from sad path means you can change one behavior without re-reading the whole suite. The spec suite is the change-budget for the codebase — treat generating it as seriously as generating the code it will gate.
Gate: require the design and the stories first
Read the feature's plan folder.
SPEC.md— if it's missing, still a stub, or full ofTODO, stop. Tell the user: "No design yet — runfeature-designfirst, so specs are grounded in real extension points and API shapes instead of invented ones."STORIES.md— if it's missing, empty, or full of placeholder text, stop. Tell the user: "No stories yet — runfeature-planfirst, so specs come from real acceptance criteria instead of invented ones."
Do not draft design or stories yourself under this skill — that's feature-design's and
user-stories's job. If both gates pass, proceed.
Which layer(s) does this feature touch?
Check SPEC.md's "Endpoints" section and its screen sections, and read only the reference
file(s) that layer needs:
- Endpoints isn't "None" → read
references/backend-csharp.md. - At least one screen section → read
references/frontend-lit.md. - Both present → read both, and generate both as separate spec files in their respective projects. A story that spans both layers gets a spec in each — don't try to force one file to cover both.
Hard rules (apply to every spec, either layer)
- Happy path first, and exhaustive. Cover every success outcome the story implies before any failure case.
- Sad path is segregated into its own scenario grouping, never interleaved with happy-path specs.
- Exactly one assertion per test. No multiple assertion calls in one test, no looped assertions across a collection — assert on the collection shape instead (a single-item or count check), or split into one test per element being checked.
- At least one spec per feature exercises the real entry point — for a backend story, a Management API controller action through an in-memory test server, or a service resolved from DI exactly as Umbraco's Composer would wire it up; for a frontend story, the actual custom element rendered and driven through its public attributes/properties/events, not an internal method called directly. Fakes/mocks are fine for collaborators the spec doesn't own; the entry point itself must be real.
- Match the project's existing test conventions before inventing new ones — reuse its builders, fakes/mocks, and fixtures rather than writing ad hoc setup per spec.
- New specs are pending by default, marked so the runner reports them as skipped, not
failed, until a
buildertask makes them pass:[Ignore("Pending")]in NUnit,[Fact(Skip = "Pending")]in xUnit,it.skipin Mocha. A spec left active against code that doesn't exist yet fails the whole suite, and the next task can't tell its own failures from these. - Never invent acceptance criteria. If a story is underspecified, stop and send the user
back to
user-storiesto tighten it.
Before reporting, reread every spec you wrote against rules 3 and 6: one assertion each, and each one marked pending. These two slip most often.
Examples and per-stack mechanics
references/backend-csharp.md— test framework detection, the shape mapped onto NUnit (or xUnit), a full worked example, file/naming convention.references/frontend-lit.md— test framework detection, the shape mapped onto nativedescribe/itblocks, a full worked example, file/naming convention.
Open question: before or alongside implementation?
This skill assumes specs are written and pending before feature-build dispatches the
builder for the matching task — strict TDD. Writing tests alongside the implementation
instead, with the same one-assertion/happy-then-sad rigor applied after the fact, is equally
legitimate. Confirm which stance a project wants once, early (e.g. in its CLAUDE.md), rather
than letting it drift task by task.
04 同仓库更多 Skills
user-stories
Writes, splits and refines user stories with Given/When/Then acceptance criteria in STORIES.md, feeding bdd-specs. Use when turning a feature request or a vague ask into a testable backlog entry.
umbraco-security
What Umbraco provides for keeping a package secure, on the server and in the backoffice: Management API authorization and policies, settings that hold secrets, endpoints outside the Management API, sanitizeHTML and escapeHTML, DOMPurify rules for custom elements, and umbHttpClient instead of handling tokens in the browser. Use when writing or reviewing a Management API controller, a secret setting, a custom endpoint, a backoffice template that uses unsafeHTML, or frontend code that calls an API.
umbraco-performance
Keeping a package fast on the sites that install it: the published cache over the services layer, tree traversal, caching lookups and clearing them, data type config and converter cache levels, output cache eviction, light hot paths, and backoffice screens that don't over-fetch. Use when writing, changing or reviewing code that runs per request, per save, per indexed item or at startup (property value converters, notification handlers, indexing), code that loops over every content item (a full rebuild, an import, a sync), or a list or search screen. Not for a site's own templates.
umbraco-package-conventions
Backend conventions for an Umbraco package: async naming, internal by default, Attempt-based results for routine failures, public-API backwards compatibility, and where extension methods live. Use when naming a method, choosing visibility, shaping a service's result, changing a public signature (including adding a dependency to a public class's constructor), or organizing extension methods. For extension mechanisms, see `umbraco-extensibility`.
umbraco-marketplace
Gets a finished package listed on the Umbraco Marketplace: the NuGet tag, the dependency Marketplace reads version support from, the v14+ compatibility gotcha, and umbraco-marketplace.json. Use when a package is ready to publish, or when reviewing its packaging.
umbraco-extensibility
Umbraco's extension mechanisms (Composers, collection builders, notification handlers, attribute discovery) and a catalogue of backend CMS extension points: property value converters, Management API endpoints, content finders, health checks, search indexing, package migrations, background jobs, and more. Use when making a feature extensible or choosing which extension point fits. Not for property editor UI, dashboards, sections or trees, which the official Backoffice Skills plugin covers.