dotnet-testing
Skill1 starsChanged 3 months agoMITView on GitHub
Create, improve, debug, and review automated tests for .NET and ASP.NET Core applications. Use when writing unit tests, integration tests, API tests, database tests, test fixtures, mocks, fakes, or test infrastructure, and when diagnosing flaky or ineffective .NET tests.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- AllThingsSmitty/proven-skillstheir own version, first seen Oct 6, 2026
- kevintsengtw/dotnet-testing-agent-skillstheir own version, first seen Sep 30, 2026
- hkarpinen/agent-skillstheir own version, first seen Apr 15, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- kevintsengtw/dotnet-testing-agent-skills★ 29same name
- AllThingsSmitty/proven-skills★ 1same name
- hkarpinen/agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- architecture-reviewSkill
- code-reviewSkill
- dotnet-backendSkill
- ef-coreSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
79 rules. About 0 are common, 73 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈73
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use this skill when creating, debugging, or reviewing automated tests in .NET applications.
- Distinctive: line 15
Test behavior rather than implementation details.
- Distinctive: line 16
Prefer meaningful tests over chasing coverage percentages.
- Distinctive: line 17
Prefer tests that increase confidence in important application behavior and catch regressions.
- Distinctive: line 18
Avoid tests that merely reproduce implementation details.
- Distinctive: line 19
Avoid tests that only prove framework behavior.
- Distinctive: line 21
Ensure tests can run independently.
- Distinctive: line 26
Start with the behavior you need to prove, then choose the smallest test level that can prove it reliably.
- Distinctive: line 27
Use unit tests for isolated business logic.
- Distinctive: line 28
Use integration tests when behavior depends on wiring, persistence, serialization, configuration, or framework integration.
- Distinctive: line 29
Use API tests when HTTP contracts, filters, middleware, routing, auth, or status codes matter.
- Distinctive: line 30
Use end-to-end tests only when the behavior cannot be proved with a smaller, cheaper, more reliable test.
- Distinctive: line 31
Do not force everything into unit tests if the important risk is integration behavior.
- Distinctive: line 35
Keep the unit under test clear.
- Distinctive: line 36
Do not mock the component the test exists to verify.
- Distinctive: line 38
Do not mock dependencies automatically.
- Distinctive: line 40
Prefer simple object setup over elaborate mocking where possible.
- Distinctive: line 44
Use integration tests when the real composition matters.
- Distinctive: line 46
Keep the scope intentional.
- Distinctive: line 51
Test route behavior, model binding, validation, auth, status codes, and response contracts at the HTTP boundary.
- Distinctive: line 52
Keep API tests focused on externally observable behavior.
- Distinctive: line 53
Verify error payloads and problem responses when they are part of the contract.
- Distinctive: line 58
Use end-to-end tests sparingly for cross-process or full-environment behavior that lower test levels cannot cover.
- Distinctive: line 59
Keep them small in number and high in value.
- Distinctive: line 60
Avoid relying on them for fast feedback on ordinary business logic.
- Distinctive: line 64
Keep tests easy to scan.
- Distinctive: line 66
Avoid mixing multiple unrelated behaviors into one test.
- Distinctive: line 67
Prefer one logical act per test unless the scenario itself requires a sequence.
- Distinctive: line 71
Follow existing repository naming conventions.
- Distinctive: line 72
Use names that describe the behavior and relevant condition.
- Distinctive: line 73
Keep assertions specific and behavior-focused.
- Distinctive: line 75
Prefer clear failure messages or readable assertion styles when the repository already uses them.
- Distinctive: line 79
Test business rules directly and cover the meaningful edges.
- Distinctive: line 80
Use parameterized tests when the same behavior should hold across multiple inputs.
- Distinctive: line 81
Do not hide complex scenario meaning in oversized data tables.
- Distinctive: line 82
Keep the parameters readable enough that failures are easy to diagnose.
- Distinctive: line 86
Use mocks, stubs, fakes, or in-memory substitutes according to the repository's established patterns.
- Distinctive: line 87
Verify dependency calls only when the interaction itself is meaningful behavior.
- Distinctive: line 88
Avoid interaction-heavy tests when observable outputs or state changes prove the behavior more directly.
- Distinctive: line 93
Avoid uncontrolled system time.
- Very specific: line 94
Prefer TimeProvider or an equivalent abstraction when time affects behavior.
- Distinctive: line 96
Use deterministic seeds or fixed values when randomness matters.
- Distinctive: line 97
Do not let the current clock, timezone, locale, or machine state leak into test outcomes unless the test is explicitly about that behavior.
- Very specific: line 103
Avoid .Result, .Wait(), and sync-over-async in tests.
- Very specific: line 104
Never use arbitrary Thread.Sleep or Task.Delay as a workaround for flaky tests.
- Distinctive: line 108
Do not assume EF Core InMemory behaves like a relational database.
- Distinctive: line 109
Prefer the closest practical relational engine already used by the repository.
- Distinctive: line 110
Use the real provider or an appropriate disposable relational database when SQL translation, constraints, migrations, transactions, or …
- Distinctive: line 111
Use EF Core InMemory only when its limitations are acceptable for the specific behavior.
- Distinctive: line 112
Test constraints, transactions, query behavior, concurrency, and relational semantics against a realistic store.
- Very specific: line 117
Use WebApplicationFactory where appropriate for ASP.NET Core API integration tests.
- Distinctive: line 118
Prefer exercising the application through its real HTTP pipeline when routing, filters, middleware, auth, JSON configuration, or DI wiring …
- Distinctive: line 120
Keep test-only service replacements explicit and minimal.
- Very specific: line 124
Test protected endpoints for 401, 403, and successful authorized access where relevant.
- Distinctive: line 126
Verify resource-level authorization when the application enforces ownership, scope, role, or policy checks.
- Distinctive: line 130
Do not call real third-party APIs from normal automated tests.
- Distinctive: line 132
Test timeout, retry-safe failure handling, error mapping, and malformed response handling where relevant.
- Distinctive: line 133
Keep external contract assumptions visible in test setup and assertions.
- Distinctive: line 138
Test repeated and concurrent requests when verifying idempotency.
- Distinctive: line 139
Verify the observable guarantees: single effective state change, safe duplicate handling, conflict behavior, or invariant protection.
- Distinctive: line 140
Use synchronization primitives or controlled orchestration when needed.
- Distinctive: line 145
Keep fixtures predictable and easy to understand.
- Distinctive: line 146
Use builders or factory helpers to highlight relevant data and hide irrelevant setup.
- Distinctive: line 147
Do not let helpers become a second application layer inside the test suite.
- Distinctive: line 148
Keep shared state tightly controlled.
- Distinctive: line 152
Treat flaky tests as defects.
- Distinctive: line 153
Remove nondeterminism instead of increasing sleeps or retries.
- Distinctive: line 154
If a test is flaky, identify whether the issue is timing, shared state, environment dependence, async misuse, or hidden ordering.
- Distinctive: line 155
Add regression tests when fixing bugs where practical.
- Distinctive: line 160
Do not test private implementation details directly unless the repository explicitly does so and there is no better seam.
- Distinctive: line 161
Do not write tests that mirror the code line by line.
- Distinctive: line 162
Do not test framework behavior that the application does not customize.
- Distinctive: line 163
Do not assert incidental details that make refactoring harder without increasing confidence.
- Distinctive: line 170
Add only the setup needed for the scenario.
- Distinctive: line 171
Run the targeted tests after implementation.
- Distinctive: line 172
Run the broader affected test suite when practical.
- Distinctive: line 173
If the change fixes a bug, add a regression test when practical.
- Distinctive: line 188
If EF Core is involved, does the test use an appropriate database strategy for the behavior under test?
- Very specific: line 189
If ASP.NET Core is involved, should this be covered with WebApplicationFactory?
≈ “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
Dotnet Testing
Use this skill when creating, debugging, or reviewing automated tests in .NET applications.
Inspect the repository's existing test projects before writing tests. Follow its established test frameworks, assertion libraries, mocking libraries, naming conventions, fixture patterns, helper utilities, and project structure. Do not introduce a new test stack when the repository already has one.
Testing Philosophy
- Test behavior rather than implementation details.
- Prefer meaningful tests over chasing coverage percentages.
- Prefer tests that increase confidence in important application behavior and catch regressions.
- Avoid tests that merely reproduce implementation details.
- Avoid tests that only prove framework behavior.
- Keep tests deterministic.
- Ensure tests can run independently.
- Avoid test-order dependencies.
Choosing The Test Level
- Start with the behavior you need to prove, then choose the smallest test level that can prove it reliably.
- Use unit tests for isolated business logic.
- Use integration tests when behavior depends on wiring, persistence, serialization, configuration, or framework integration.
- Use API tests when HTTP contracts, filters, middleware, routing, auth, or status codes matter.
- Use end-to-end tests only when the behavior cannot be proved with a smaller, cheaper, more reliable test.
- Do not force everything into unit tests if the important risk is integration behavior.
Unit Tests
- Keep the unit under test clear.
- Do not mock the component the test exists to verify.
- Mock external boundaries when appropriate.
- Do not mock dependencies automatically; only isolate collaborators that would make the test slow, nondeterministic, or less meaningful.
- Focus unit tests on business rules, branching logic, invariants, calculations, and edge cases.
- Prefer simple object setup over elaborate mocking where possible.
Integration Tests
- Use integration tests when the real composition matters.
- Cover persistence, dependency injection wiring, configuration, serialization, middleware, and application boundaries that unit tests cannot prove.
- Keep the scope intentional; integration tests should still target a concrete behavior, not the whole system by default.
- Reset or isolate state so tests remain independent.
API Tests
- Test route behavior, model binding, validation, auth, status codes, and response contracts at the HTTP boundary.
- Keep API tests focused on externally observable behavior.
- Verify error payloads and problem responses when they are part of the contract.
- Cover success and failure cases that matter to consumers.
End-To-End Tests
- Use end-to-end tests sparingly for cross-process or full-environment behavior that lower test levels cannot cover.
- Keep them small in number and high in value.
- Avoid relying on them for fast feedback on ordinary business logic.
Arrange / Act / Assert
- Keep tests easy to scan.
- Make setup intentional, action singular, and assertions explicit.
- Avoid mixing multiple unrelated behaviors into one test.
- Prefer one logical act per test unless the scenario itself requires a sequence.
Test Naming And Assertions
- Follow existing repository naming conventions.
- Use names that describe the behavior and relevant condition.
- Keep assertions specific and behavior-focused.
- Assert what matters; do not assert every property by default.
- Prefer clear failure messages or readable assertion styles when the repository already uses them.
Business Rules And Parameterized Tests
- Test business rules directly and cover the meaningful edges.
- Use parameterized tests when the same behavior should hold across multiple inputs.
- Do not hide complex scenario meaning in oversized data tables.
- Keep the parameters readable enough that failures are easy to diagnose.
Mocks, Stubs, Fakes, And Interaction Verification
- Use mocks, stubs, fakes, or in-memory substitutes according to the repository's established patterns.
- Verify dependency calls only when the interaction itself is meaningful behavior.
- Avoid interaction-heavy tests when observable outputs or state changes prove the behavior more directly.
- Favor fakes or lightweight test implementations over brittle mocks when that makes tests simpler and more realistic.
Time, Randomness, And Determinism
- Avoid uncontrolled system time.
- Prefer
TimeProvideror an equivalent abstraction when time affects behavior. - Avoid uncontrolled randomness.
- Use deterministic seeds or fixed values when randomness matters.
- Do not let the current clock, timezone, locale, or machine state leak into test outcomes unless the test is explicitly about that behavior.
Async Testing
- Await asynchronous operations correctly.
- Propagate cancellation when the behavior under test depends on it.
- Avoid
.Result,.Wait(), and sync-over-async in tests. - Never use arbitrary
Thread.SleeporTask.Delayas a workaround for flaky tests.
EF Core And Database Testing
- Do not assume EF Core InMemory behaves like a relational database.
- Prefer the closest practical relational engine already used by the repository.
- Use the real provider or an appropriate disposable relational database when SQL translation, constraints, migrations, transactions, or concurrency semantics matter.
- Use EF Core InMemory only when its limitations are acceptable for the specific behavior.
- Test constraints, transactions, query behavior, concurrency, and relational semantics against a realistic store.
- Isolate database state per test or per fixture so tests remain independent.
ASP.NET Core Integration Testing
- Use
WebApplicationFactorywhere appropriate for ASP.NET Core API integration tests. - Prefer exercising the application through its real HTTP pipeline when routing, filters, middleware, auth, JSON configuration, or DI wiring matter.
- Override configuration and dependencies carefully so the test still reflects production behavior where it matters.
- Keep test-only service replacements explicit and minimal.
Authentication And Authorization Tests
- Test protected endpoints for
401,403, and successful authorized access where relevant. - Distinguish unauthenticated behavior from authenticated-but-forbidden behavior.
- Verify resource-level authorization when the application enforces ownership, scope, role, or policy checks.
External HTTP Integration Testing
- Do not call real third-party APIs from normal automated tests.
- Mock or fake the external boundary at the HTTP layer or integration seam already used by the repository.
- Test timeout, retry-safe failure handling, error mapping, and malformed response handling where relevant.
- Keep external contract assumptions visible in test setup and assertions.
Concurrency And Idempotency Tests
- Explicitly test concurrency-sensitive behavior concurrently where practical.
- Test repeated and concurrent requests when verifying idempotency.
- Verify the observable guarantees: single effective state change, safe duplicate handling, conflict behavior, or invariant protection.
- Use synchronization primitives or controlled orchestration when needed; do not rely on timing luck.
Fixtures, Builders, And Shared Infrastructure
- Reuse shared test infrastructure only when it reduces duplication without hiding important behavior.
- Keep fixtures predictable and easy to understand.
- Use builders or factory helpers to highlight relevant data and hide irrelevant setup.
- Do not let helpers become a second application layer inside the test suite.
- Keep shared state tightly controlled.
Flaky Tests And Regression Tests
- Treat flaky tests as defects.
- Remove nondeterminism instead of increasing sleeps or retries.
- If a test is flaky, identify whether the issue is timing, shared state, environment dependence, async misuse, or hidden ordering.
- Add regression tests when fixing bugs where practical.
- Make regression tests prove the bug scenario and the intended fixed behavior.
What Not To Test
- Do not test private implementation details directly unless the repository explicitly does so and there is no better seam.
- Do not write tests that mirror the code line by line.
- Do not test framework behavior that the application does not customize.
- Do not assert incidental details that make refactoring harder without increasing confidence.
Test Implementation Workflow
- Inspect the existing test projects and conventions first.
- Identify the behavior that actually needs proof.
- Reuse existing fixtures, helpers, and patterns where they help.
- Add only the setup needed for the scenario.
- Run the targeted tests after implementation.
- Run the broader affected test suite when practical.
- If the change fixes a bug, add a regression test when practical.
Test Review Checklist
- Does the test follow the repository's existing test stack and conventions?
- Does it prove behavior rather than implementation details?
- Is the chosen test level the smallest one that reliably proves the behavior?
- Is the test deterministic and independent?
- Does it avoid test-order dependencies?
- Are assertions specific, meaningful, and not overly coupled to internals?
- Are mocks or fakes used intentionally rather than automatically?
- Is interaction verification used only when the interaction is meaningful behavior?
- Is time controlled with
TimeProvideror an equivalent abstraction when needed? - Is randomness controlled?
- Are async operations awaited correctly without sleeps as synchronization?
- If EF Core is involved, does the test use an appropriate database strategy for the behavior under test?
- If ASP.NET Core is involved, should this be covered with
WebApplicationFactory? - Are
401,403, and success paths covered for protected endpoints where relevant? - Are external HTTP dependencies isolated from real third-party services?
- Are concurrency and idempotency behaviors tested explicitly where they matter?
- Is shared test infrastructure helping clarity rather than hiding behavior?
- Would this test catch the regression it claims to prevent?
- Were the targeted tests run, and was the broader affected suite run when practical?
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.

