GitHub Copilot supports hooks that can automate tasks during an agent session. A practical use case is auto-formatting C# code after every file edit using the postToolUse hook event. The post walks through writing a PowerShell script that detects .cs file edits and runs dotnet format with .editorconfig rules, then configuring
Table of contents
What event should we use?Writing our scriptCreating the hookTesting the hookMore informationSort: