add-page
/add-page
Dodaje stronę do aplikacji React SPA, która czyta dane z zewnętrznego API, wraz z trasą, zapytaniem i testami.
- 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 stronę do aplikacji React SPA, która czyta dane z zewnętrznego API, wraz z trasą, zapytaniem i testami.
Oryginalny opis (EN)
Add a page to this React SPA that reads from the external API, with its route, query, fake-API handler and tests. Use when asked for a new screen, route or view backed by an API endpoint.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 15 linii, 213 słów
Podgląd SKILL.md
---
name: add-page
description: Add a page to this React SPA that reads from the external API, with its route, query, fake-API handler and tests. Use when asked for a new screen, route or view backed by an API endpoint.
---
# Add a page
Follow the items slice; `src/api/items.ts`, `src/features/items/` and `src/app/routes.test.tsx` are the model.
1. **Schema and query.** In `src/api/<thing>.ts`, a zod schema for the response and a `queryOptions` factory taking the `ApiClient` (`queryKey` starting with the resource name, `queryFn` calling `api.get(path, Schema, { signal })`). Encode path parameters with `encodeURIComponent`.
2. **Fixture and handler.** Sample data in `tests/fixtures/<thing>.ts`; a default MSW handler for the endpoint in `tests/msw/server.ts`.
3. **Failing test.** In `src/app/routes.test.tsx` (or a new `*.test.tsx` beside the page), render the route with `renderRoute(path)` and assert what the user sees: the data, the empty state, an HTTP error with its request id, a wrong-shaped body. Run it and watch it fail.
4. **Page.** `src/features/<name>/<name>-page.tsx`: `const { api } = useServices()`, `useQuery(...)`, and a branch for pending, error (`<ErrorState error onRetry />`), empty and success. Headings and links carry accessible names the test queries by.
5. **Route.** Add it to the children in `src/app/routes.tsx`, and link to it with `<Link>`.
6. **Browser test**, only if the page depends on something happy-dom can't show (a deep link, the built bundle): extend `fakeApi` in `e2e/items.spec.ts` or add a spec beside it.
7. `bun run check`, then `stacks verify`.
Don't call `fetch`, read `import.meta.env` or use `console` in the page; `bun run lint` rejects each.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · steamfield/stacks | 86 | Apache-2.0 |
| TurbineKit/turbinekit | 100 | MIT |
| steamfield/stacks | 96 | Apache-2.0 |
| steamfield/stacks | 86 | Apache-2.0 |
| steamfield/stacks | 86 | Apache-2.0 |
Migawka bazy z 13.11.2026 · wersja paczki ac7730863629 (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
- 100add-react-page
Dodaje do aplikacji React stronę z listą i formularzem tworzenia: moduł API, stronę, leniwą trasę, bramkę uprawnień w panelu admina i test Playwright. - 95backend-endpoint
Tworzy endpoint REST lub GraphQL z walidacją, obsługą błędów i testami. - 100add-full-slice
Buduje funkcję od początku do końca: pionowy wycinek backendu (kontrakty, handler, walidator, endpoint) oraz podpiętą do niego stronę React, łącząc add-feature i add-react-page. - 90add-api-endpoint
Dodaje lub rozszerza endpoint HTTP lub API: nową trasę, handler albo metodę RPC z walidacją żądania i zdefiniowaną odpowiedzią. - 96add-route
Dodaje trasę HTTP lub nowy zasób do API w Axum, z magazynem danych, mapowaniem błędów i testami. - 100add-endpoint
Dodaje nowy endpoint HTTP do usługi dostępu, z modelami, zmianami w przechowywaniu i testami dla każdego kodu statusu.