Skip to content

NetFabric/NetFabric.Numerics / .agents/skills/dotnet-agent-guardrails

dotnet-agent-guardrails

Verified

Deterministic guardrails for defining the review/validation process in .NET/C# development agents and agent squads: .editorconfig + dotnet format, TreatWarningsAsErrors, custom Roslyn analyzers, full test suites, Aspire telemetry, and Copilot/Claude Code hooks as the gates a change must pass. USE FOR: defining what 'done' means and which deterministic checks gate an agent-generated .NET change before merge, for a single agent or a squad of agents/subagents sharing a repo. DO NOT USE FOR: general AGENTS.md authoring for non-.NET repos (agents-md); C# style rules (csharp-best-practices); non-agent solution scaffolding (dotnet-solution-setup); BenchmarkDotNet usage (dotnet-benchmarking).

references/testing-contract.md

View on GitHub
# Testing as the Behavioral Contract

Tests are the most reliable deterministic signal for whether agent-generated behavior is correct. Treat the full suite as the definition of "done" — the same way `dotnet format` defines style compliance.

## AGENTS.md Instruction Pattern

```markdown
Run the full test suite before finishing any feature. A feature is not complete
until all tests pass. Do not weaken, skip, or delete a test to make it pass.
```

Explicit and machine-checkable beats "make sure tests pass" — it also tells the agent skipping/deleting a failing test isn't an acceptable resolution.

## Test Tiers

| Tier | Describes | Tooling |
|------|-----------|---------|
| Unit | domain rules | xUnit/NUnit/MSTest |
| Integration | how components interact | `WebApplicationFactory`, Testcontainers |
| End-to-end | user flows | [Playwright](https://playwright.dev/) |

## Triaging a Failing Test

When a test fails after an agent change, there are exactly three explanations:

1. The implementation is wrong.
2. The test is outdated.
3. The behavior intentionally changed.

An agent infers which applies from surrounding code, naming, domain rules, and cross-solution behavior consistency — but only if the failure signal itself is deterministic (same input → same failure, every run). Flaky tests destroy this feedback loop; fix or quarantine them before relying on agents to self-correct against the suite.

Without a solid test suite, agents cannot safely refactor or extend a system — they have no way to confirm a change didn't break something elsewhere. With one, they can operate on larger changes with less human review per step.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall