
TypeScript best practices
Guides agents to write TypeScript with stronger types, safer boundaries and real tests
TypeScript best practices is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- None
- Platforms
- Claude Code
- GitHub stars
- 5.1K
- Last commit
- License
- MIT
- Listing updated
Similar skills
About TypeScript best practices
This skill applies a set of TypeScript conventions whenever the agent reads or edits .ts or .tsx files. It steers modeling toward discriminated unions, branded types and constructive shapes that make illegal states unrepresentable, and it asks for narrowing through discriminants, type guards and satisfies instead of unchecked casts. External data is treated as unknown until parsed at the boundary, and the agent is pointed toward deriving types from runtime schemas rather than writing hand-rolled guards.
The skill also covers code hygiene and testing habits. It asks the agent to prefer structured logger diagnostics over console.log in shipped code, to use real test primitives instead of mocks where possible, and to verify UI in a running build. A companion examples file is included in the skill folder for worked patterns. It refers to other principle skills for type-system and boundary discipline, and it includes platform mapping notes for several non-Claude agents.
When your agent uses it
TypeScript best practices. Use when reading or editing any .ts or .tsx file.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 2 files (12 KB) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the pstack plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claudeOr copy only this skill to ~/.claude/skills/typescript-best-practices:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/typescript-best-practices &&
cp -R "$tmp/plugins/pstack/skills/typescript-best-practices" ~/.claude/skills/typescript-best-practices &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/typescript-best-practices inside it instead.
Copy the skill folder to ~/.agents/skills/typescript-best-practices to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/typescript-best-practices &&
cp -R "$tmp/plugins/pstack/skills/typescript-best-practices" ~/.agents/skills/typescript-best-practices &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/typescript-best-practices inside it instead.
Copy the skill folder to ~/.cursor/skills/typescript-best-practices to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/typescript-best-practices &&
cp -R "$tmp/plugins/pstack/skills/typescript-best-practices" ~/.cursor/skills/typescript-best-practices &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/typescript-best-practices inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/typescript-best-practicesOr copy the folder to ~/.gemini/skills/typescript-best-practices yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/typescript-best-practices:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/typescript-best-practices &&
cp -R "$tmp/plugins/pstack/skills/typescript-best-practices" ~/.copilot/skills/typescript-best-practices &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/typescript-best-practices inside it instead.
Get the folder:
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.gitThen copy pstack-claude/plugins/pstack/skills/typescript-best-practices into your agent's skills folder as typescript-best-practices. Agents that support SKILL.md read one folder per skill.
What it does
- Discriminated union modeling
- Guides variant modeling with kind discriminants and avoids optional-field bags.
- Safe type narrowing
- Sets a narrowing order and rules for type guards, with no casts before validation.
- Boundary validation
- Parses external data as unknown into named domain types at entry points.
- Exhaustiveness checks
- Adds never-typed default arms so new variants trigger compiler errors.
- Schema-derived types
- Favors Pick, Omit, ReturnType and inference from runtime schemas over new interfaces.
- Testing and telemetry habits
- Prefers real test primitives and structured logging over mocks and console.log.
Good for
- Model a set of API response variants safely in TypeScript
- Replace unsafe as casts with validated parsing in a React component
- Add branded ID types so user and order IDs cannot be mixed up
- Refactor a function to use object arguments and a non-empty array type
- Review a .ts file for type-safety problems before merging
TypeScript best practices FAQ
When does TypeScript best practices trigger?
It is loaded when the agent reads or edits any .ts or .tsx file, based on its paths setting.
Does TypeScript best practices run any scripts?
No scripts are included. It consists of a SKILL.md instruction file and a reference examples file.
Which agents does TypeScript best practices support?
The skill includes platform mapping references for Codex, GitHub Copilot, Muse and Antigravity, and it is packaged as a Claude Code plugin skill.
How do I install TypeScript best practices in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/typescript-best-practices to use it in all your projects, or to .claude/skills/typescript-best-practices in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.
Does TypeScript best practices run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use TypeScript best practices?
Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.
What are the best alternatives to TypeScript best practices?
The closest alternatives to TypeScript best practices are Principle type system discipline, Readable code, JavaScript TypeScript jest, Coding standards and Principle model the domain.
Where this comes from
- Description: from the skill's own SKILL.md.
More from michael-denyer/pstack-claude

Makes the agent read pstack's poteto-mode skill first and follow its routing
- Open source
- 5.1K GitHub stars
- Developer tools

Has the agent restate your goals and the problem you're solving in its own words
- Open source
- 5.1K GitHub stars
- Productivity

Prototype 2-3 competing designs and compare them before committing to one
- Open source
- 5.1K GitHub stars
- Developer tools

Sketches types, signatures and module layout before the agent writes code
- Open source
- 5.1K GitHub stars
- Developer tools

Runs parallel candidate attempts at a task, then merges the best parts into one artifact
- Open source
- 5.1K GitHub stars
- Developer tools

Drafts a personal working-style skill from your past agent conversations
- Open source
- 5.1K GitHub stars
- Developer tools




