writing-csharp-code

Provides C# and ASP.NET Core coding standards for writing secure backend code.

Updated May 22, 2026
One-click install
npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill writing-csharp-code-viniciuscs84
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-csharp-code
Source: https://github.com/viniciuscs84/sdd-toolkit/tree/main/skills/writing-csharp-code
Command: npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill writing-csharp-code-viniciuscs84

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing consistent, secure ASP.NET Core backend code requires knowing project-specific conventions for authentication, async patterns, streaming, and error handling. This Skill supplies those standards so generated C# code matches the repository's established patterns instead of generic or outdated samples. ## Core Features & Use Cases - ASP.NET Core Patterns: Minimal API endpoint templates with typed request models, CancellationToken, authorization policies, and RFC 7807 error responses. - Authentication & Credentials: JWT Bearer setup with Microsoft Entra ID, plus environment-aware credential selection using ChainedTokenCredential in development and ManagedIdentityCredential in production. - Azure AI SDK Guidance: Patterns for the AgentFrameworkService including agent version resolution, streaming via ProjectResponsesClient, annotation types, and image validation limits. - Use Case: When adding a new authenticated API endpoint that streams responses from an Azure AI agent, follow the Skill's patterns for endpoint definition, credential setup, IAsyncEnumerable streaming, and disposal guards. ## Quick Start Ask the AI to write a new authenticated ASP.NET Core endpoint following the repository's C# coding standards.

Frequently Asked Questions about writing-csharp-code

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

FAQPage Schema
How do I write a Minimal API endpoint in ASP.NET Core with authentication?

Define the endpoint with typed request models, inject services and CancellationToken, wrap logic in try/catch returning RFC 7807 errors, and call RequireAuthorization with a named policy. Use WithName to label the endpoint for routing.

How to set up JWT Bearer authentication with Microsoft Entra ID in ASP.NET Core?

Use AddAuthentication with JwtBearerDefaults and AddMicrosoftIdentityWebApi, binding the AzureAd configuration section. Set ValidAudiences to include both the client ID and the api:// client ID URI format.

Should I use DefaultAzureCredential or ChainedTokenCredential in development?

Use ChainedTokenCredential with AzureCliCredential and AzureDeveloperCliCredential in development, and ManagedIdentityCredential in production. This avoids DefaultAzureCredential's fail-fast behavior and gives an explicit, predictable credential chain.

Why does my async C# code deadlock or block threads?

Blocking happens when calling .Result or .Wait() on async methods. Always use async/await end-to-end and pass a CancellationToken through the call chain so operations can be cancelled cleanly.

How do I inspect .NET SDK types when documentation is missing?

Build the project, then load the assembly in PowerShell with System.Reflection.Assembly.LoadFrom and enumerate types, properties, and methods. This is useful for beta SDKs like Azure.AI.Projects where docs lag behind releases.

What are the image upload limits for the AgentFrameworkService?

Requests accept a maximum of 5 images, each up to 5MB decoded size, in PNG, JPEG, GIF, or WebP formats. Violations return HTTP 400 with validation details.