sdd4j-ears-tests
Skill10 starsChanged 4 months agoMITView on GitHub
Generate parameterized (table-driven) tests from EARS requirement statements — the deterministic transform that turns an SDD4J capability spec's `## Requirements` into one parameterized test per requirement group and one labeled row per statement id. Stack-neutral; owns only the EARS→table mapping and the spec↔test trace, and delegates the test syntax to the composed stack skill (JUnit 5). Use whenever turning EARS requirements, acceptance criteria, or an SDD4J/`/sdd4j` spec into tests; whenever you see "When/While/If…then, the … shall …" statements that need covering; or when asked for table-driven, data-driven, or parameterized tests from a requirement group. Trigger on "SDD4J tests", "EARS", "parameterized tests", "table-driven tests", "data-driven tests", "tests from requirements", "tests from the spec", "cover requirement Rn", "generate tests for this capability", "acceptance criteria to tests".
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- conventional-commitSkill
- diagramsSkill
- drawioSkill
- java-conventionsSkill
- java-distillerSkill
- mermaidSkill
- microprofile-serverSkill
- migrate-to-bceSkill
- quarkus-jnosqlSkill
- sdd4j-bceSkill
- sdd4j-hexagonalSkill
- sdd4j-package-by-featureSkill
- sdd4j-package-by-layerSkill
- sdd4jSkill
- slddSkill
- spring-boot-serverSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Do not edit the spec and do not coin requirement ids.
- Distinctive: line 74
Leave authored or explicit TODOs for:
- Distinctive: line 81
Prefer a failing TODO, disabled placeholder with a visible reason, or stack-idiomatic red test over a fabricated green assertion.
- Very specific: line 94
Read references/realizations.md when concrete examples are useful.
- Distinctive: line 101
Before and after editing tests, check:
- Very specific: line 103
Every Rn.m in the spec resolves to at least one runner-visible test trace.
- Distinctive: line 104
Every literal or symbolic test trace resolves to an existing statement in the corresponding capability spec.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: SDD4J EARS Tests
Objective
Turn SDD4J EARS requirement statements into traceable parameterized Java tests. The leverage is structural: every EARS pattern is a (condition → response) tuple, and an SDD4J requirement group already collects statements that share one boundary operation — same arrange/act skeleton, only the data differs. That is the textbook precondition for parameterization, so the mapping is mechanical. This skill owns only the EARS-to-test transform and the requirement trace. The architecture adapter owns where capability code and tests belong. The stack skill owns concrete test syntax, runner, fixtures, and verification.
Input Contract
Consume a SDD4J capability spec, usually from package-info.java, with this shape:
## Boundary
- `place-order` - Places an order for a valid cart.
## Requirements
### R1 Place order
- R1.1 - When a cart with at least one item is submitted, the capability shall create and confirm an order.
- R1.2 - If the cart is empty, then the capability shall reject the request.
Do not edit the spec and do not coin requirement ids. Missing, duplicate, or malformed ids are spec issues to report back to SDD4J.
Core Mapping
- One requirement group
Rnmaps to one parameterized, table-driven, or grouped test skeleton when the group has multiple statements. - One statement
Rn.m→ one row in the parameter source. - The statement id
Rn.mresolves to the row's runner-visible display name, so the spec↔test binding stays per-statement. - The trace may be a literal id or a symbol such as
R1_2whose display form is the exactR1.2id. - An id that appears only in JavaDoc or a comment is not a trace.
- The EARS pattern fixes the row's role and shape — you do not invent the columns, you read them off the pattern.
The shared test body should exercise the boundary operation or application operation associated with the requirement group, as defined by SDD4J and the architecture adapter.
EARS Pattern To Case Shape
Each EARS statement decomposes into arrange, act, assert, and role fields. Do not invent concrete values from prose; use clear TODO/failing stubs when values or assertions are not derivable from existing code or user input.
| Pattern | Statement shape | Arrange | Act | Assert | Role |
| Event-driven | When <trigger>, the capability shall <response> | default state | trigger | response | happy |
| Unwanted behavior | If <trigger>, then the capability shall <response> | default state | invalid trigger | rejection/error | unhappy |
| State-driven | While <precondition>, the capability shall <response> | precondition | implicit | response | stateful |
| Complex | While <precondition>, when <trigger>, the capability shall <response> | precondition | trigger | response | full tuple |
| Optional-feature | Where <feature is included>, the capability shall <response> | feature enabled | trigger or implicit | response | gated |
| Ubiquitous | The capability shall <response> | default or global state | implicit | invariant | invariant |
Mixing happy and unhappy rows in one group is normal when they share the same operation skeleton.
Deterministic vs Authored
Generate without judgment:
- Group-to-test skeleton.
- Statement-to-row mapping.
- Requirement id labels.
- EARS role classification.
- Bidirectional trace coverage checks between spec ids and test ids.
- The shared operation target when SDD4J and the architecture adapter already identify it.
Leave authored or explicit TODOs for:
- Concrete fixture values.
- Domain object construction when not already obvious.
- Exact assertion expression for prose responses.
- Error type, status code, or message when the spec does not define it.
Prefer a failing TODO, disabled placeholder with a visible reason, or stack-idiomatic red test over a fabricated green assertion.
Composition
- SDD4J owns the spec, stable ids, gap workflow, and drift policy.
- The architecture adapter owns whether the operation is a controller method, application service method, BCE boundary method, listener, command, or another entrypoint.
- The stack skill owns test syntax and the verification command.
- This skill consumes
## Requirementsand emits or updates tests with exact runner-visible ids, represented by literals or resolvable symbols.
During /sdd4j apply, use this skill when an Rn.m statement lacks a test trace or when a requirement group should be represented as table-driven tests.
Realization Rules
Read references/realizations.md when concrete examples are useful. Use the project's existing test idiom; never introduce a second framework or style just because an example uses it.
The parameter-source mechanism and display-name form belong to the composed stack skill — read references/realizations.md for the per-stack shape (JUnit 5
@ParameterizedTest + @MethodSource). Java stacks materialize the Rn.m ids as a generated per-BC {BC name in CamelCase}Requirement annotation with a nested Rn enum — the label contract is unchanged because the enum's display form is the literal id; web stacks and the black-box -st module keep literal strings. Resolve the mechanism in this order: the trace convention field in AGENTS.md ## SDD4J when declared; otherwise the idiom the project's tests already use; if neither exists, propose one and ask. Never introduce a second test idiom.
Trace Coverage Check
Before and after editing tests, check:
- Every
Rn.min the spec resolves to at least one runner-visible test trace. - Every literal or symbolic test trace resolves to an existing statement in the corresponding capability spec.
- For symbolic traces such as
R1_2, resolve the symbol's configured display form before comparing it with the spec id. - One statement can have multiple tests only when each test covers a distinct level or scenario and the duplication is intentional.
- A test must not claim an id from another capability unless the project explicitly has cross-capability system tests.
Report orphan test ids as drift. Do not edit the spec to absorb orphan ids.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

