TypeScript Best Practices skill (pstack) for Claude Code: type-safe edits
A rule sheet from the pstack plugin that steers Claude toward type-safe TypeScript when it reads or edits .ts and .tsx files.
- Installs
- 9K
- on skills.sh
- Stars
- 15K
- on GitHub
- Files
- 1
- besides SKILL.md
- Updated
- Nov 2026
- last repo commit
typescript-best-practices is a table of 16 rules from the pstack plugin, such as branded types, discriminated unions, no as casts and satisfies over as. Its description says to use it when reading or editing any .ts or .tsx file, and the frontmatter sets disable-model-invocation: true. The pstack README lists it as a command for when you are reading or editing TypeScript.
It opens by telling Claude to apply the type-system-discipline principle skill first, so it works best with the whole plugin installed. It bundles one example file, references/patterns.md, and no scripts or API keys.
Good for
- TypeScript developers who want AI edits that avoid any, casts and loose types
- Reviewers who want a written rule list to point an agent at
- Claude Code and Cursor users who already run the pstack plugin
Install typescript-best-practices
Claude Code
- 1
Copy this prompt.
Install the typescript-best-practices skill in Claude Code. Run this command: /plugin marketplace add cursor/plugins /plugin install pstack@cursor-plugins Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Pick one route, not both. The plugin installs every pstack skill, and Claude Code names them with a prefix, so this one becomes /pstack:typescript-best-practices (the README says Claude Code prefixes plugin commands). The skills CLI route must name the two principle skills too, because SKILL.md tells Claude to apply type-system-discipline first and that skill points to boundary-discipline.
From the project README. Source.
What's in the skill
When it loads
TypeScript best practices. Use when reading or editing any .ts or .tsx file.
Key facts
- License
- MIT (pstack plugin.json)
- Installs on skills.sh
- 8,960 as of 2026-11-02
- Last change to this skill
- 2026-11-01
- skills.sh audits
- Gen Agent Trust Hub pass, Socket pass, Snyk pass
What it includes
Starts by applying the type-system-discipline principle skill.
SKILL.md opens with "Apply the **type-system-discipline** principle skill first." That principle skill is a separate skill in the same plugin.
Read ·
type-system-discipline firstModel variants with a kind field so impossible states cannot exist.
Discriminated unionsBrand ids and other primitives so they cannot be mixed up, and check once at the edge.
Branded typesBuild types so the illegal value cannot be made, such as a non-empty tuple.
Constructive modelingKeep plain arrays until a loose type forces a cast or a never-happens throw.
Simplest total typeTreat all external data as unknown instead of any.
unknown over anyUse the repo's schema library and infer the type before writing a manual guard.
Schemas before guardsCast only after validation, because each as can crash at runtime.
No as castsPrefer a discriminant switch, then in, then typeof, then a type guard, then as.
Narrowing hierarchyA guard must really verify its claim and be named isX or hasX.
Type guardsAdd a never check in default arms so a new variant fails the build.
ExhaustivenessUse satisfies to check a value without widening its literal types.
satisfies over asParse data into a named domain type where it enters, then trust the types.
Boundary validationReach for Pick, Omit, Parameters and ReturnType before declaring a new interface.
Schema-derived typesPass objects instead of positional arguments, except on hot paths.
Object argsUse real test tools and a running build, and mock only what you cannot run.
Real testsLog structured diagnostics with context, and keep console.log out of shipped code.
Structured telemetryHolds code examples for each rule.
The last line of SKILL.md points to this file for examples. It has sections such as Branded types, Discriminated unions and Constructive modeling.
Read ·
references/patterns.md
From the official docs
Permissions
Low risk
It steers how Claude edits your TypeScript, and the plugin route adds many other pstack skills and two agents. Install only the skill and its two principle skills if you want a smaller footprint.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It steers edits to your TypeScript files
The rules ask for things like no `as` casts, branded ids and a `never` check in switch defaults, so expect edits to follow them. Review the diff as you would any change. github.com
The plugin route adds a lot more than this skill
The Claude Code build of pstack has 58 skills, 2 agents (poteto-agent and comment-sicko) and a guide. Install the skills CLI route if you only want this skill and its two principle skills. github.com
pstack setup writes a rules file in your home folder
The README says /pstack:setup-pstack writes your model choices to ~/.claude/rules/pstack-models.md. You only run it if you want that setup. github.com
Technical details
| Scopes |
|
|---|
Questions
What does the typescript-best-practices skill do?
It gives Claude a table of 16 TypeScript rules to follow when it reads or edits .ts and .tsx files. Examples are branded types for ids, a kind field on unions, no as casts and a never check in switch defaults.
How do I install it in Claude Code?
Use the install box above. The plugin route installs all of pstack, and the skills CLI route installs this skill plus the two principle skills it leans on. Pick one route, not both.
Does it need the other pstack skills?
It points to two of them. SKILL.md says to apply the type-system-discipline principle skill first, and that skill points to boundary-discipline. The install box includes both.
How is it different from type-system-discipline?
The principle skill states the idea for any statically typed language. This skill puts it into TypeScript syntax: the pstack README says it "grounds the type-system-discipline principle in syntax", and the principle skill sends TypeScript users here.
Does it work in the Claude app, Codex or Cursor?
The pstack README documents Claude Code and Cursor installs. It documents no Claude app or Codex route for this skill. The skills CLI can write it to other agents, but the README does not say that works.
Is it safe to install?
The skill folder holds one rules file and one examples file, and it bundles no scripts. The plugin route adds the rest of pstack: 58 skills and 2 agents. Its /pstack:setup-pstack step writes your model choices to ~/.claude/rules/pstack-models.md, according to the README.
Information
updated Nov 2, 2026
- Repository
- cursor/plugins
- Folder
pstack/skills/typescript-best-practices
Sources
Docs, issue trackers and discussions this page is built from.
Show all 6Hide
- pstack README (Claude Code build) · github.com
- typescript-best-practices SKILL.md · github.com
- principle-type-system-discipline SKILL.md · github.com
- pstack plugin.json · github.com
- skills.sh listing · skills.sh
- references/patterns.md · github.com