typescript-best-practices
Skill58 starsChanged 3 months agoMITView on GitHub
TypeScript best practices. Use when reading or editing any .ts or .tsx file.
38 other projects use a version of this, 17 of them edited.
Adopted by
Most recently taken up by
- PickleBoxer/pstackedited, first seen Oct 6, 2026
- uzairansaruzi/p3-stackedited, first seen Oct 5, 2026
- backnotprop/pstackedited, first seen Oct 4, 2026
- LuisUrrutia/skillstheir own version, first seen Oct 4, 2026
- creedants/pstack-t3edited, first seen Oct 3, 2026
- baekenough/oh-my-customcodetheir own version, first seen Oct 3, 2026
Used with
Projects with it also use make-bot-ui and setup-pstack.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
eryzerzSkillmake-bot-ui
Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.
Also in 8 projects that use this
shishivSkillsetup-pstack
Configure pstack delegation against the active Pi host. Use for /skill:setup-pstack, "configure pstack models", or checking delegation readiness.
Also in 14 projects that use this
Other versions38 projects use a version of this.
Word for word · 7
- shrimpwtf/oh-my-pstack★ 31100% same
- korallis/skills-collection★ 18100% same
- painhardcore/pstack★ 6100% same
- 0xrsydn/pstack-pi★ 3100% same
- shishiv/pi-pstack★ 1100% same
- ahmedgcompany-cyber/pstack-claude★ 0100% same
- eryzerz/prime-pstack★ 0100% same
Edited · 17
- backnotprop/pstack★ 99186% same
- uzairansaruzi/p3-stack★ 12987% same
- adjohn/pstack★ 486% same
- creedants/pstack-t3★ 389% same
- dhanji4U/skills★ 280% same
- EvanBatten/pstack-for-cc★ 285% same
- JoshueOsuna/pstack★ 286% same
- finografic/pstack★ 195% same
- nafiskabbo/skills★ 187% same
- PickleBoxer/pstack★ 186% same
7 more not listed
Wrote their own version · 14
- baekenough/oh-my-customcode★ 43same name
- DavidTeju/shared-skills★ 9same name
- ofershap/typescript-best-practices★ 9same name
- flpbalada/fb-skills★ 8same name
- TheOnlyFusionCube/potetos-for-everyone★ 6same name
- kelesmert/turnlens★ 4same name
- shiwenbin1617/pstack★ 3same name
- Spardutti/claude-skills★ 3same name
- amirrezaalasti/codescribe★ 2same name
- LuisUrrutia/skills★ 2same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- rules/AGENTS.mdAGENTS.md
- agystackSkill
- architectSkill
- arenaSkill
- automate-meSkill
- blast-radiusSkill
- broSkill
- create-verification-skillSkill
- deslopSkill
- figure-it-outSkill
- howSkill
- interrogateSkill
- loopSkill
- maintain-verification-skillSkill
- no-commentsSkill
- Poteto ModeSkill
- principle-attack-the-premiseSkill
- principle-boundary-disciplineSkill
- principle-build-the-leverSkill
- principle-encode-lessons-in-structureSkill
- principle-exhaust-the-design-spaceSkill
- principle-experience-firstSkill
- principle-fix-root-causesSkill
- principle-foundational-thinkingSkill
- principle-guard-the-context-windowSkill
- principle-laziness-protocolSkill
- principle-make-operations-idempotentSkill
- principle-migrate-callers-then-delete-legacy-apisSkill
- principle-minimize-reader-loadSkill
- principle-model-the-domainSkill
- principle-never-block-on-the-humanSkill
- principle-outcome-oriented-executionSkill
- principle-prove-it-worksSkill
- principle-redesign-from-first-principlesSkill
- principle-separate-before-serializing-shared-stateSkill
- principle-sequence-verifiable-unitsSkill
- principle-subtract-before-you-addSkill
- principle-test-behavior-not-implementationSkill
- principle-type-system-disciplineSkill
- recallSkill
- reflectSkill
- setup-agystackSkill
- show-me-your-workSkill
- swarmSkill
- tddSkill
- teachSkill
- technical-writingSkill
- unslopSkill
- whySkill
The file
Files
TypeScript best practices
Apply the type-system-discipline principle skill first; this skill grounds it in TypeScript syntax.
| 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 | Parse where data crosses in, into a named domain type. Record<string, unknown> (however spelled) stops at that parse. Trust types inside. See the boundary-discipline principle skill. |
| 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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

