Skip to content

PostToolUse build gate

Coined here

A Claude Code PostToolUse hook that runs `dotnet build` and `dotnet test` after every multi-file edit, surfacing failures back to the agent before the next plan step so broken intermediate states never accumulate.

Without a build gate, an agent can produce ten consecutive edits that compile individually but break the solution as a set. The PostToolUse build gate runs after any multi-file edit and feeds the build output back into the agent’s context — turning compilation and test failures into immediate, plan-step-local feedback rather than end-of-session surprises.

Placeholder body. Replace with the full glossary entry per playbook §9. Include a hook config snippet showing the multi-file detection logic and the build-output formatting back to the agent.

When to use

  • Any .NET solution where the build is fast enough to run between agent steps without significantly slowing the loop.
  • Large refactors where the agent’s confidence in correctness needs to come from the compiler, not from its own reasoning.

Compare with

A pre-merge CI build catches the same failures, but only after the agent has produced the full PR. The PostToolUse build gate catches them per-step, which means the agent can recover before the failure compounds across subsequent edits.

Related terms