Leanpub Header

Skip to main content

Claude Code for .NET Developers

Definitive Guide

Claude Code for .NET Developers
+11,671 words in the last 30 days

A production-tested guide for senior .NET developers, tech leads, and architects who want real AI productivity gains - not another tutorial that breaks down the moment you leave the demo.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

Most .NET Developers Are Using AI Wrong.

New: Revised Edition, October 2026. Every chapter checked against a complete, public .NET 10 codebase. 216 backend tests and 49 frontend tests pass.

You've tried GitHub Copilot. Maybe Cursor. Probably ChatGPT.
And you've seen the pattern:

  • Works great for autocomplete.
  • Falls apart when your codebase has 200 files, real business rules, and architectural constraints that matter.

That's because most AI coding tools are designed for demos.
Claude Code is built differently. And most .NET developers haven't figured out how to use it correctly yet.

The problem isn't the AI. It's the workflow.

Without the right setup, Claude Code gives you:

  • Code that doesn't compile because it doesn't understand your project structure
  • Suggestions that ignore your existing patterns
  • Refactors that break things three layers away
  • A false sense of speed that turns into a debugging marathon

And the tutorials that exist? They're either too shallow ("just ask Claude to write your controller") or written for JavaScript developers who've never touched Entity Framework.

Claude Code for .NET Developers is a production-tested manual.

Not a course. Not a YouTube tutorial. A manual, the kind you keep open while you work.

Written by Michel Banagouro, a CTO with 20+ years of production .NET, React, and Azure. It comes from shipping real software, not from conference demos.

No fluff. No toy examples. Just what works.

What's new in this edition
  • The code is real, and it's public. The companion project, TaskManager, is finished and on GitHub (github.com/aspnetpro/TaskManager). It has a .NET 10 backend, a React 19 frontend, CI/CD pipelines, Bicep infrastructure for Azure Container Apps, and k6 load tests.
  • The book and the code match. Chapters 2, 4–9, and 11–14 were rewritten to follow the real code: custom JWT auth with rotating refresh tokens, an Outbox between modules, workspace-scoped caching, single-flight token refresh on the frontend, a secretless OIDC pipeline, and observability with OpenTelemetry. When a prompt and the code disagree, the code wins.
  • Adversarial review, book vs. code. Every snippet in the book was diffed against the repository. The review caught and fixed a real Outbox bug where events could get lost during a deploy. It also fixed caching for multiple replicas, completed the Result pattern, and aligned the test names.
  • 23 custom commands, ready to copy. Every Claude Code command introduced in the book is in .claude/commands/ in the repo. Drop them into your own project.
  • Licensing landmines flagged. MediatR, FluentAssertions, and MassTransit moved to commercial licenses. The book says which versions are still free to use. The repo pins the last Apache 2.0 releases.

After reading this book, you'll:
  • Set up Claude Code to understand your .NET codebase: its structure, patterns, and existing conventions
  • Use it for Entity Framework Core migrations without hallucinations
  • Build full-stack features (C# API + React/TypeScript) with AI that makes the right calls
  • Write and review tests the way senior engineers do, not "generate tests and pray"
  • Integrate Claude Code into your CI/CD pipeline without breaking your build
  • Build custom MCP Servers to extend Claude Code for your specific workflow
  • Spend far less time on boilerplate without introducing new bugs

What's inside

The book covers the complete Claude Code workflow, from installation through advanced usage:

Foundations
How Claude Code works and why it's fundamentally different from chat-based AI tools

Prompt Engineering for .NET
The patterns that work in real codebases, not just isolated files

Requirements & Prototyping
Use Claude Code from the start of a feature, not just the end

Architecture & Design
Let AI help you think through decisions, not just generate code

Backend Development
APIs, Entity Framework Core, auth, and business logic that holds up in production

Frontend Development
React 19 + TypeScript, integrated with your .NET backend the way it works in the real world

Testing & Code Review
Real testing strategies, not test generation theater

CI/CD with Azure DevOps and GitHub Actions
Secretless pipelines and automation that ships

Infrastructure & Observability
Bicep, Azure Container Apps, OpenTelemetry. Production-grade setup, not tutorial-grade

MCP Servers
The advanced capability most developers don't know exists, and the one that makes Claude Code genuinely powerful

This book is for you if:
  • You're a senior .NET developer, tech lead, or software architect
  • You've tried AI coding tools and found them disappointing on real projects
  • You read O'Reilly and Manning, so you expect depth, not surface-level content
  • You want to actually ship faster, not just feel like you're moving faster
  • You want a full reference codebase you can clone, run, and compare against your own

This book is not for you if:
  • You're looking for a beginner's guide to C#
  • You want theory about how large language models work
  • You need basic programming concepts explained

Already own the book? The revised edition is a free update on Leanpub.

Share this book

Categories

Author

About the Author

Michel Banagouro

Michel Banagouro is the CTO and partner at Leanwork Group, a software company delivering enterprise .NET solutions. Has more than 20 years of experience with .NET, React, and Azure, leading outsourcing squads, large-scale e-commerce platforms, and SaaS products. Currently driving Leanwork's repositioning as an AI-first company, building teams proficient in Claude Code and producing technical content on AI applied to software development.

Contents

Table of Contents

Notices and Disclaimer

  1. AI-generated code disclaimer
  2. Trademarks and brand attribution
  3. Library licensing — verify before adopting in commercial software
  4. Revision note

What Claude Code Is and Why It Changes Everything

  1. What this chapter does for you
  2. 1.1 What Is Claude Code
  3. 1.2 Claude Code vs. Claude Chat vs. the API
  4. 1.3 Why Claude Code Changes Everything
  5. 1.4 Installation and Setup
  6. 1.5 Where to Use Claude Code
  7. 1.6 Essential Commands
  8. 1.7 The CLAUDE.md File: Your Project’s Memory
  9. 1.8 Hands-On Exercise: Your First Project with Claude Code
  10. 1.9 Chapter Summary

The Mental Model: Prompt Engineering for .NET Developers

  1. What this chapter does for you
  2. 2.1 Why Prompt Engineering Matters for .NET Developers
  3. 2.2 The Anatomy of a Good .NET Prompt
  4. 2.3 Bad Prompts vs. Production Prompts
  5. 2.4 Advanced Prompt Engineering Techniques
  6. 2.5 Context Management: What Separates Pros from Amateurs
  7. 2.6 Anti-Patterns: What NOT to Do
  8. 2.7 Prompt Templates for .NET Day-to-Day
  9. 2.8 Hands-On Exercise: Your First Feature with Production Prompts
  10. 2.9 Chapter Summary

Requirements Gathering with Claude Code

  1. What this chapter does for you
  2. 3.1 The PO and AI: a Powerful Partnership
  3. 3.2 From Vague Idea to Structured Requirements
  4. 3.3 Generating Professional User Stories
  5. 3.4 Technique: Finding Gaps in the Specification
  6. 3.5 Prioritizing the Backlog
  7. 3.6 Generating the PRD (Product Requirements Document)
  8. 3.7 Advanced Techniques for the PO
  9. 3.8 Hands-On Exercise: TaskManager Full Backlog
  10. 3.9 Chapter Summary

Rapid Prototyping and Validation

  1. What this chapter does for you
  2. 4.1 Why Prototype Before You Build
  3. 4.2 Prototyping Fidelity Levels with Claude Code
  4. 4.3 Level 1: Descriptive Wireframes
  5. 4.4 Level 2: Static HTML Prototypes
  6. 4.5 Level 3: Interactive React Prototypes
  7. 4.6 Navigation Flows
  8. 4.7 Spec Review: Claude Code as Your Relentless Critic
  9. 4.8 Stakeholder Validation
  10. 4.9 Custom Commands for the PO
  11. 4.10 Hands-On Exercise: TaskManager Prototypes
  12. 4.11 Chapter Summary

Defining Architecture with Claude Code

  1. What this chapter does for you
  2. 5.1 The Architect and AI: Better Decisions, Faster
  3. 5.2 Evaluating Architectural Styles
  4. 5.3 Architecture Decision Records (ADRs)
  5. 5.4 The Complete Technical Stack
  6. 5.5 C4 Diagrams with Claude Code
  7. 5.6 Modular Monolith Structure
  8. 5.7 Cross-Cutting Concerns
  9. 5.8 Architecture Validation
  10. 5.9 Hands-On Exercise: Full TaskManager Architecture
  11. 5.10 Chapter Summary

Project Structure and Code Patterns

  1. What this chapter does for you
  2. 6.1 The Definitive CLAUDE.md
  3. 6.2 The Project’s Core Patterns
  4. 6.3 Automated Scaffolding with Claude Code
  5. 6.4 Detailed Naming Conventions
  6. 6.5 Global Usings and Project Configuration
  7. 6.6 Module Registration in Program.cs
  8. 6.7 Test Patterns
  9. 6.8 Hands-On Exercise: Full TaskManager Setup
  10. 6.9 Chapter Summary

Feature-by-Feature Development

  1. What this chapter does for you
  2. 7.1 The Explore → Plan → Code → Commit Flow
  3. 7.2 Implementing US-001: Create Task
  4. 7.3 Implementing US-002: List and Filter Tasks
  5. 7.4 Implementing US-003 through US-005
  6. 7.5 Working with Multiple Files
  7. 7.6 Progressive Iteration and Refinement
  8. 7.7 Session Management During Development
  9. 7.8 Custom Commands for the Developer
  10. 7.9 Hands-On Exercise: Implement US-001 through US-008
  11. 7.10 Chapter Summary

Backend: APIs, Databases, and Integrations

  1. What this chapter does for you
  2. 8.1 Authentication and Authorization
  3. 8.2 From Local SQL Server to Azure SQL
  4. 8.3 Events Between Modules with the Outbox
  5. 8.4 HttpClientFactory and External Integrations
  6. 8.5 Rate Limiting and API Protections
  7. 8.6 Caching with Redis
  8. 8.7 OpenAPI and Scalar
  9. 8.8 Configuration and Secrets
  10. 8.9 Hands-On Exercise: Full TaskManager Backend
  11. 8.10 Chapter Summary

Frontend: Interfaces That Work

  1. What this chapter does for you
  2. 9.1 React Project Setup
  3. 9.2 TypeScript Types Mirroring the API
  4. 9.3 The HTTP Client and the Refresh Token
  5. 9.4 TanStack Query: Server State
  6. 9.5 Layout and Base Components
  7. 9.6 Frontend Authentication
  8. 9.7 Kanban Board with Drag and Drop
  9. 9.8 Forms and Validation
  10. 9.9 Error Handling and Loading States
  11. 9.10 Testing the Frontend
  12. 9.11 Hands-On Exercise: Full TaskManager Frontend
  13. 9.12 Chapter Summary

Refactoring and Code Review with AI

  1. What this chapter does for you
  2. 10.1 Code Review with Claude Code: The Systematic Approach
  3. 10.2 Applying Fixes Systematically
  4. 10.3 Guided Refactoring: .NET Code Smells
  5. 10.4 Legacy Code Migration
  6. 10.5 Frontend Review
  7. 10.6 When NOT to Use AI for Refactoring
  8. 10.7 Custom Commands for Review and Refactoring
  9. 10.8 Hands-On Exercise: TaskManager Review and Refactoring
  10. 10.9 Chapter Summary

Testing Strategy with Claude Code

  1. What this chapter does for you
  2. 11.1 The TaskManager Test Pyramid
  3. 11.2 Unit Tests with Claude Code
  4. 11.3 Integration Tests with WebApplicationFactory
  5. 11.4 Testcontainers: Real Database in Tests
  6. 11.5 AI-Assisted TDD
  7. 11.6 Finding Coverage Gaps
  8. 11.7 Mocks, Fixtures, and Test Data Builders
  9. 11.8 Hands-On Exercise: Complete Test Suite
  10. 11.9 Chapter Summary

Quality Beyond Testing

  1. What this chapter does for you
  2. 12.1 Static Analysis with .NET Analyzers
  3. 12.2 Technical API Documentation
  4. 12.3 OWASP Security Audit
  5. 12.4 Load Testing with k6
  6. 12.5 Code Coverage with Coverlet
  7. 12.6 The Definitive Pre-Release Checklist
  8. 12.7 Hands-On Exercise: Full Quality Pass on TaskManager
  9. 12.8 Chapter Summary

CI/CD with Claude Code and Azure DevOps

  1. What this chapter does for you
  2. 13.1 Production Dockerfiles
  3. 13.2 CI/CD Pipeline with Azure DevOps
  4. 13.3 Environments and Per-Environment Configuration
  5. 13.4 Azure Container Registry and Images
  6. 13.5 Deploy to Azure Container Apps
  7. 13.6 Migrations in CI/CD
  8. 13.7 Alternative Pipeline: GitHub Actions
  9. 13.8 Custom Commands for DevOps
  10. 13.9 Hands-On Exercise: Full TaskManager Pipeline
  11. 13.10 Chapter Summary

Infrastructure and Observability

  1. What this chapter does for you
  2. 14.1 The Three Pillars of Observability
  3. 14.2 Structured Logging with Serilog
  4. 14.3 OpenTelemetry: Metrics and Tracing
  5. 14.4 Application Insights and Dashboards
  6. 14.5 Automated Alerts
  7. 14.6 Complete Infrastructure with Bicep
  8. 14.7 Troubleshooting with Claude Code
  9. 14.8 Hands-On Exercise: Full Observability Pass
  10. 14.9 Chapter Summary

Orchestrating the Full Cycle

  1. What this chapter does for you
  2. 15.1 The end-to-end cycle: from idea to deploy
  3. 15.2 CLAUDE.md as institutional memory
  4. 15.3 Parallel team: everyone with their own Claude Code
  5. 15.4 Productivity metrics: before and after
  6. 15.5 The complete custom command catalog
  7. 15.6 Gradual adoption: how to roll it out
  8. 15.7 Hands-on: Full end-to-end sprint
  9. 15.8 Chapter Summary

Advanced Patterns and the Future

  1. What this chapter does for you
  2. 16.1 MCP Servers: extending Claude Code
  3. 16.2 Claude Code CLI automations
  4. 16.3 Custom .NET CLI tools
  5. 16.4 When NOT to use AI
  6. 16.5 The future of .NET development with AI
  7. 16.6 Final words
  8. 16.7 Chapter Summary

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub