Neo dotnet minimal apis
Skill Benknightdark/neo-skills/skills/neo-dotnet-minimal-apis
Neo Skills 是專為現代 AI Agent 設計的全方位能力擴充套件。本專案透過標準化的通訊架構,為 AI 代理安裝可插拔的「技能模組 (Skills)」,使其不僅僅是一個聊天機器人,而是能轉化為具備「感知-推理-行動」能力的多領域專家。
npx -y skills add Benknightdark/neo-skills --skill neo-dotnet-minimal-apisAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use this skill when building, debugging, refactoring, or reviewing ASP.NET Core Minimal APIs, lightweight endpoints, route groups, endpoint filters, typed results, OpenAPI metadata, or high-performance .NET API services without controllers.
SKILL.md
4.3 KB, as published. Nobody here has run it
.NET Minimal APIs Expert Skill
Trigger On
- The user requests to create, debug, refactor, or review .NET Minimal APIs.
- The project's
Program.cscontainsWebApplication.CreateBuilder(args)and is not configured with a Controllers directory. - The target framework is .NET 6.0 (LTS) and above.
- There is a need to optimize API performance or simplify Web API architecture.
Workflow
- Perceive (Architecture Awareness):
- Check
.csprojto identifyTargetFramework. - Analyze
Program.csto distinguish whether it uses simple endpoints or adopts a Module-based or Vertical Slice organization. - Identify whether OpenAPI (Swagger) support has been configured.
- Check
- Reason (Planning Phase):
- Evaluate whether "Route Groups" need to be introduced to optimize organizational structure.
- Determine whether to use "Endpoint Filters" to handle cross-cutting concerns (such as parameter validation).
- Choose the most appropriate syntax based on the .NET version (e.g.,
TypedResultsin .NET 7+).
- Act (Execution Phase):
- Write clean, high-performance Minimal API code, prioritizing Lambdas or extension methods.
- Implement strong typing and DTOs (prioritize using
record). - Integrate dependency injection, avoiding the Service Locator pattern.
- Validate (Standard Validation):
- Validate whether the endpoints correctly return expected HTTP status codes.
- Check whether the generated OpenAPI documentation is complete.
- Ensure asynchronous operations correctly pass the
CancellationToken.
Feature Roadmap (.NET 6 - 10)
.NET 6 & 7 (Foundation)
- Minimal Hosting: Simplified startup process and top-level statements.
- Route Groups: Use
MapGroupto consolidate prefixes and authentication. - Endpoint Filters: Implement interception logic within Minimal APIs.
- Typed Results: Improved unit testing and Swagger support.
.NET 8 & 9 (Productivity)
- Antiforgery: Built-in anti-forgery token support.
- Form Binding: Support for
[FromForm]parameter binding. - HybridCache: High-performance multi-level caching support.
- OpenAPI Improvements: Better OpenAPI code generation.
.NET 10+ (Version-Specific Features)
- Native AOT Optimization: AOT-optimized compilation tailored for Minimal APIs.
- Enhanced Middleware Patterns: New middleware designed for lightweight architectures.
Coding Standards
- Clean Routing: Prioritize using extension methods to modularize routes.
- Strong Typing: Prioritize using
TypedResultsandResults<T1, T2>. - Async Safety: Always accept and pass down
CancellationToken. - DI Best Practices: Services should be defined directly in the Handler parameters.
Deliver
- Version-Optimized API Code: Provide the most appropriate modern API code based on the target .NET version.
- Modular Architecture: Provide structural suggestions for extracting
Program.csroutes into extension methods. - OpenAPI Configuration: Provide comprehensive Swagger/OpenAPI configuration suggestions.
Validate
- Ensure the provided code executes correctly in a .NET 6+ environment.
- Validate endpoint security (authentication, authorization, Antiforgery).
- Check if the code complies with high-performance best practices for Minimal APIs (e.g., avoiding closures, reducing allocations).