add-resource
/add-resource
Dodaje zasób lub endpoint REST do API Hono, wraz ze schematami zod, handlerami i testami kontraktowymi.
- 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 lub endpoint REST do API Hono, wraz ze schematami zod, handlerami i testami kontraktowymi.
Oryginalny opis (EN)
Add a REST resource or endpoint to this Hono API end to end, with its zod schemas, store, createRoute declarations, handlers and contract tests. Use when asked for a new resource, endpoint or route.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 17 linii, 252 słów
Podgląd SKILL.md
---
name: add-resource
description: Add a REST resource or endpoint to this Hono API end to end, with its zod schemas, store, createRoute declarations, handlers and contract tests. Use when asked for a new resource, endpoint or route.
---
# Add a resource
Follow the notes slice; `src/schemas/notes.ts`, `src/services/notes.ts`, `src/routes/notes.ts` and `tests/http-contract.test.ts` are the model. Read `docs/guidance/hono-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 in `src/schemas/`. Ask before guessing an ambiguous name or a breaking change.
1. **Schemas** in `src/schemas/<thing>.ts` with `z` from `@hono/zod-openapi`: the resource, its input as `z.strictObject`, its list query (`limit`, `cursor`) and page. Name each with `.openapi("<Name>")`.
2. **Store** in `src/services/<thing>.ts`: an interface the routes use and a `createMemory<Things>()` taking `now` and `newId`, with a unit test beside it.
3. **Errors** beyond the existing rows: a row in `errorTable` and an `AppError` subclass in `src/errors.ts`.
4. **Failing tests** in `tests/http-contract.test.ts`: success with status and parsed body (201 and `Location` for a create), each declared error status through `expectEnvelope`, an unknown body field or query key, a malformed path parameter, and the request record. Run them and watch them fail.
5. **Routes** in `src/routes/<thing>.ts`: one `createRoute()` per operation with `operationId`, request schemas and every response (errors through `errorResponse`), registered with `.openapi()` on `createRouter()`. Read input only with `c.req.valid(...)`; throw `NotFoundError` for a miss.
6. **Mount** it in `src/app.ts` with `app.route("/", <thing>Routes(store))`, adding the store to `AppDeps`.
7. `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 c259fd9bee52 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 96add-endpoint
Dodaje endpoint HTTP lub nowy zasób do API w Quarkus, z magazynem danych, obsługą błędów i testami. - 96add-endpoint
Dodaje endpoint HTTP lub nowy zasób do API w Spring Boot, z magazynem danych, obsługą błędów i testami. - 100generate-api
Tworzy pakiet API w Hono z @hono/zod-openapi, walidacją Zod i generowaniem specyfikacji OpenAPI oraz dodaje trasy i endpointy REST. - 95backend-endpoint
Tworzy endpoint REST lub GraphQL z walidacją, obsługą błędów i testami. - 93add-resource-command
Dodaje zasób API Metabase end-to-end: schemat Zod, metody klienta, komendy list i get oraz testy. - 100spree-resource
Dodaje do projektu Spree 6 nowy model, tabelę i endpoint API wraz z serializerami, testami i uprawnieniami.