mattiaippoliti/tia-skills/typescript-best-practices

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

TypeScript design and safety rules. Use when reading or editing .ts or .tsx files, especially when modeling data, parsing boundaries, or resolving type errors.

Install

npx vskill@latest install mattiaippoliti/tia-skills/typescript-best-practices

SKILL.md

TypeScript best practices

Make invalid states hard to construct and validate untrusted data where it enters the program. Types should express the program's real guarantees, not hide uncertainty.

RulePractice
VariantsUse discriminated unions with a literal kind; do not use bags of optional fields.
Domain valuesBrand primitives when values of the same base type must not mix. Validate once at construction.
ConstructionExpress constraints in the type where practical, such as [T, ...T[]] for non-empty arrays.
External dataAccept unknown, parse it at the boundary, and use named domain types inside.
AssertionsAvoid any and as. Narrow with a discriminant, in, typeof, instanceof, or a truthful guard.
ExhaustivenessPut const exhaustive: never = value in the default branch of a discriminant switch.
InferencePrefer satisfies to as; prefer Pick, Omit, Parameters, ReturnType, Awaited, and typeof before a duplicate interface.
APIsPrefer object arguments when parameter order is not obvious. Keep positional arguments only on proven hot paths.
Tests and diagnosticsTest real behavior when possible and emit structured diagnostics rather than shipping console.log.

Strengthen a type only when the looser type forces a non-null assertion, cast, or impossible-state branch. A type that makes ordinary code needlessly awkward is not a better model.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mattiaippoliti/tia-skills/typescript-best-practices/badge)](https://verified-skill.com/skills/mattiaippoliti/tia-skills/typescript-best-practices)

Something wrong with this skill or its page? Tell us.