Loading...
Loading...
Claude Code workflow mastery for .NET developers. Covers parallel execution with git worktrees, plan mode strategy, verification loops, auto-formatting hooks, permission setup for dotnet CLI, prompting techniques, subagent patterns, and context discipline — token budget management, MCP-first navigation, lazy loading, and subagent isolation — all adapted for the .NET ecosystem. Load this skill when setting up Claude Code for a .NET project, optimizing workflows, running parallel sessions, when context is running low or sessions feel sluggish, when exploring a large codebase efficiently, or when the user mentions "productivity", "workflow", "parallel", "worktree", "plan mode", "permissions", "hooks", "10x", "setup Claude Code", "speed up development", "context", "tokens", "budget", "running out of context", "too many files", or "large codebase". Inspired by tips from Boris Cherny (creator of Claude Code) and the Anthropic team.
npx skill4agent add codewithmukesh/dotnet-claude-kit workflow-masterydotnet builddotnet testget_diagnosticsMEMORY.mdinstinct-system# Create worktrees for parallel work
git worktree add ../my-project-feature origin/main
git worktree add ../my-project-bugfix origin/main
git worktree add ../my-project-tests origin/main
# Start Claude in each (separate terminal tabs)
cd ../my-project-feature && claude
cd ../my-project-bugfix && claude
cd ../my-project-tests && claude| Worktree | Task | Claude Session |
|---|---|---|
| Build new endpoint + handler | Main development |
| Fix the failing CI test | Autonomous bug fix |
| Write integration tests for existing feature | Test generation |
| Query the Roslyn MCP, read logs, review architecture | Read-only research |
alias zf='cd ../my-project-feature'// .claude/settings.json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "dotnet format --include \"$CLAUDE_FILE_PATH\" --no-restore 2>/dev/null || true"
}
]
}
]
}
}|| truedotnet.claude/settings.json{
"permissions": {
"allow": [
"Bash(dotnet build *)",
"Bash(dotnet test *)",
"Bash(dotnet run *)",
"Bash(dotnet ef *)",
"Bash(dotnet format *)",
"Bash(dotnet restore *)",
"Bash(dotnet pack *)",
"Bash(dotnet tool *)"
]
}
}Step 1: Enter plan mode (Shift+Tab twice)
Step 2: Describe the task with full context
Step 3: Iterate on the plan — challenge assumptions, ask "what about edge cases?"
Step 4: Once the plan is solid, switch to normal mode
Step 5: Claude executes with auto-accept — often 1-shots the implementation"Review this plan as a staff .NET engineer. Challenge every assumption.
What could go wrong? What's missing? What would you do differently?"For the full 7-phase verification pipeline (build, diagnostics, anti-patterns, tests, security, format, diff review) with structured PASS/FAIL reporting, see the verify skill.
dotnet builddotnet testget_diagnosticsdotnet format --verify-no-changesinstinct-systemMEMORY.md"Grill me on these changes. Would this pass a staff .NET engineer's code review?
Check for: N+1 queries, missing CancellationToken, exposed domain entities,
missing validation, incorrect service lifetimes.""Prove this works. Run the tests, show me the output.
Then diff the API response between main and this branch.""Knowing everything you know now, scrap this and implement the elegant solution.
No hacks, no workarounds.""Generate the migration, then show me the raw SQL it produces.
I want to verify the migration before applying it."dotnet-architectcode-reviewerrefactor-cleanertest-engineersecurity-auditorbuild-error-resolveref-core-specialistapi-designerperformance-analystdevops-engineer"Run the code-reviewer agent on my changes before I create the PR."
"Have refactor-cleaner simplify the files I just modified."
"Send the failing CI log to build-error-resolver.".claude/agents/.claude/rules/agents.mdfind_symbolget_diagnosticsOrderServicefind_symbolget_public_apifind_referencesget_type_hierarchyOFFLOAD TO A SUBAGENT WHEN:
- Exploring unfamiliar code (> 3 files to read)
- Research requiring docs or multiple files
- Verbose output (test runs, diagnostics, comparisons)
- Any task where the journey is verbose but the answer is concise
STAY IN MAIN CONTEXT WHEN:
- Modifying a file you've already read
- Quick lookups (1-2 MCP queries)
- Work that builds on the ongoing conversation with the userPRIORITY 1 — Files you will modify: read fully (exact content needed for edits)
PRIORITY 2 — Contracts you must satisfy: read the interface, skip implementations
PRIORITY 3 — Reference patterns: get_public_api first, read only if insufficient
PRIORITY 4 — General context: subagent summarizes; never read in main context
NEVER READ: entire directories (get_project_graph), test files for context
(get_test_coverage_map), generated files/migrations, configs unless neededWARNING SIGNS: 10+ files read, 50+ exchanges, forgetting earlier details,
re-reading files you already saw
RECOVERY: summarize what you know in 5-10 lines → subagents for remaining
exploration → MCP-only lookups → suggest a fresh session if still degraded
LARGE CODEBASES (50+ projects): get_project_graph → narrow to 2-3 relevant
projects → find_symbol for key types → get_public_api for interfaces →
read ONLY files you'll modify → subagents for cross-cutting concernsmodern-csharpef-coretesting// BAD — dive straight into a multi-file refactor
"Refactor the Orders module to use DDD with aggregates and value objects"
*Claude modifies 15 files, misses half the invariants, tangles the migration*
// GOOD — plan first, execute after
"Enter plan mode. I want to refactor the Orders module to use DDD.
Let's plan which files change, what the aggregate boundary is,
how value objects map to EF Core, and what the migration strategy is."// BAD — sequential work in one session
1. Build feature (20 min)
2. Write tests (15 min)
3. Fix formatting (5 min)
4. Update docs (10 min)
Total: 50 minutes
// GOOD — parallel worktrees
Worktree 1: Build feature (20 min)
Worktree 2: Write tests (15 min, started simultaneously)
Worktree 3: Update docs (10 min, started simultaneously)
Total: ~20 minutes (wall clock)// BAD — accept mediocre code
Claude: "Here's the implementation" *generic, works but not great*
You: "Looks good, ship it"
// GOOD — push for quality
Claude: "Here's the implementation"
You: "Would a staff .NET engineer approve this?
What about the service lifetime? Is this N+1 safe?
Is there a more elegant way using C# 14 features?"// BAD — "the context window is huge, let's load everything"
Read all 30 files in the Orders module, all 15 test files,
docker-compose.yml, every migration
*80k tokens consumed before writing a single line of code*
// GOOD — minimum viable context
MCP: get_project_graph (solution shape) + find_symbol (locate targets)
Read: the 2-3 files you'll actually modify
Subagent: summarize anything else
*~3k tokens consumed, the rest free for actual work*| Scenario | Recommendation |
|---|---|
| Task touches 3+ files | Plan mode first |
| Task is a simple bug fix | Just fix it, verify with |
| Need to build + test + review | 3 parallel worktrees |
| CI keeps failing on format | Add PostToolUse format hook |
| Tired of permission prompts | Pre-allow |
| Claude made a mistake | "Update CLAUDE.md so you don't make that mistake again" |
| Code feels hacky | "Knowing everything you know now, implement the elegant solution" |
| Want to verify architecture | Spin up a second session as staff reviewer |
| Repetitive PR workflow | Route to kit agents (code-reviewer, refactor-cleaner) or create a project subagent |
| Learning a new codebase | Use "Explanatory" output style via |
| Need a type's API or location | |
| Need to modify a file | Read it fully — exact content required |
| Exploring unfamiliar code | Spawn a subagent — keep main context clean |
| 10+ files read in a session | Pause — switch to MCP + subagents |
| Context feels heavy or sluggish | Summarize what you know, subagents going forward |
| Large codebase (50+ projects) | MCP-first, subagent-heavy, read only files you modify |
| New topic mid-session | Load the relevant skill on demand, not in advance |