typescript-best-practices
Use when reading or editing TypeScript and you want the code to follow strong type-safety practices.
Skill by waynegibson
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/waynegibson-typescript-best-practices
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/typescript-best-practices
What's inside
- Skill name
typescript-best-practices- Description
- Use when reading or editing TypeScript and you want the code to follow strong type-safety practices.
- License
- MIT
- Instructions
- 29 lines in SKILL.md · view on GitHub
Files (5)
- SKILL.md
- openai.yaml · agents/
- boundary-discipline.md · references/
- patterns.md · references/
- type-system-discipline.md · references/
SKILL.md (first lines)
# TypeScript best practices
Use TypeScript's type system to encode domain invariants. Read
[type-system discipline](references/type-system-discipline.md) when modeling
domain states or reviewing unsafe types. When the code accepts external data or
mixes business logic with I/O, also read
[boundary discipline](references/boundary-discipline.md).
| 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 | Validate where data crosses in; trust domain types inside. Follow [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`.From waynegibson/poly-agent-harness, MIT.
More from waynegibson/poly-agent-harness
- 0.528score
ml-exam-assistant
waynegibson
Use when the user needs ML or AI exam questions answered, checked, or explained with option-by-option reasoning.
SkillBFreshness: BClaude Code +9 - 0.523score
unslop
waynegibson
Use when the user wants writing tightened, made more human, or stripped of AI-sounding patterns.
SkillBFreshness: BClaude Code +9 - 0.523score
writing-for-agents
waynegibson
Use when writing or revising agent-facing docs, skills, or repo instructions like AGENTS.md and CLAUDE.md.
SkillBFreshness: BClaude Code +9 - 0.504score
code-tour
waynegibson
Use when the user wants a repo walkthrough, onboarding tour, architecture tour, PR review, RCA, security review, contribution guide, or any structured code…
SkillBFreshness: BClaude Code +9 - 0.493score
grill-me
waynegibson
Use when the user wants a plan or decision stress-tested through targeted questions.
SkillBFreshness: BClaude Code +9 - 0.493score
grilling
waynegibson
Use when the user wants a plan, decision, or idea stress-tested through focused questioning.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 24, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from waynegibson
- 0.528score
ml-exam-assistant
waynegibson
Use when the user needs ML or AI exam questions answered, checked, or explained with option-by-option reasoning.
SkillBFreshness: BClaude Code +9 - 0.523score
unslop
waynegibson
Use when the user wants writing tightened, made more human, or stripped of AI-sounding patterns.
SkillBFreshness: BClaude Code +9 - 0.523score
writing-for-agents
waynegibson
Use when writing or revising agent-facing docs, skills, or repo instructions like AGENTS.md and CLAUDE.md.
SkillBFreshness: BClaude Code +9 - 0.504score
code-tour
waynegibson
Use when the user wants a repo walkthrough, onboarding tour, architecture tour, PR review, RCA, security review, contribution guide, or any structured code…
SkillBFreshness: BClaude Code +9 - 0.493score
grill-me
waynegibson
Use when the user wants a plan or decision stress-tested through targeted questions.
SkillBFreshness: BClaude Code +9 - 0.493score
grilling
waynegibson
Use when the user wants a plan, decision, or idea stress-tested through focused questioning.
SkillBFreshness: BClaude Code +9
Cite this page
typescript-best-practices skill. Agent Mart. https://agentmart.dev/skills/waynegibson-typescript-best-practices (last updated 2026-10-24)