coreex-api

Scaffolds CoreEx MVC controllers and Minimal API endpoints for CRUD and custom actions.

28|8|Updated Feb 21, 2022
One-click install
npx skills add https://github.com/Avanade/CoreEx --skill coreex-api-avanade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coreex-api
Source: https://github.com/Avanade/CoreEx/tree/main/.github/skills/coreex-api
Command: npx skills add https://github.com/Avanade/CoreEx --skill coreex-api-avanade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Adding HTTP endpoints to a CoreEx-based .NET service involves many conventions — CQRS controller splits, WebApi helper variants, idempotency keys, route parameter validation — that are easy to get wrong. This Skill guides an AI agent through scaffolding controllers and Minimal API endpoints that follow CoreEx conventions correctly the first time. ## Core Features & Use Cases - CQRS Controller Pair Scaffolding: Creates {Name}Controller (mutations) and {Name}ReadController (reads) sharing one route and OpenApiTag. - Full Verb Coverage: Implements GET by id, query with $query schema, POST create with Location header and [IdempotencyKey], PUT + PATCH full-entity updates, DELETE, and custom business-action endpoints. - Dual Service Styles: Supports both exception-based services (standard WebApi helpers) and Result<T> pipeline services (WithResult helper variants), plus Minimal API as an alternative to MVC. - Use Case: You need to expose a new Order entity over HTTP. The Skill scaffolds OrderController and OrderReadController with GET/query/POST/PUT/PATCH/DELETE endpoints, then hands off to the integration-test skill. ## Quick Start Ask the AI to add a CoreEx API controller for the Order entity with get, query, create, update, and delete operations using a Result<T> service style.

Frequently Asked Questions about coreex-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a CRUD API controller in CoreEx?▼

Create a controller pair: {Name}Controller for mutations (POST/PUT/PATCH/DELETE) and {Name}ReadController for reads (GET/query), both inheriting ControllerBase and sharing the same route and OpenApiTag. All actions return Task<IActionResult> via the WebApi helper and delegate immediately to the application service.

How do I choose between MVC controllers and Minimal API in CoreEx?▼

MVC controllers are the default for most projects; Minimal API suits lighter hosts. Minimal API maps endpoints directly with RouteHandlerBuilder extensions like .WithQuery(), .WithPaging(), and .WithIdempotencyKey() that mirror the MVC attributes, and uses AddHttpWebApi() instead of AddMvcWebApi() in Program.cs.

What is the difference between standard and WithResult WebApi helpers?▼

Standard helpers (GetAsync, PostAsync, PutAsync) are used with exception-based application services, while WithResult variants (GetWithResultAsync, PostWithResultAsync) are used when the service returns Result<T>. Never mix the two styles within the same controller; the choice follows the service interface.

Why does my CoreEx route parameter return 500 instead of 400?▼

Using .ThrowIfNull() on a route parameter throws ArgumentNullException, which maps to a 500 error. Use .Required() instead, which throws a ValidationException that CoreEx translates into a 400 Bad Request response.

When should I not use this API controller skill?▼

Do not use it for Api host setup or Program.cs composition (use coreex-solution-scaffolder), for creating application services (use coreex-app-service), or for writing API integration tests (use coreex-test-api). It also does not apply to subscriber or relay hosts, where controllers do not belong.