Vgoloshivskiy/BookingSystem / .claude/skills/add-booking-endpoint
add-booking-endpoint
VerifiedUse when adding a new API endpoint to BookingSystem.Api, to keep controller/service/DTO/test structure consistent with the rest of the codebase.
Adding a new endpoint to BookingSystem.Api
Follow this sequence so new endpoints match the codebase's conventions (see CLAUDE.md):
- DTOs first. Add request/response
recordtypes to the relevant file inDTOs/(e.g.BookingDtos.cs). Never expose an EF entity directly from a controller. - Service method. If the endpoint does anything beyond a simple CRUD read, add the
logic to the matching interface + implementation in
Services/(e.g.IBookingService/BookingService), not directly in the controller.- If the new logic reads then writes state that another request could also be
writing concurrently, do NOT use a plain read-then-write. Use an atomic
conditional
UPDATE ... WHERE(seeBookingService.CreateBookingAsync) or an EF Core concurrency token, and return a distinguishable "conflict" outcome rather than throwing.
- If the new logic reads then writes state that another request could also be
writing concurrently, do NOT use a plain read-then-write. Use an atomic
conditional
- Controller action. Thin method: model-bind the request DTO, call the service,
map the result to the response DTO / appropriate status code
(
Ok/Created/Conflict/NotFound— never a bare 500 for an expected outcome like "lost the race"). - Authorization. Add
[Authorize](already on the controller by default) and[Authorize(Roles = Roles.Admin)]on the action if it's an admin-only operation. - Test. Add an xUnit test in
BookingSystem.Testsfor the happy path and for the conflict/error path. If the endpoint touches shared mutable state (like a booking or slot), add or extend a concurrency test modeled onConcurrencyTests.cs: fire several requests withTask.WhenAlland assert exactly one wins. - Frontend (optional). If the endpoint needs a UI, add a small function to
frontend/app.jsfollowing the existingapi()helper pattern — no new frontend framework or build step.
Run dotnet build && dotnet test before considering the change done.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |