add-resource
/add-resource
Dodaje zasób REST do API NestJS od początku do końca: moduł, kontroler, serwis, DTO i testy kontraktowe.
- Autor
- steamfield ↗
- Repozytorium
- stacks ↗
- Licencja
- Apache-2.0
- Ostatnia zmiana repozytorium
- 08.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 08.11.2026, bez odwołań do wycofanych modeli i API.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
Co robi i kiedy
Dodaje zasób REST do API NestJS od początku do końca: moduł, kontroler, serwis, DTO i testy kontraktowe.
Oryginalny opis (EN)
Add a REST resource to this NestJS API end to end, as a feature module with its controller, service, DTOs, unit spec and contract tests. Use when asked for a new resource, endpoint, route or feature module.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 18 linii, 304 słów
Podgląd SKILL.md
---
name: add-resource
description: Add a REST resource to this NestJS API end to end, as a feature module with its controller, service, DTOs, unit spec and contract tests. Use when asked for a new resource, endpoint, route or feature module.
---
# Add a resource
Follow the notes slice; `src/notes/` and `tests/e2e/http-contract.e2e-spec.ts` are the model. Read `docs/guidance/nestjs-api/api.md` first, and `docs/guidance/rest-api/rest-api.md` when it exists.
Before any code, write down: the plural noun, its fields and types, each endpoint as `METHOD /v1/<path>` with its success status, and every error status. Reuse a noun that already exists under `src/`. Ask before guessing an ambiguous name or a breaking change.
1. **Generate** the module, controller and service, in that order so the last two register in the new module: `bunx nest g module <things>`, `bunx nest g controller <things> --no-spec`, `bunx nest g service <things> --no-spec`. Check `src/app.module.ts` imports the module, then `bun run format`.
2. **DTOs** in `src/<things>/dto/<thing>.dto.ts`: the response class, the create input and the list query, with class-validator decorators and `@ApiProperty` on every field (`@Type(() => Number)` on query numbers).
3. **Errors** beyond the existing rows: a row in `errorTable` and an `AppError` subclass in `src/common/errors.ts`.
4. **Failing tests**: `src/<things>/<things>.service.spec.ts` through `Test.createTestingModule` (imports from `vitest`), and rows in a contract spec under `tests/e2e/`: success with status and body (201 and `Location` for a create), each declared error status through `expectEnvelope`, an unknown body field or query key, a malformed id, the request record, and the path in `/openapi.json`. Run them and watch them fail.
5. **Service**: the rules and storage, async methods, `NotFoundError` for a miss. No HTTP types.
6. **Controller**: `@Controller({ path: '<things>', version: '1' })`, one method per endpoint that calls the service, `ParseUUIDPipe` on ids, and an `@Api*Response` for each status. Import the service and DTOs as values.
7. Export the service from the module only if another module needs it.
8. `bun run check`, then `stacks verify`. Fetch `/openapi.json` from a running build and check the new paths.
Keep the slice thin: no endpoints, fields or filters the request didn't ask for.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · steamfield/stacks | 86 | Apache-2.0 |
| cyanheads/clinicaltrialsgov-mcp-server | 100 | Apache-2.0 |
| cyanheads/mcp-ts-core | 100 | Apache-2.0 |
| steamfield/stacks | 86 | Apache-2.0 |
| steamfield/stacks | 86 | Apache-2.0 |
Migawka bazy z 13.11.2026 · wersja paczki 184cb31a150b (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 1 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100nestjs-conventions
Stosuje trwałe konwencje NestJS przy pisaniu i przeglądzie kodu serwerowego: jeden @Module na funkcję, wstrzykiwanie przez konstruktor, warstwy, walidacja DTO i testy per warstwa. - 96add-route
Dodaje trasę HTTP lub nowy zasób do API w Axum, z magazynem danych, mapowaniem błędów i testami. - 96add-endpoint
Dodaje endpoint HTTP lub nowy zasób do API w Quarkus, z magazynem danych, obsługą błędów i testami. - 100add-feature
Dodaje wycinek funkcji do istniejącego modułu: endpoint, obsługę, walidację, zapis, migrację, mapowanie i testy. - 100create-module
Tworzy nowy moduł NestJS z repozytorium, serwisem, kontrolerem, schematem i definicją tabeli Drizzle, przy dodawaniu funkcji, endpointów API lub domen biznesowych. - 100nestjs-patterns
Wskazuje dobre praktyki NestJS: architekturę modułów, DTO, Guards, Interceptors i typowe wzorce przy budowie lub przeglądzie serwisów backendowych.