June 21, 2026
Claude Code subagents and skills for .NET: when to use each (with a starter set for a C# solution)
The difference between a skill, a subagent, and a slash command in Claude Code - and which .NET tasks belong to each, with a practical starter set for C# solutions.
Claude Code ships with a CLAUDE.md and MCP as the base operating layer. But a third layer sits above those two: the agent layer, made up of skills (slash commands you define) and subagents (separate agent instances you spawn for isolated or parallel work). For a C# solution of any real size, knowing when to reach for each one is the difference between an agent that stays focused and one that runs in circles.
What is the difference between a skill, a subagent, and a slash command in Claude Code?
A slash command is an instruction shortcut: a Markdown file you place in .claude/commands/ that becomes invokable as /your-command. When you run it, Claude Code reads the file and acts on it in the current session. The command is just text - a prompt template that the current agent executes.
A skill is the pattern of wrapping a reusable workflow into a slash command. The word “skill” is informal here; Claude Code does not have a formal “skill” primitive distinct from commands. In practice, a skill is a slash command that encodes a complete, repeatable procedure - “add an EF Core migration with a rollback test” or “write a contract test for this endpoint.” It runs in your session, you see every step, and you can steer it if it drifts.
A subagent is a genuinely separate agent instance. Claude Code’s Agent capability spawns a fresh context with its own token budget. The subagent does its work, returns a result, and its internal reasoning does not stay in your main context. This matters for two reasons: context isolation (it cannot pollute your working thread with thousands of lines of search results) and parallelism (you can run several subagents simultaneously).
To summarize the heuristic: slash command / skill for in-thread, watched, steerable procedures; subagent for isolated, exploratory, or parallelizable tasks where you want the result without the cost of reading through the work.
When should a .NET task use a subagent vs a skill?
The right frame is: who should pay the context cost, and does the work benefit from isolation?
Reach for a skill when:
- The procedure is repeatable and you want to supervise each step.
- It naturally fits in the current session’s context - adding a migration, generating a contract test for the file you are already editing, running
dotnet formatanddotnet testas a post-change gate. - The output goes straight back into the code you are working on.
Reach for a subagent when:
- The task is exploration-heavy: finding all callers of a deprecated API across a twenty-project solution, auditing every package version against a known CVE list, mapping which projects have no test coverage.
- It can run in parallel with other work. While one subagent audits
src/Billing/, another can scansrc/Auth/. - The intermediate work - thousands of lines of grep output, NuGet package lists - should not land in your main context. Let the subagent distill it to a one- or two-paragraph summary.
- You want an independent second opinion - a code-review subagent that starts with no knowledge of your session’s assumptions often catches things you would talk yourself out of.
A practical rule of thumb: if the work is longer than a task you would describe in two sentences, and its intermediate steps are not decisions you need to make yourself, it belongs in a subagent.
What subagents and skills are worth setting up for a C# solution?
Here is a starter set that covers most of a senior .NET developer’s recurring agent tasks.
Skills (slash commands in .claude/commands/)
/add-ef-migration - prompts for a migration name, generates the dotnet ef migrations add command with the correct project flags, runs it, and confirms the migration compiles cleanly. Runs in-thread because you typically want to review the generated migration before doing anything else.
/write-contract-test - given the current file’s endpoint or public method, writes a contract (characterization) test that pins the existing behavior. Runs in-thread so you can review and adjust the test name and assertions before they land.
/roslyn-review - a code-review procedure that uses the Roslyn MCP to fetch real symbol references before commenting on an API surface. In-thread because you want to interact with its findings.
/post-change-gate - runs dotnet build, dotnet test, and dotnet format --verify-no-changes in sequence and reports the result. A thin wrapper that makes the “is this change safe?” check a single command.
Subagents (spawned for isolation and parallel work)
Dependency audit - spawned against the full solution, scans every *.csproj for package versions, compares against a target list or known-good baseline, and returns a structured table. Output is a summary, not a wall of XML.
Solution-wide dead code search - uses the Roslyn MCP to walk the solution and report public APIs with zero callers. A subagent is correct here because the search is exhaustive and you do not need to watch every step; you need the list.
Cross-project contract-test gap report - checks which public services lack a contract test. Returns a prioritized list. Runs once, produces an action list you import back to the main session.
Independent code reviewer - spawned after you finish a feature, with only the diff and the test suite as context. No session memory of how you got there. Returns findings in a structured format.
This set builds on the CLAUDE.md and MCP baseline described in the dotnet-claude-starter repo. The repo ships example commands in .claude/commands/ that you can copy and adapt; the skills are deliberately thin - they call out to the dotnet CLI and the Roslyn MCP rather than embedding logic in the prompt.
FAQ
What is the difference between a Claude Code skill and a subagent? A skill is a reusable in-thread procedure you invoke from a slash command - it runs in your current session and you watch and steer it. A subagent is a separate agent instance with its own context window, used for work that benefits from isolation or can run in parallel without consuming your working context.
When should I use a subagent for a .NET task? Use a subagent when the task is exploratory, can run in parallel, or would contaminate your main session context - dependency audits across the whole solution, cross-project dead-code searches, or an independent code review are all good subagent candidates.
Can I run multiple subagents in parallel on a large C# solution? Yes. Claude Code can fan out multiple subagents simultaneously - one per project for example - and collect their summaries back into the main context. This is the right pattern for solution-wide analysis that would otherwise blow the context window.
How many slash commands can I register in Claude Code?
There is no hard cap. Commands are defined as Markdown files in .claude/commands/, one file per command. Keep the set small and purposeful - a command that does one clear thing is more reliable than a general-purpose one.
Does the dotnet-claude-starter repo include example skills?
Yes. The repo at github.com/Khavel/dotnet-claude-starter includes example commands in .claude/commands/ covering common .NET tasks. The README explains how to extend them.
The operating layer for a .NET SaaS
The skills and subagents here are the third layer; CLAUDE.md is the first and MCP is the second. Sharpyard is the production .NET 10 and Angular SaaS starter with all three layers wired throughout. Join the waitlist for the founding price.
Related: Claude Code for .NET developers - MCP for .NET - How to use Claude Code on a large C# solution
The full AI-native .NET SaaS starter kit.
Join the waitlist