编程

aspnet-core

试用

按官方 .NET 文档构建并审查 ASP.NET Core 应用。

它能做什么

按微软当前文档选择合适的 ASP.NET Core 应用模型,组装宿主与请求管道。技能按需加载引用:栈选型、Program.cs 与中间件、一个 UI/API 参考,以及数据、安全、SignalR/gRPC、测试与升级等横切主题。默认面向最新稳定版 ASP.NET Core,优先使用 WebApplicationBuilder、内置 DI、ProblemDetails、OpenAPI、健康检查与限流等框架能力,而非引入第三方替代方案。

什么时候用它

  • 新项目起步,在 Blazor、Razor Pages、MVC、Minimal API 之间做选型
  • 审查或重构 Program.cs、中间件与 DI 配置
  • 补充鉴权、EF Core、SignalR、测试等横切能力
  • 在不同 ASP.NET Core 主版本之间迁移或升级

技能文档

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:
    • references/ui-blazor.md
    • references/ui-razor-pages.md
    • references/ui-mvc.md
    • references/apis-minimal-and-controllers.md
  5. Add cross-cutting references only as needed:
    • references/data-state-and-services.md
    • references/security-and-identity.md
    • references/realtime-grpc-and-background-work.md
    • references/testing-performance-and-operations.md
  6. Open references/versioning-and-upgrades.md before introducing new platform APIs into an older solution or when migrating between major versions.
  7. 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.

常见问题

这个技能面向哪个 ASP.NET Core 版本?
默认采用最新稳定版 ASP.NET Core。截至 2026 年 3 月,新生产的项目优先选择 .NET 10 / ASP.NET Core 10;除非用户明确要求预览特性,否则将 ASP.NET Core 11 视为预览版。
它会改动我现有的应用模型吗?
不会。技能尊重现有应用模型,除非有充分理由,不会把 Razor Pages 改写成 MVC,也不会把控制器改写成 Minimal API。
对老项目如何处理?
在向老项目引入新平台 API 之前,会先打开版本与升级参考;若代码库仍使用 Startup 或 WebHost,则不会强行替换为 WebApplicationBuilder,除非任务本身就是迁移。

相关技能

figma-use

官方

通过智能体在 Figma 文件中安全、增量地执行 Plugin API JavaScript。

作者 OpenAI27.9k 星标

为 Codex 生成可在任意仓库直接调用的可组合命令行工具。

作者 OpenAI27.9k 星标

把一段简短提示变成 p5.js 生成艺术,附带可调参数和种子控件。

作者 Anthropic180.0k 星标

通过「起草—测试—评估」的循环,帮你创建、改进并量化考核各项 agent 技能。

作者 Anthropic180.0k 星标

Deploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.

作者 OpenAI27.9k 星标

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state manag

作者 Anthropic180.0k 星标

OpenAI 的更多技能

浏览全部技能

用文档优先的流程搭建 ChatGPT Apps SDK 项目,产出工具规划、MCP 服务端与 Widget 脚手架。

作者 OpenAI27.9k 星标

通过复用已发布的设计系统(组件、变量、样式)来构建或更新完整的 Figma 页面。

作者 OpenAI27.9k 星标

按正确顺序在 Figma 中搭建与代码对齐的完整设计系统,覆盖变量、组件与主题。

作者 OpenAI27.9k 星标

figma-use

官方

通过智能体在 Figma 文件中安全、增量地执行 Plugin API JavaScript。

作者 OpenAI27.9k 星标

hatch-pet

官方

从概念、品牌线索或参考图出发,生成符合 Codex 规范的动画宠物图集与打包产物。

作者 OpenAI27.9k 星标

从 OpenAI 开发者文档获取带引用和来源路径的权威、实时答案。

作者 OpenAI27.9k 星标