NetFabric/intelligentium / plugins/dotnet/.apm/skills/dotnet-agent-guardrails
dotnet-agent-guardrails
VerifiedDeterministic 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).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.1 KB |
| references/aspire-agent-native.md | markdown | 2.2 KB |
| references/conventions-and-analyzers.md | markdown | 3.7 KB |
| references/hooks-governance.md | markdown | 1.9 KB |
| references/testing-contract.md | markdown | 1.6 KB |
references/hooks-governance.md
View on GitHub# Hooks as the Governance Layer
[Hooks](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/use-hooks) let engineering workflows intercept agent actions, enforce rules, and collect telemetry — a programmable layer on top of the deterministic build-time guardrails (analyzers, `dotnet format`, tests).
## What Hooks Enforce
Hooks run scripts that validate behavior, enforce conventions, or gate a step before letting an agent continue. Implement them with [file-based C#](https://learn.microsoft.com/en-us/dotnet/core/sdk/file-based-apps) — no project scaffolding, run directly with `dotnet run script.cs`, easy to version and evolve alongside the rules they enforce.
## Hook Categories
| Category | Purpose |
|----------|---------|
| Governance | ensure generated code respects conventions, analyzers, and architectural boundaries |
| Telemetry | insight into how agents are used and where they struggle |
| Security | prevent unsafe patterns or accidental secret/data leaks |
| Workflow | integrate agents into formatting, testing, documentation, and other automated steps |
| Domain-specific | inject business vocabulary and invariants into the agent's reasoning |
## Division of Labor: Hooks vs Aspire
Hooks provide deterministic enforcement at **development time** (before/during an agent's edit). Aspire provides deterministic orchestration at **runtime** (once the system is running). Together they bound agent behavior across the whole lifecycle, not just at the point of code generation.
## Agents Can Help Build Hooks
Agents can propose hook logic from recurring codebase patterns, generate the initial file-based C# script, refine a script when it starts flagging false positives/negatives, and evolve hook behavior as conventions change — the same guide/maintain feedback loop analyzers have with agents (see [conventions-and-analyzers.md](conventions-and-analyzers.md)).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |