dotnet-agent-gotchas

Identify and correct common AI agent errors in .NET code.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-agent-gotchas-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-agent-gotchas
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-agent-gotchas
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-agent-gotchas-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers avoid common pitfalls and anti-patterns when AI agents generate or modify .NET code, leading to more robust and maintainable applications.

Core Features & Use Cases

  • Identify Agent Errors: Surfaces frequent mistakes in async/await usage, NuGet package management, deprecated API calls, project structure, and more.
  • Provide Corrected Code: Shows the anti-pattern and the corrected, idiomatic .NET code.
  • Cross-Reference: Links to canonical skills for in-depth guidance on specific topics.
  • Use Case: An agent generates code that uses .Result on an async method. This skill flags it as a deadlock risk and shows the correct async/await pattern, linking to the dotnet-csharp-async-patterns skill.

Quick Start

Use the dotnet-agent-gotchas skill to identify and correct common mistakes when an AI agent generates C# code.

Frequently Asked Questions about dotnet-agent-gotchas

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix common .NET anti-patterns generated by AI agents?

Fix common .NET anti-patterns generated by AI agents by identifying frequent mistakes like async/await deadlocks, deprecated APIs, and incorrect NuGet package usage, then applying corrected idiomatic C# code examples to ensure robust applications.

Why does my AI generated C# code use .Result and cause deadlocks?

Your AI generated C# code causes deadlocks by using .Result on async methods, which is a common agent anti-pattern. Replace .Result with proper async/await patterns to avoid deadlock risks and improve code safety.

What are common C# async/await mistakes in AI generated code?

Common C# async/await mistakes in AI generated code include blocking on asynchronous operations using .Result or .Wait, which introduces deadlock risks. Correct these by using proper async/await patterns throughout the call stack.

How do I prevent incorrect NuGet package usage in generated .NET projects?

Prevent incorrect NuGet package usage in generated .NET projects by identifying agent errors related to deprecated APIs and package management, applying corrected code examples to ensure proper dependency handling and project structure.

Does this approach cover nullable reference types and source generators?

Yes, this approach covers nullable reference types and source generators, identifying and correcting frequent agent mistakes across these features by providing idiomatic code examples for proper implementation and trimming.

When do I need to check AI generated .NET code for dependency injection issues?

Check AI generated .NET code for dependency injection issues whenever an agent modifies project structure or adds services, identifying anti-patterns and providing corrected code examples for proper testing and dependency injection.