aspnet-minimal-api-openapi
它能做什么
这个工具可以帮你使用 ASP.NET 为网站或 Web 应用创建代码片段。它能确保收发的信息结构清晰,并让文档(类似说明手册)清楚、完整。
适用场景
- ✓当你需要为网站开发新功能时。
- ✓当你需要组织 Web 应用的多个部分时。
- ✓当你想让代码文档始终保持最新时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/aspnet-minimal-api-openapi/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“创建一个端点,用于注册新用户,接收姓名和邮箱,并返回新建用户的 ID。”
每周 5 个新技能,1 分钟读完。
工作原理
你描述代码需要接收的信息以及应返回的内容。工具会整理这些内容,并自动生成文档,相当于为其他开发者提供的一张地图。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
ASP.NET Minimal API with OpenAPI
Your goal is to help me create well-structured ASP.NET Minimal API endpoints with correct types and comprehensive OpenAPI/Swagger documentation.
API Organization
- Group related endpoints using
MapGroup()extension - Use endpoint filters for cross-cutting concerns
- Structure larger APIs with separate endpoint classes
- Consider using a feature-based folder structure for complex APIs
Request and Response Types
- Define explicit request and response DTOs/models
- Create clear model classes with proper validation attributes
- Use record types for immutable request/response objects
- Use meaningful property names that align with API design standards
- Apply
[Required]and other validation attributes to enforce constraints - Use the ProblemDetailsService and StatusCodePages to get standard error responses
Type Handling
- Use strongly-typed route parameters with explicit type binding
- Use
Results<T1, T2>to represent multiple response types - Return
TypedResultsinstead ofResultsfor strongly-typed responses - Leverage C# 10+ features like nullable annotations and init-only properties
OpenAPI Documentation
- Use the built-in OpenAPI document support added in .NET 9
- Define operation summary and description
- Add operationIds using the
WithNameextension method - Add descriptions to properties and parameters with
[Description()] - Set proper content types for requests and responses
- Use document transformers to add elements like servers, tags, and security schemes
- Use schema transformers to apply customizations to OpenAPI schemas
常见问题
什么是 'endpoints'?
'Endpoints' 就像应用的入口,用于收发特定的信息。
什么是 'OpenAPI/Swagger'?
这是一种标准方式,用于描述和记录 API(即上面提到的“入口”),让其他人能够理解如何使用它们。
什么是 'DTOs/models'?
这些是数据结构,定义了数据在被应用发送或接收时应如何组织。
详情
作者的原始描述
Create ASP.NET Minimal API endpoints with proper OpenAPI documentation
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7067
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。