Skip to content

Codex ASP.NET Core

Verified

ASP.NET Core development best practices and patterns for Codex

By OpenAI 5,000 stars v1.0 Updated 2026-03-15
$ Add to AGENTS.md

About This Skill

# ASP.NET Core

Overview

Choose the right ASP.NET Core application model, compose the host and request pipeline correctly, and implement features in the framework style Microsoft documents today.

Load the smallest set of references that fits the task. Do not load every reference by default.

Workflow

  1. Confirm the target framework, SDK, and current app model.
  2. Open references/stack-selection.md first for new apps or major refactors.
  3. Open references/program-and-pipeline.md next for `Program.cs`, DI, configuration, middleware, routing, logging, and static assets.
  4. Open exactly one primary app-model reference:
  5. - references/ui-blazor.md
  6. - references/ui-razor-pages.md
  7. - references/ui-mvc.md
  8. - references/apis-minimal-and-controllers.md
  9. Add cross-cutting references only as needed:
  10. - references/data-state-and-services.md
  11. - references/security-and-identity.md
  12. - references/realtime-grpc-and-background-work.md
  13. - references/testing-performance-and-operations.md
  14. Open references/versioning-and-upgrades.md before introducing new platform APIs into an older solution or when migrating between major versions.
  15. Use references/source-map.md when you need the Microsoft Learn section that corresponds to a task not already covered by the focused references.

Default Operating Assumptions

  • Prefer the latest stable ASP.NET Core and .NET unless the repository or user request pins an older target.
  • As of March 2026, prefer .NET 10 / ASP.NET Core 10 for new production work. Treat ASP.NET Core 11 as preview unless the user explicitly asks for preview features.
  • Prefer `WebApplicationBuilder` and `WebApplication`. Avoid older `Startup` and `WebHost` patterns unless the codebase already uses them or the task is migration.
  • Prefer built-in DI, options/configuration, logging, ProblemDetails, OpenAPI, health checks, rate limiting, output caching, and Identity before adding third-party infrastructure.
  • Keep feature slices cohesive so the page, component, endpoint, controller, validation, service, data access, and tests are easy to trace.
  • Respect the existing app model. Do not rewrite Razor Pages to MVC or controllers to Minimal APIs without a clear reason.

Reference Guide

  • references/_sections.md: Quick index and reading order.
  • references/stack-selection.md: Choose the right ASP.NET Core application model and template.
  • references/program-and-pipeline.md: Structure `Program.cs`, services, middleware, routing, configuration, logging, and static assets.
  • references/ui-blazor.md: Build Blazor Web Apps, choose render modes, and use components, forms, and JS interop correctly.
  • references/ui-razor-pages.md: Build page-focused server-rendered apps with handlers, model binding, and conventions.
  • references/ui-mvc.md: Build controller/view applications with clear separation of concerns.
  • references/apis-minimal-and-controllers.md: Build HTTP APIs with Minimal APIs or controllers, including validation and response patterns.
  • references/data-state-and-services.md: Use EF Core, `DbContext`, options, `IHttpClientFactory`, session, temp data, and app state responsibly.
  • references/security-and-identity.md: Apply authentication, authorization, Identity, secrets, data protection, CORS, CSRF, and HTTPS guidance.
  • references/realtime-grpc-and-background-work.md: Use SignalR, gRPC, and hosted services.
  • references/testing-performance-and-operations.md: Add integration tests, browser tests, caching, compression, health checks, rate limits, and deployment concerns.
  • references/versioning-and-upgrades.md: Handle target frameworks, breaking changes, obsolete APIs, and migrations.
  • references/source-map.md: Map the official ASP.NET Core documentation tree to the references in this skill.

Execution Notes

  • When generating new code, start from the correct `dotnet new` template and keep the generated structure recognizable.
  • When editing an existing solution, follow the solution's conventions first and use these references to avoid framework misuse or outdated patterns.
  • When a task mentions "latest", verify the feature on Microsoft Learn or the ASP.NET Core docs repo before relying on memory.

Use Cases

  • Integrate OpenAI APIs into ASP.NET Core web applications
  • Build AI-powered features in C#/.NET backend services using OpenAI models
  • Implement chat completions, embeddings, and function calling in ASP.NET
  • Configure OpenAI SDK with proper dependency injection and configuration patterns
  • Handle streaming responses and error handling for OpenAI API calls in .NET

Pros & Cons

Pros

  • +Tailored for the .NET ecosystem with proper C# patterns and conventions
  • +Covers production concerns like error handling, retries, and configuration management
  • +Bridges the gap between AI capabilities and enterprise .NET applications

Cons

  • -Limited to ASP.NET Core — not applicable to other backend frameworks
  • -Requires familiarity with both C# and OpenAI API concepts

FAQ

What does Codex ASP.NET Core do?
ASP.NET Core development best practices and patterns for Codex
What platforms support Codex ASP.NET Core?
Codex ASP.NET Core is available on OpenAI Codex CLI.
What are the use cases for Codex ASP.NET Core?
Integrate OpenAI APIs into ASP.NET Core web applications. Build AI-powered features in C#/.NET backend services using OpenAI models. Implement chat completions, embeddings, and function calling in ASP.NET.

100+ free AI tools

Writing, PDF, image, and developer tools — all in your browser.

Next Step

Use the skill detail page to evaluate fit and install steps. For a direct browser workflow, move into a focused tool route instead of staying in broader support surfaces.