Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

typescript-best-practices

/typescript-best-practices

Pomaga pisać i przeglądać TypeScript, wybierając bezpieczne typy i wzorce walidacji.

Licencja
Apache-2.0
Ostatnia zmiana repozytorium
13.11.2026

Ocena i bezpieczeństwo

91/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 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
5
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

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Pomaga pisać i przeglądać TypeScript, wybierając bezpieczne typy i wzorce walidacji.

Oryginalny opis (EN)

This skill should be used when writing, reading, or reviewing TypeScript code and choosing type safety or validation patterns.

Jak działa

SKILL.md bez nagłówków drugiego poziomu · 26 linii, 411 słów

Podgląd SKILL.md
---
name: typescript-best-practices
description: This skill should be used when writing, reading, or reviewing TypeScript code and choosing type safety or validation patterns.
---

# TypeScript best practices

Apply [type system discipline](references/type-system-discipline.md) 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. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, not a wish for refinement types. |
| Simplest total type | Keep `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`. |
| 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. Cast only after validation. |
| Narrowing hierarchy | Discriminant switch > `in` operator > `typeof`/`instanceof` > user-defined type guard > `as`. |
| 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. See [boundary discipline](references/boundary-discipline.md). |
| 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 | Don't mock what you can run. Prefer the framework's real test primitives with leak/disposable checks, and verify UI in a running build. Mock only what you can't run locally. |
| Structured telemetry | Prefer structured logger diagnostics with enough context to debug from an id. No `console.log` in shipped code. |

Examples: `references/patterns.md`.
Pliki w paczce (5)
  • LICENSE 1 KB
  • SKILL.md 3 KB
  • references/boundary-discipline.md 2 KB
  • references/patterns.md 9 KB
  • references/type-system-discipline.md 2 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · fcakyon/claude-codex-settings91Apache-2.0
seaworld008/commonly-used-high-value-skills100MIT
HoangNguyen0403/agent-skills-standard100MIT
overextended/skills100GPL-3.0
alleneubank/claude-code100Apache-2.0
VdustR/vp-claude-code-marketplace100MIT
workerstack/clients91MIT
itsvedantkumar/vstack91MIT
bastidood/skills90MPL-2.0

Migawka bazy z 13.11.2026 · wersja paczki 2a7f86d428e4 (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

  • 100typescript-patterns
    Podpowiada wzorce systemu typów TypeScript, typy narzędziowe i zasady trybu strict przy pisaniu i przeglądzie kodu.
  • 100react-best-practices
    Pomaga pisać i przeglądać komponenty React, obejmując wzorce, hooki, zarządzanie stanem i wydajność.
  • 100typescript
    Egzekwuje nowoczesne praktyki TypeScript przy pisaniu i przeglądzie kodu oraz konfiguracji tsconfig.json.
  • 100typescript
    Dostarcza konwencje TypeScript, TSX, React i SWR przy pisaniu frontendu, z pierwszeństwem zasad projektu.
  • 87mroowa-typescript-best-practices
    Stosuje dobre praktyki TypeScriptu przy czytaniu i edycji plików .ts oraz .tsx.
  • 90typescript-coding-standards
    Opisuje standardy kodowania TypeScript: ścisły system typów, typy złożone, dekoratory, generyki i dobre praktyki dla bezpiecznego kodu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.