编程

aspnet-core

试用

基于微软官方指南,获取构建、审查和重构 ASP.NET Core Web 应用的最佳实践。

它能做什么

通过一套结构化的参考文档导航 ASP.NET Core 开发,按应用模型和横切关注点组织。技能遵循从技术栈选择到程序管道配置的工作流程,然后深入你选定的 UI 框架或 API 模式。它倾向于使用 WebApplicationBuilder、内置依赖注入、选项配置和 ProblemDetails,而非旧模式或第三方替代方案。

什么时候用它

  • 启动新 ASP.NET Core 项目并选择合适的应用模型
  • 将旧版 Startup/WebHost 代码库迁移到现代模式
  • 构建或审查 Blazor Web Apps、Razor Pages、MVC 或 Web API
  • 将 ASP.NET Core 解决方案升级到更新的 .NET 版本

技能文档

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.

常见问题

这个技能支持哪些应用模型?
支持 Blazor Web Apps(含渲染模式)、Razor Pages、MVC、Minimal API 和基于控制器的 Web API。还涵盖 SignalR、gRPC、中间件和后台服务。
技能会推荐特定的 .NET 版本吗?
截至 2026 年 3 月,它倾向于使用 .NET 10 / ASP.NET Core 10 进行新的生产工作。除非明确请求预览功能,否则将 ASP.NET Core 11 视为预览版本。
如何处理遗留代码库?
它尊重现有模式,不会无缘无故地将 Razor Pages 改为 MVC 或将控制器改为 Minimal API。包含升级旧解决方案和从 Startup/WebHost 迁移到 WebApplicationBuilder 的指南。

相关技能

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

作者 Iván855 次安装69 星标

按用户明确指令,在得到大脑(Get笔记)中保存、搜索并管理笔记与知识库。

作者 iswalle767 次安装66 星标

figma-use

官方

在 Figma 文件中执行 JavaScript,通过 Plugin API 创建、编辑和管理设计元素。

作者 OpenAI28.0k 星标

从 API 文档、OpenAPI 规范、curl 示例、SDK、Web 应用或现有脚本生成可安装的命令行工具。

作者 OpenAI28.0k 星标

将抽象的计算哲学转化为可交互的 p5.js 算法艺术,支持可复现的随机种子与参数调节。

作者 Anthropic180.7k 星标

通过迭代测试和评估循环构建和优化 AI agent 技能。

作者 Anthropic180.7k 星标

OpenAI 的更多技能

浏览全部技能

从官方文档出发,基于已有示例代码生成 ChatGPT Apps 项目脚手架。

作者 OpenAI28.0k 星标

使用团队已发布的设计系统组件、变量和样式,创建或更新完整的 Figma 页面。

作者 OpenAI28.0k 星标

将代码中的设计变量和组件同步到 Figma,结构化分阶段构建,带人工审核节点。

作者 OpenAI28.0k 星标

figma-use

官方

在 Figma 文件中执行 JavaScript,通过 Plugin API 创建、编辑和管理设计元素。

作者 OpenAI28.0k 星标

hatch-pet

官方

从任意视觉参考生成 Codex 兼容的动画宠物图集,含 QA 打包输出。

作者 OpenAI28.0k 星标

imagegen

官方

在项目内直接生成或编辑位图图像 — 照片、插画、精灵图、模型图、透明背景抠图

作者 OpenAI28.0k 星标