typescript-best-practices
Skill0 starsChanged 58 days agoMITView on GitHub
Enforce strict TypeScript type-system and boundary discipline when reading or writing .ts and .tsx files. Use whenever authoring, reviewing, or refactoring TypeScript code.
99 other projects use a version of this.
Adopted by
Most recently taken up by
- BabylonSocial/babylontheir own version, first seen Nov 30, 2026
- MondayNotAGoodDay/skillstheir own version, first seen Nov 29, 2026
- MarkTripoli/skillstheir own version, first seen Nov 29, 2026
- karanmrn/karanagentskillstheir own version, first seen Nov 29, 2026
- The-Utopia-Studio/skillstheir own version, first seen Nov 29, 2026
- karanmrn/kstacktheir own version, first seen Nov 29, 2026
Used with
Projects with it also use setup-pstack, make-bot-ui and 4 more.
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.
bnemaSkillsetup-pstack
Configure which Pi models pstack uses per role. Detects available provider/model specs and writes pstack's user configuration. Use for /setup-pstack, "configure pstack models", or changing pstack model choices.
Also in 24 projects that use this
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 15 projects that use this
shiwenbin1617Skillketchup-video
Catch the user up like /ketchup, with a short subtitled video of slides for what happened and the waiting calls as text under it. Use for /ketchup-video.
Also in 10 projects that use this
shiwenbin1617Skillstatechart
Check a TLA+ model of a system that moves between states, such as a product flow, a protocol, or a service, and draw it as a Mermaid statechart. The report gives the shortest path to each state that breaks a rule. Use for /statechart, or to show a bug as a path through states.
Also in 11 projects that use this
mukcoSkillprinciples
General software engineering principles — DRY, SOLID, YAGNI, KISS, naming, code smells, and refactoring. Language-agnostic. Use alongside language-specific skills.
Also in 4 projects that use this
rohunvoraSkillreframe
This skill should be used when the user is stuck, obvious solutions aren't working, constraints feel impossible, or they keep circling back to bad options. Use when designs keep getting rejected or the user is solving symptoms instead of root causes.
Also in 3 projects that use this
Other versions99 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 99
- Yeachan-Heo/oh-my-claude-sisyphus★ 41ksame name
- Yeachan-Heo/oh-my-claudecode★ 41ksame name
- trpc/trpc★ 41ksame name
- elizaOS/eliza★ 20ksame name
- backnotprop/pstack★ 5.4ksame name
- jtaroreh/agystack★ 142same name
- uzairansaruzi/p3-stack★ 126same name
- BabylonSocial/babylon★ 120same name
- dsebban/skills★ 82same name
- TencentBlueKing/bk-lite★ 77same name
89 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 repository41 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- architectSkill
- arenaSkill
- ask-skillsSkill
- benchmark-checklistSkill
- blast-radiusSkill
- chief-of-staffSkill
- code-reviewSkill
- create-verification-skillSkill
- dashboard-uiSkill
- diagnosing-bugsSkill
- docsSkill
- domain-modelingSkill
- git-flowSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- i-have-adhdSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- maintain-verification-skillSkill
- no-commentsSkill
- prototypeSkill
- researchSkill
- retroSkill
- security-auditSkill
- setup-skillsSkill
- setup-ts-deep-modulesSkill
- software-factorySkill
- tddSkill
- teachSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- unslopSkill
- wayfinderSkill
- wizardSkill
- writing-atomic-notesSkill
- writing-flashcardsSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.
0
Common
Most of the 29 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use the type system to make invalid states unrepresentable at compile time rather than treating TypeScript as annotated JavaScript.
- Very specific: line 17
unknownoverany: treat unparsed external data as unknown and narrow before use. - Very specific: line 18
No unsafe
ascasts: avoid as Type assertions that silence the compiler. - Very specific: line 19
Narrowing hierarchy: prefer switch on a discriminant > in operator > typeof/instanceof > user-defined type guards.
- Very specific: line 20
Exhaustiveness checking: add const _exhaustive: never = value.
“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeScript Best Practices
Use the type system to make invalid states unrepresentable at compile time rather than treating TypeScript as annotated JavaScript.
Core Rules
- Discriminated unions over property bags: model distinct states with a literal discriminant (
kind: "loading" | "ready" | "error") instead of optional fields that allow contradictory combinations. - Branded types for domain IDs: brand primitives (
type UserId = string & { readonly __brand: "UserId" }) so mismatched identifiers fail at compile time. unknownoverany: treat unparsed external data asunknownand narrow before use; never disable checking withany.- No unsafe
ascasts: avoidas Typeassertions that silence the compiler; validate or narrow instead. - Narrowing hierarchy: prefer
switchon a discriminant >inoperator >typeof/instanceof> user-defined type guards. - Exhaustiveness checking: add
const _exhaustive: never = value;in default branches so new union variants break at compile time. satisfiesoveras: validate object literals against a type withsatisfiesto preserve literal inference.- Boundary validation: parse and validate untrusted inputs (HTTP, env, JSON, IPC) at system boundaries (e.g., Zod) so internal code trusts the resulting types.
- Constructive modeling: build types that encode invariants directly (e.g.,
[T, ...T[]]for non-empty arrays) instead of checking.length > 0everywhere.
Deterministic Enforcement
Pair prose rules with compiler and linter gates so agents cannot bypass them:
tsconfig.json: enablestrict,noUncheckedIndexedAccess, andexactOptionalPropertyTypes.oxlint: enabletypescript/no-explicit-anyandtypescript/no-unsafe-type-assertion(orconsistent-type-assertions).
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.

