react-typescript-engineering
/react-typescript-engineering
Ustala standardy pracy nad frontendem React 18, TypeScript i Vite: własność stanu, TanStack Query, Zustand, WebSocket i typy API.
- Autor
- arcange-dev ↗
- Repozytorium
- veritas-bot ↗
- Licencja
- Apache-2.0
- Ostatnia zmiana repozytorium
- 12.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 12.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
Ustala standardy pracy nad frontendem React 18, TypeScript i Vite: własność stanu, TanStack Query, Zustand, WebSocket i typy API.
Oryginalny opis (EN)
Implementation standards for the React 18 + TypeScript + Vite frontend - state ownership, data fetching with TanStack Query, Zustand boundaries, WebSocket stream handling, error boundaries, and typing the API layer. Use when writing components, hooks, stores, or API clients in apps/web.
Jak działa
- When to use
- State ownership (decide once, keep it)
- Typed API client
- Query conventions
- Streaming
- Component rules
- Checklist
Podgląd SKILL.md
---
name: react-typescript-engineering
description: Implementation standards for the React 18 + TypeScript + Vite frontend - state ownership, data fetching with TanStack Query, Zustand boundaries, WebSocket stream handling, error boundaries, and typing the API layer. Use when writing components, hooks, stores, or API clients in apps/web.
---
# React + TypeScript Engineering
## When to use
Any component, hook, store, route, or API client work in `apps/web`.
## State ownership (decide once, keep it)
| Kind | Tool | Example |
|---|---|---|
| Server data | TanStack Query | projects, credentials list, run history |
| Streamed run events | Query cache + `setQueryData` | agent step updates |
| Ephemeral UI | Zustand | panel sizes, active tab, command palette open |
| Form state | React Hook Form + Zod | provider credential form |
| URL state | React Router search params | selected file, selected run |
Never copy server data into Zustand. Never store a token in Zustand or localStorage;
the Supabase session owns it.
## Typed API client
```ts
// src/lib/api.ts
import { z } from "zod";
const BASE = import.meta.env.VITE_API_BASE_URL;
export class ApiError extends Error {
constructor(public status: number, public code: string, message: string,
public requestId?: string) { super(message); }
}
export async function apiFetch<T>(
path: string,
schema: z.ZodType<T>,
init: RequestInit & { json?: unknown } = {},
): Promise<T> {
const { json, headers, ...rest } = init;
const token = await getAccessToken(); // from supabase session
const res = await fetch(`${BASE}${path}`, {
...rest,
headers: {
"Content-Type": "application/json",
...(token ? { Authorization: `Bearer ${token}` } : {}),
...headers,
},
body: json !== undefined ? JSON.stringify(json) : rest.body,
});
if (!res.ok) {
const body = await res.json().catch(() => ({}));
throw new ApiError(res.status, body.code ?? "unknown",
body.detail ?? res.statusText, body.request_id);
}
return schema.parse(await res.json());
}
```
Every response is parsed by a Zod schema from `packages/contracts`. `z.parse` failure is a
bug in the contract, not something to swallow.
## Query conventions
```ts
export const useProjects = (orgId: string) =>
useQuery({
queryKey: ["projects", orgId],
queryFn: () => apiFetch(`/api/v1/orgs/${orgId}/projects/`, ProjectList),
staleTime: 30_000,
});
```
- Keys are arrays starting with the resource name, then scope ids, then filters.
- Mutations invalidate the narrowest key that changed.
- Optimistic updates only for toggle-like actions, always with rollback in `onError`.
## Streaming
Use one `RunStream` per open run, subscribing to `/ws/runs/<run_id>/`. Reduce events into
the query cache; do not keep an event array in component state beyond a bounded ring
buffer (last 500 entries). Always handle `onclose` with exponential backoff capped at 15s
and show a "reconnecting" chip.
## Component rules
- Presentational components take primitives, not query hooks. Container passes data.
- One exported component per file, named the same as the file.
- `useEffect` is for external synchronisation only. Derived values are computed inline.
- Error boundaries at route level; a crashed panel must not blank the studio: wrap each
studio region in its own boundary with a reset action.
- No `any`. For genuinely unknown shapes use `unknown` plus a narrowing guard.
## Checklist
- [ ] `npm run typecheck` clean, no `@ts-expect-error` added.
- [ ] Loading/empty/error states implemented.
- [ ] Query keys follow convention and invalidation is correct.
- [ ] No secret ever read from `import.meta.env`.
- [ ] Component test covers the empty and error branches.
Wersje
W bazie nie ma innych skilli o nazwie react-typescript-engineering.
Migawka bazy z 13.11.2026 · wersja paczki bf29f2ad87f0 (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
- 100trove-react
Podaje konwencje React 19 i wzorce wydajności: hooki, zarządzanie stanem, TanStack Query i Zustand. - 100tanstack-query-zustand
Wskazuje wzorce dla stanu serwera w TanStack Query i Axios oraz stanu interfejsu w Zustand w aplikacji React SPA. - 100react-ts-vite
Buduje, rozbudowuje i refaktoryzuje aplikacje React w TypeScript i Vite, od komponentów i hooków po TanStack Query i Tailwind CSS. - 90frontend-standards
Stosuje standardy panelu administracyjnego: React 19, TypeScript, HeroUI v3, Tailwind v4 i TanStack Query przy pisaniu, przeglądzie i testach. - 100frontend-repo-architecture
Dobiera strukturę repozytorium frontendu React, Vite i TypeScript: trzy modele organizacji, wzorce warstwy API, ręcznie pisane typy i podział stanu. - 96react-dev
Pomaga budować komponenty React z TypeScript: typuje hooki i zdarzenia, obsługuje React 18-19, Server Components, komponenty generyczne oraz routing w TanStack Router i React Router.