Typescript Best Practices

TypeScript best practices. Use when reading or editing any .ts or .tsx file.

100 stars 27 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add adriannoes/awesome-agentic-ai --skill typescript-best-practices
Manual install
git clone --depth 1 https://github.com/adriannoes/awesome-agentic-ai.git /tmp/awesome-agentic-ai
mkdir -p ~/.claude/skills
cp -r /tmp/awesome-agentic-ai/cursor-claude-codex/skills/pstack/typescript-best-practices ~/.claude/skills/typescript-best-practices

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# TypeScript best practices

Apply the **type-system-discipline** principle 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. |
| 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`. |
Read the full skill on GitHub

Details

Skill name
typescript-best-practices
Path
cursor-claude-codex/skills/pstack/typescript-best-practices/SKILL.md
License
MIT
Repo updated
2 November 2026

FAQ

What does the Typescript Best Practices skill do?

TypeScript best practices. Use when reading or editing any .ts or .tsx file.

How do I install the Typescript Best Practices skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add adriannoes/awesome-agentic-ai --skill typescript-best-practices. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Typescript Best Practices popular?

It lives in adriannoes/awesome-agentic-ai, which has 100 GitHub stars and 27 forks, and is included in 2 curated skill lists.

Related skills

Browserstack

100

adriannoes/awesome-agentic-ai

Run tests on BrowserStack. Use when user mentions "browserstack", "cross-browser", "cloud testing", "browser matrix", "test on safari", "test on firefox", or "browser compatibility".

Testing & QAIn 2 lists27

Coverage

100

adriannoes/awesome-agentic-ai

Analyze test coverage gaps. Use when user says "test coverage", "what's not tested", "coverage gaps", "missing tests", "coverage report", or "what needs testing".

Testing & QAIn 2 lists27

Fix

100

adriannoes/awesome-agentic-ai

Fix failing or flaky Playwright tests. Use when user says "fix test", "flaky test", "test failing", "debug test", "test broken", "test passes sometimes", or "intermittent failure".

Testing & QAIn 2 lists27

Verifying Build Provenance with Slsa Sigstore

100

adriannoes/awesome-agentic-ai

Verify signed artifacts and SLSA build provenance with Sigstore cosign and slsa-verifier, enforce keyless OIDC identity, and apply SLSA Build levels to harden the software supply chain.

Software DevelopmentIn 2 lists27

Technical Tutorials

88

jonathimer/devmarketing-skills

When the user wants to create step-by-step technical tutorials, quickstarts, or code walkthroughs. Trigger phrases include "tutorial," "quickstart," "getting started guide," "walkthrough," "step by step," "how to guide," "hands-on guide," or "code tutorial.

Software DevelopmentIn 1 list

X Devs

88

jonathimer/devmarketing-skills

When the user wants to build a developer following on Twitter/X, write technical threads, or understand what works for dev audiences on X. Trigger phrases include "Twitter," "X," "developer Twitter," "tech Twitter," "technical threads," "building dev following," or "Twitter for developers.

Software DevelopmentIn 1 list

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.