Skip to main content

add-full-slice

Build a capability end-to-end — backend vertical slice (Contracts→handler→validator→endpoint) AND the React page wired to it. Use when delivering a user-facing feature across API + UI. Composes add-feature + add-react-page.

소스 정보

저장소
fullstackhero/dotnet-starter-kit
최근 소스 활동
2026년 7월 13일 13:28
감지된 SKILL.md 언어
영어
스타
6,813
포크
2,003

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
add-full-slice
description
Build a capability end-to-end — backend vertical slice (Contracts→handler→validator→endpoint) AND the React page wired to it. Use when delivering a user-facing feature across API + UI. Composes add-feature + add-react-page.
argument-hint
[ModuleName] [admin|dashboard] [FeatureName]
# Add Full Slice (backend → frontend) The kit's accelerator: deliver a feature from database to UI in one pass. This skill **composes** `add-feature` (backend) and `add-react-page` (frontend) — follow each for the detailed code; this file is the order of operations and the **contract** that keeps the two halves in sync. ## Order of operations 1. **Backend slice** — `add-feature` (and `add-entity` first if a new entity is needed): - Command/Query + response DTO in `Modules.{X}.Contracts/v1/{Area}/` (+ `Contracts/Dtos/`). - Handler (`public sealed`, injects `{X}DbContext`), Validator, Endpoint (`internal static Map…Endpoint`, `.RequirePermission(...)`). - Wire in `{X}Module.MapEndpoints`. Build + test backend green. 2. **Lock the contract** — note the final **route path**, HTTP method, request shape, and response DTO field names/casing. The React side must match these exactly. 3. **Frontend page** — `add-react-page` in the chosen app: - API module calls the **same path**; hand-write TS types mirroring the **response DTO** (the API serializes C# records as camelCase JSON — TS fields are camelCase even though admin *query params* are PascalCase). - Page (`useQuery`/`useMutation`), route (`RouteGuard` for admin / `withSuspense` for dashboard). 4. **Permission** — if the endpoint is gated, mirror the constant into admin's `lib/permissions.ts` and gate the route (`add-permission`). Dashboard relies on the server 403. 5. **Tests both sides** — backend handler/validator test (xUnit/Shouldly/NSubstitute) + frontend Playwright spec (route-mocked). ## The contract (the thing that breaks if you're sloppy) | Backend | Frontend must match | |---|---| | Endpoint route `api/v{n}/{module}/{resources}` | `apiFetch` path | | Request: the `Command`/`Query` record fields | request body / query-param keys (admin params PascalCase; **body JSON camelCase**) | | Response: the DTO record (camelCase JSON) | the hand-written TS `type` | | `.RequirePermission({X}Permissions...)` | (admin) `RouteGuard perms` + the mirrored constant | | Paginated → `PagedResponse<T>` | `PagedResponse<T>` (admin: `@/lib/api-types`; dashboard: inline) | ## Verify end-to-end ```bash dotnet build src/FSH.Starter.slnx && dotnet test src/Tests/{X}.Tests cd clients/{app} && npm run lint && npm run test:e2e # optional manual check: dotnet run --project src/Host/FSH.Starter.AppHost (brings up API + both apps) ``` ## Checklist - [ ] Backend slice complete + green (`add-feature`) - [ ] Contract locked: route, request shape, response DTO field names - [ ] Frontend api module path + TS types match the contract (body JSON camelCase) - [ ] Page + route added (`add-react-page`); admin permission mirrored + gated (`add-permission`) - [ ] Backend test + Playwright test added; both suites green
GitHub에서 보기