一键导入
api-dto-review
Review API DTO implementations for contract/domain separation, mapping patterns, and REST compliance
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review API DTO implementations for contract/domain separation, mapping patterns, and REST compliance
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Authorization Code Flow for web applications using MSAL.NET confidential client to sign in users and access APIs on their behalf
Handle MSAL distributed token cache collisions and stale entries in ASP.NET Core applications
On-Behalf-Of (OBO) Flow for web APIs to call downstream APIs while preserving user identity in MSAL.NET
{what this skill teaches agents}
This skill should be used when the user asks to "build a feature", "fix a bug", "implement something", "start a dev cycle", types "/dev", or describes a software task that requires design, implementation, testing, and shipping. Orchestrates the full software development lifecycle from interrogation through shipping, with self-learning that improves over time.
Frontend JavaScript patterns for event handling, form UX, and validation integration
| name | api-dto-review |
| description | Review API DTO implementations for contract/domain separation, mapping patterns, and REST compliance |
Purpose: Review API DTO implementations for contract/domain separation, mapping patterns, and REST compliance.
Api/Dtos/*Request.cs, Response DTOs in Api/Dtos/*Response.cs[Required], [Url], and other validation attributesId in EngagementRequest for PUT /engagements/{id})ToResponse(DomainModel) helperToModel(RequestDTO, routeParams...) helperToModel as arguments, not extracted from DTO[ProducesResponseType] attributes updated to DTO typesToResponse(savedEntity), not raw entityif (!ModelState.IsValid) return BadRequest(ModelState);ToModel(request, idFromRoute)List<ResponseDTO> with .Select(ToResponse).ToList()e.Talks?.Select(ToResponse).ToList())ItemTableName) excluded from Request DTOs// WRONG: TalkRequest includes EngagementId but route provides it
public class TalkRequest
{
[Required] public int EngagementId { get; set; } // ← Route provides this!
}
[HttpPost("{engagementId:int}/talks")]
public async Task<ActionResult> CreateTalkAsync(int engagementId, TalkRequest request)
Fix: Remove EngagementId from TalkRequest. Use route parameter in mapping:
var talk = ToModel(request, engagementId); // engagementId from route
// WRONG: Returns domain model directly
[ProducesResponseType(StatusCodes.Status200OK, Type=typeof(Engagement))]
public async Task<ActionResult<Engagement>> GetEngagementAsync(int id)
{
return await _manager.GetAsync(id);
}
Fix: Map to Response DTO:
[ProducesResponseType(StatusCodes.Status200OK, Type=typeof(EngagementResponse))]
public async Task<ActionResult<EngagementResponse>> GetEngagementAsync(int id)
{
var engagement = await _manager.GetAsync(id);
return ToResponse(engagement);
}
After DTO changes:
dotnet test --filter FullyQualifiedName~Api.Tests --no-build.squad/decisions/inbox/trinity-pr512-dtos.md — DTO mapping pattern (private static helpers).squad/decisions/inbox/neo-pr512-review-dto-route-params.md — Route parameters must not be in Request DTOs