cratis/ai.distribution/write-specs
Claude Code and agent skill by cratis/ai.distribution
- community
Checking that the SKILL.md file is still in the repository.
Use this skill to write specs for an event-sourced Cratis APPLICATION slice (command, query, projection, reactor, constraint) using the in-process scenario family (CommandScenario / EventScenario / ReadModelScenario / ReactorScenario); out-of-process Chronicle integration is an advanced fallback. NOT for framework/library code — that uses the plain Specification base (see specs.csharp.md).
Install
npx vskill@latest install cratis/ai.distribution/write-specsSKILL.md
The same SKILL.md was published earlier as cratis/ai.distribution/write-specs.
Write comprehensive in-process BDD specs for an event-sourced Cratis application slice. Lead with the scenario family; reserve out-of-process Chronicle host specs for the host/transport boundary. Full patterns and assertion catalogs: .ai/rules/specs.scenarios.csharp.md (application profile).
Application-oriented. Most framework / library specs (Chronicle kernel, Arc pipeline, Fundamentals, generators) use the plainSpecificationbase + NSubstitute — see specs.csharp.md. A framework repo reaches for the scenario family only to test the engine it provides (Arc's command pipeline, Chronicle's event/projection/reactor engine) — see specs.scenarios.csharp.md.
Spec placement
Specs live in the same slice folder as the .cs file, each file wrapped in #if DEBUG … #endif (spec code ships only in Debug):
What to cover for every State Change command
One spec class for each of:
- Happy path — command succeeds, expected event appended (
CommandScenario) - Each validation failure — one
and_class perCommandValidator/ConceptValidatorrule (CommandScenario) - Each business rule violation — one
and_class per DCB condition inHandle()that inspects a read model (CommandScenario) - Each constraint violation — one
and_class perIConstraint→ use the write-specs-events skill (EventScenario)
Default: CommandScenario<TCommand> (in-process)
Runs authorization, validators, Provide(), and Handle() in-process and exposes the appended events — no HTTP, no fixture.
Every validation-failure spec asserts both (never assert on message strings — they are presentation text):
ShouldNotBeSuccessful()alone can't tell a validation rejection from an unhandled exception — pair it withShouldHaveValidationErrors().- Authorization failures use
ShouldNotBeAuthorized()(an unauthorized result has no validation errors). CommandResultassertions:ShouldBeSuccessful(),ShouldNotBeSuccessful(),ShouldBeValid(),ShouldHaveValidationErrors(),ShouldHaveValidationErrorFor(message),ShouldBeAuthorized(),ShouldNotBeAuthorized(),ShouldHaveExceptions().- Seed prior DCB read-model state through
_scenario.Services(substituteIReadModels); there is noGiven/EventsonCommandScenario.
Other slice types — defer to the focused skills
- Constraints / raw append semantics → write-specs-events (
EventScenario,ShouldHaveConstraintViolationFor(name)). - Projections & reducers → write-specs-readmodels (
ReadModelScenario<TReadModel>). - Reactors →
ReactorScenario<TReactor>(assert on mocked services); seespecs.scenarios.csharp.md. - React / TypeScript surface (view models, helpers, components) → write-specs-frontend.
Naming conventions
- Folder:
when_<verb_phrase>— e.g.when_registering - File:
and_<condition>.cs— e.g.and_name_is_unique.cs,and_name_already_exists.cs - Method:
should_<expected_result>
After writing
Run dotnet test (Debug). Fix all failures before completing.
For full worked examples (happy path, validation, constraint via EventScenario) and the advanced out-of-process host pattern, see references/EXAMPLES.md.
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/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)