Programowanie · Budowanie i kod
typescript-best-practices
/typescript-best-practices
Podpowiada dobre praktyki TypeScript przy czytaniu i edycji plików .ts i .tsx.
Dla kogo
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 24.08.2026, bez odwołań do wycofanych modeli i API.
Licencja
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Podpowiada dobre praktyki TypeScript przy czytaniu i edycji plików .ts i .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 · 25 linii, 381 słów
Podgląd SKILL.md
---
name: typescript-best-practices
description: TypeScript best practices. Use when reading or editing any .ts or .tsx file.
---
# TypeScript best practices
Apply the **principle-type-system-discipline** skill first; this skill grounds it in TypeScript syntax.
| 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 creation. |
| 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`. `any` disables type checking everywhere it touches. |
| 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 **principle-boundary-discipline**. |
| 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 (4)
- LICENSE 1 KB
- SKILL.md 2 KB
- agents/openai.yaml 1 KB
- references/patterns.md 8 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · caezium/skills | 87 | MIT |
| 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 de277b24dc30 (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.