# Cscheck

Write and simplify C# property-based, model-based, and executable specification tests...

- Repository: https://github.com/Aaronontheweb/dotnet-skills (1244 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-28
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Aaronontheweb/dotnet-skills --skill cscheck -g -a claude-code -y`
Codex: `npx skills add Aaronontheweb/dotnet-skills --skill cscheck -g -a codex -y`
Cursor: `npx skills add Aaronontheweb/dotnet-skills --skill cscheck -g -a cursor -y`
Gemini CLI: `npx skills add Aaronontheweb/dotnet-skills --skill cscheck -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add Aaronontheweb/dotnet-skills`

## Description

Write and simplify C# property-based, model-based, and executable specification tests with CsCheck. Use for generators, shrinking, stateful command sequences, Spec guards and rules, implementation conformance, or replaying generated failures.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# CsCheck

Use CsCheck to explore inputs and action sequences; keep the application's contract visible in the test.
Let the library generate, shrink, print, and replay counterexamples. Start with the smallest test that
can falsify the claim, rather than building a testing framework around CsCheck.

## Choose the test shape

| What needs checking | Start with | Read when needed |
| --- | --- | --- |
| A function, round trip, algebraic law, or data transformation | `Gen` + `Sample` | [Properties and generators](references/properties.md) |
| An implementation with a simpler reference representation | `SampleModelBased` / `SampleModelBasedAsync` | [Stateful and async tests](references/stateful-and-async.md) |
| A protocol or lifecycle with explicit state, guards, and requirements | `Spec.From`, then `Exhaustive` and `Conform` | [Executable specifications](references/specifications.md) |
| Async resources or expectations that must incorporate observed outcomes | Generated command arrays + `SampleAsync`, with cleanup inside each case | [Stateful and async tests](references/stateful-and-async.md) |
| A failing property, seed replay, or a before/after bug demonstration | Native sampling controls and a concrete regression | [Failure discovery and replay](references/failures.md) |

Read only the references needed for the task. These examples use xUnit, but CsCheck itself is test-framework
independent. Preserve the project's existing framework and package-management conventions.

## Establish the contract first

Identify an observable requirement and a plausible wrong result it would reject. Separate generated
inputs, expected behavior, and actual observations. A model may consume observations, but must validate
them against prior expectations before accepting them as new state. Do not use the implementation's
answer to manufacture its expected answer.

The rest: https://github.com/Aaronontheweb/dotnet-skills/blob/HEAD/skills/cscheck/SKILL.md
