/delegate Write xUnit tests for OrderService.cs covering edge cases
/delegate Refactor the CustomerController to use minimal APIs
/delegate Run dotnet build, analyze warnings, and suggest fixes
The agent runs in a sandboxed environment with your repo context, completes the task, and returns results. This is particularly useful for .NET workloads:
-
Generating test projects with realistic test data and mocking frameworks (Moq, NSubstitute)
-
Scaffolding new ASP.NET Core projects from scratch or from existing models
-
Investigating NuGet package compatibility during version upgrades
-
Running dotnet CLI commands:
dotnet build, dotnet Ef migrations add, dotnet publish etc. — without leaving Copilot CLI
Return on investment: Instead of manually switching context, writing the test yourself, and then debugging, you describe intent in natural language and review the output when ready.
/context and /compact: Control Token Usage in Large .NET Solutions
Large .NET solutions with dozens of projects generate massive context. Every token costs money and slows responses. The /context and /compact commands let you manage this explicitly:
/context
This shows current context usage, file count, and approximate tokens consumed. Essential before asking Copilot CLI to analyze a 50‐project solution.
When context gets too large, use /compact:
/compact
Copilot CLI summarizes the conversation history, reducing token pressure — like minimizing a window but keeping the important state. For .NET developers working with monolithic repositories or large dotnet new‐generated microservice templates, this keeps responsiveness high and costs predictable. You can also explicitly exclude folders:
/compact --exclude "**/bin", "**/obj", "**/node_modules"
This prevents build artifacts and dependencies from polluting the context window during Copilot CLI sessions.
/allow-all and /deny-Tool: Manage Permissions Safely
By default, Copilot CLI asks for confirmation before executing any shell command. For .NET developers running dotnet build, migrations, or publish operations, this can cause permission fatigue. Slash commands let you configure trusted tools:
/allow-all
Gives blanket permission. Risky in production repos but fine locally — Copilot CLI moves faster, executing dotnet build and dotnet run without prompting you each time. To be more surgical:
/deny-tool dotnet-ef
/deny-tool docker
Useful when you trust dotnet build but want manual control over database migrations or container commands. Narrow permissions keep you safe while automating the tasks you trust.
The Bottom Line
As a .NET developer, you spend a lot of time in the terminal. GitHub Copilot CLI slash commands — /model, /delegate, /compact, /allow‐all — let you keep that flow.
Start small: open gh copilot today and try /model to switch models on a single task. Then experiment with /delegate for your next refactoring repetition. Once you feel the compound effect on daily .NET tasks, you will rarely go back to manually typing every command yourself.