编程

aspnet-core

试用

按微软当前文档的写法,构建、审查和重构 ASP.NET Core Web 应用。

它能做什么

这是一个以参考文档驱动的技能:先确认目标框架、SDK 和现有应用模型,再按任务只加载需要的参考文件,而不是一次性全读。内容覆盖技术栈选型、Program.cs 与中间件、Blazor、Razor Pages、MVC、Minimal API 与控制器、EF Core 与服务、安全与 Identity、SignalR、gRPC、后台托管服务、测试、性能、部署以及版本升级。默认偏好内置的 DI、配置、日志、ProblemDetails、OpenAPI、健康检查、限流和输出缓存,再考虑引入第三方组件。

什么时候用它

  • 为新项目在 Blazor、Razor Pages、MVC 和 Minimal API 之间选型
  • 审查现有 Program.cs 中的 DI、中间件和配置问题
  • 给 Web 应用接入认证、授权或 Identity
  • 规划跨大版本的 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.

常见问题

会把所有参考文件都读一遍吗?
不会。工作流要求只加载与任务匹配的最小参考集合:新项目先看 stack-selection,再看 program-and-pipeline,然后只选一个主应用模型参考,横切主题按需追加。
默认按哪个 .NET 版本给建议?
除非仓库或你的要求锁定了旧版本,否则优先最新的稳定版。文档写明截至 2026 年 3 月,新生产项目推荐 .NET 10 / ASP.NET Core 10,ASP.NET Core 11 视为预览版,除非你明确要求预览特性。
会把我现有的 Razor Pages 改写成 MVC 吗?
不会。技能要求尊重现有应用模型,没有明确理由不把 Razor Pages 改成 MVC、也不把控制器改成 Minimal API。它偏好 WebApplicationBuilder 和 WebApplication,只有在代码库已在用或任务本身是迁移时才回到 Startup 和 WebHost。

相关技能

诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。

作者 Iván857 次安装69 星标

figma-use

官方

在 Figma 文件里执行 JavaScript,通过 Plugin API 创建、修改和读取节点。

作者 OpenAI28.8k 星标

把 API 文档、OpenAPI 规范或现成脚本做成一个装到 PATH 上、Codex 在任何仓库都能按命令名调用的 CLI。

作者 OpenAI28.8k 星标

把一句艺术需求变成一份生成艺术宣言,外加可运行的 p5.js 草图,带种子与参数控件。

作者 Anthropic197.6k 星标

起草、测试并迭代 agent skill,通过与基线对比的评测验证效果。

作者 Anthropic197.6k 星标

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.

作者 OpenAI28.8k 星标

OpenAI 的更多技能

浏览全部技能

按文档优先流程搭建 ChatGPT Apps SDK 项目,产出 MCP 服务端、widget 界面和工具规划。

作者 OpenAI28.8k 星标

用已发布的设计系统组件、变量和样式,在 Figma 中搭建或更新完整页面,而不是手画硬编码的方块。

作者 OpenAI28.8k 星标

把代码库里的设计系统按阶段搬进 Figma,每一步都先经你确认再继续。

作者 OpenAI28.8k 星标

figma-use

官方

在 Figma 文件里执行 JavaScript,通过 Plugin API 创建、修改和读取节点。

作者 OpenAI28.8k 星标

hatch-pet

官方

把概念、品牌线索或参考图做成可校验的 8x9 动画 Codex 宠物图集,并打包成 pet.json。

作者 OpenAI28.8k 星标

imagegen

官方

在 Codex 中生成或编辑位图,从主视觉、精灵图到透明背景抠图都能处理。

作者 OpenAI28.8k 星标