cratis/ai.distribution/write-specs-events
Claude Code and agent skill by cratis/ai.distribution
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when asked to write tests or specs for event appending, event log behavior, constraint violations, or concurrency violations using EventScenario in a Cratis-based project. Produces infrastructure-free in-process specs using EventScenario and AppendResult Should* extensions.
Install
npx vskill@latest install cratis/ai.distribution/write-specs-eventsSKILL.md
The same SKILL.md was published earlier as cratis/ai.distribution/write-specs-events.
Writing Event Sequence Specs with EventScenario
Use EventScenario to test event-appending behavior in-process — no Chronicle server, database, or network required. Wrap every spec file in `#if DEBUG … #endif` so spec code ships only in Debug. Assert the constraint name (ShouldHaveConstraintViolationFor(name)), never the message.
When to use this skill
- Testing that a command appends the correct event(s)
- Testing that a constraint correctly rejects a duplicate or conflicting append
- Testing
AppendManyfor batch event appends - Testing concurrency or error conditions in event appending
For testing read model projections or reducers, use ReadModelScenario<TReadModel> instead.
Package
Basic structure
Step 1 — Create the scenario
Always create a new EventScenario per test. It starts with an empty event log and sequence number zero.
Step 2 — Seed pre-existing state (optional)
Use the fluent Given builder when the act phase depends on prior state:
Chain multiple ForEventSource calls to seed different event sources:
Rules:
- Call
Givenbefore the act phase — seeded events get monotonically increasing sequence numbers. - Do not put the act-under-test inside
Given; only pre-existing state goes here.
Step 3 — Append and assert
Use AppendMany for batch appends:
Assertion reference
| Method | Asserts | |
|---|---|---|
result.ShouldBeSuccessful() | Operation succeeded with no violations or errors | |
result.ShouldBeFailed() | Operation failed (any violation or error) | |
result.ShouldHaveConstraintViolations() | At least one constraint violation is present | |
result.ShouldNotHaveConstraintViolations() | No constraint violations are present | |
result.ShouldHaveConstraintViolationFor("ConstraintName") | A violation for the named constraint is present | |
result.ShouldHaveConcurrencyViolations() | At least one concurrency violation is present | |
result.ShouldNotHaveConcurrencyViolations() | No concurrency violations are present | |
result.ShouldHaveErrors() | At least one error is present | |
result.ShouldNotHaveErrors() | No errors are present |
All Should* methods throw AppendResultAssertionException on failure with a message that lists all violations and errors found.
Example: happy path
Example: constraint violation (duplicate)
Seed the pre-existing state, then verify the second append is rejected:
Example: batch append
Checklist
- [ ] New
EventScenarioinstance per test method (never shared state) - [ ]
Givencalled before the act phase for all pre-existing state - [ ] Each test asserts a single outcome (one
should_per behavior) - [ ] Constraint violation tests include
ShouldHaveConstraintViolationFor("ConstraintName") - [ ] Run
dotnet buildanddotnet test— fix all failures before completing
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/write-specs-events/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cratis/ai.distribution/write-specs-events)