Programowanie · Przegląd i audyt
typescript-best-practices
/typescript-best-practices
Stosuje dobre praktyki TypeScriptu przy czytaniu i edycji plików .ts oraz .tsx.
Dla kogo
- Autor
- KyaniteHQ ↗
- Repozytorium
- threadsift ↗
- Licencja
- AGPL-3.0
- Ostatnia zmiana repozytorium
- 13.11.2026
Ocena i bezpieczeństwo
87/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność21 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść26 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
- Pliki w paczce
- 4
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Przestarzałość
Brak sygnałów. Repozytorium zmienione 13.11.2026, bez odwołań do wycofanych modeli i API.
Licencja
AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.
Co robi i kiedy
Stosuje dobre praktyki TypeScriptu przy czytaniu i edycji plików .ts oraz .tsx.
Oryginalny opis (EN)
TypeScript best practices. Use when reading or editing any .ts or .tsx file.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 26 linii, 474 słów
Podgląd SKILL.md
---
name: typescript-best-practices
description: TypeScript best practices. Use when reading or editing any .ts or .tsx file.
paths: ["**/*.ts", "**/*.tsx"]
---
# TypeScript best practices
Apply the Type System Discipline and Boundary Discipline sections of the `ub-mode` skill first.
| Rule | Summary |
|------|---------|
| Discriminated unions | Model variants with a `kind` literal discriminant so impossible states can't be represented. No optional-field bags. |
| Branded types | Brand primitives with `& { readonly __brand: "X" }` so they can't be mixed up. Validate once at the boundary. A brand comes from a verifying type guard (`input is AgentId`), never from `as`. |
| Constructive modeling | Build the shape so the illegal value can't be constructed. `readonly [T, ...T[]]` for non-empty, `readonly (readonly [T, T])[]` for even length, `start` plus a `duration` the boundary schema keeps non-negative for a range. Not a runtime guard, not a wish for refinement types. |
| Simplest total type | Keep `readonly T[]` while every operation on it stays total. Strengthen to `NonEmpty<T>` only where the loose type forces `!`, a cast, or a "should never happen" throw. |
| `unknown` over `any` | External data is `unknown` until its schema parses it where it enters. No function takes an `unknown` parameter: lint allows one only as a type-guard subject or a `cause`. |
| Schemas before guards | Before hand-writing a property-by-property type guard, use the repository's runtime schema library and infer the type from the schema, such as `z.infer`. |
| No `as` casts | Every `as` is a runtime crash waiting. Here lint refuses every `as` except `as const` (`typescript/consistent-type-assertions` set to `never`), so narrow with a schema, a guard, or `satisfies`. |
| Narrowing hierarchy | Discriminant switch > `in` operator > `instanceof` > schema parse > user-defined type guard. Lint refuses `typeof` checks and `as`, so neither is on the list. |
| Readonly parameters | Lint wants every parameter deeply readonly (`typescript/prefer-readonly-parameter-types`): `readonly T[]`, `readonly` tuples, and `readonly` on each field of a type a function takes. |
| Type guards | Must verify the claim. A lying guard is worse than `as` because the bug hides behind a name that says it's safe. Name them `isX` or `hasX`. |
| Exhaustiveness | Inline `const exhaustive: never = x;` in default arms so the compiler errors when a new variant is added. |
| `satisfies` over `as` | Validates the value without widening literal types. |
| Boundary validation | Parse where data crosses in, into a named domain type. `Record<string, unknown>` (however spelled) stops at that parse. Trust types inside. |
| Schema-derived types | Reach for `Pick`/`Omit`/`Parameters`/`ReturnType`/`Awaited`/`typeof` before declaring a new interface. |
| Object args | Pass objects, not positional, so argument order is self-documenting. Skip on hot paths (per-frame render, tokenizers, parsers). |
| Real tests | `docs/testing.md` governs: no mocks, stubs, fakes or recordings, and UI is verified in a running build. |
Examples: `references/patterns.md`.
Pliki w paczce (4)
- LICENSE 1 KB
- SKILL.md 3 KB
- UPSTREAM.md 2 KB
- references/patterns.md 10 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · KyaniteHQ/threadsift | 87 | AGPL-3.0 |
| seaworld008/commonly-used-high-value-skills | 100 | MIT |
| HoangNguyen0403/agent-skills-standard | 100 | MIT |
| overextended/skills | 100 | GPL-3.0 |
| alleneubank/claude-code | 100 | Apache-2.0 |
| VdustR/vp-claude-code-marketplace | 100 | MIT |
| fcakyon/claude-codex-settings | 91 | Apache-2.0 |
| workerstack/clients | 91 | MIT |
| itsvedantkumar/vstack | 91 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 6290c496c3ab (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
- 87mroowa-typescript-best-practices
Stosuje dobre praktyki TypeScriptu przy czytaniu i edycji plików .ts oraz .tsx. - 100react-best-practices
Stosuje dobre praktyki przy czytaniu i pisaniu komponentów React w plikach .tsx i .jsx z importami React. - 100typescript
Dostarcza konwencje TypeScript, TSX, React i SWR przy pisaniu frontendu, z pierwszeństwem zasad projektu. - 100python-best-practices
Podaje dobre praktyki przy czytaniu i pisaniu plików Python, w tym pyproject.toml i requirements.txt. - 91typescript-forms
Stosuje w plikach TypeScript wzorce unii dyskryminowanych, typów brandowanych, unknown zamiast any oraz walidację przez schematy na granicach. - 100trove-typescript
Pilnuje dyscypliny systemu typów TypeScript: eliminuje nielegalne stany, waliduje dane na granicach i ogranicza as oraz any.