typescript-best-practices
Skill2 starsChanged 57 days agoMITView on GitHub
Use when implementing or reviewing TypeScript code, including type contracts and compiler or module configuration.
38 other projects use a version of this.
Adopted by
Most recently taken up by
- PickleBoxer/pstacktheir own version, first seen Oct 6, 2026
- uzairansaruzi/p3-stacktheir own version, first seen Oct 5, 2026
- backnotprop/pstacktheir own version, first seen Oct 4, 2026
- creedants/pstack-t3their own version, first seen Oct 3, 2026
- baekenough/oh-my-customcodetheir own version, first seen Oct 3, 2026
- adjohn/pstacktheir own version, first seen Oct 2, 2026
Used with
Projects with it also use make-bot-ui, setup-pstack and 10 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.
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
TheOnlyFusionCubeSkillprinciple-attack-the-premise
Inventory who actually owns or exhibits the imbalance, then challenge the shared premise before writing another patch. Use when two or more fixes that share one premise have failed the same gate.
Also in 10 projects that use this
TheOnlyFusionCubeSkillprinciple-test-behavior-not-implementation
Call the system the way its consumer does and assert meaningful observable output; avoid mocks or assertions that only mirror internal calls. Use when when writing or evaluating tests.
Also in 10 projects that use this
shishivSkillprinciple-never-block-on-the-human
Apply when tempted to ask 'should I do X?' on reversible work. Proceed, present the result, let the human course-correct after the fact; reserve confirmation for irreversible actions.
Also in 19 projects that use this
finograficSkillfigure-it-out
Design an auditable playbook when no narrower one fits: a large migration, an ambitious multi-part change, or work a human reviews after stepping away. Scales rigor to the task, runs a hypothesis loop, and logs decisions via show-me-your-work. Use for /figure-it-out, 'figure it out', a large migration, or when no narrower playbook applies.
Also in 20 projects that use this
- +6 more from shishiv
Other versions38 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 38
- backnotprop/pstack★ 991same name
- uzairansaruzi/p3-stack★ 129same name
- jtaroreh/agystack★ 58same name
- baekenough/oh-my-customcode★ 43same name
- shrimpwtf/oh-my-pstack★ 31same name
- korallis/skills-collection★ 18same name
- DavidTeju/shared-skills★ 9same name
- ofershap/typescript-best-practices★ 9same name
- flpbalada/fb-skills★ 8same name
- painhardcore/pstack★ 6same name
28 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 repository34 other files it gives its agents.
- accessibilitySkill
- agent-instructionsSkill
- analyze-change-effectsSkill
- article-processingSkill
- ci-cd-automationSkill
- commitSkill
- communicate-clearlySkill
- compare-solutionsSkill
- create-project-instructionsSkill
- daily-meeting-updateSkill
- debugSkill
- design-code-structureSkill
- error-handlingSkill
- explain-codeSkill
- explain-decisionsSkill
- github-actionsSkill
- handoffSkill
- learning-planSkill
- people-memorySkill
- pr-followupSkill
- prototypeSkill
- prSkill
- report-work-activitySkill
- review-code-changesSkill
- simplify-codeSkill
- stacked-prSkill
- tddSkill
- teachSkill
- verification-authoringSkill
- verifySkill
- workflow-to-skillSkill
- worktrunkSkill
- write-documentationSkill
- youtube-processingSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use the simplest types that make the required operations safe.
- Very specific: line 25
Parse untrusted values: Treat incoming untyped data as unknown.
- Distinctive: line 54
Run the repository's checker against the changed files and affected consumers.
“Common” is measured: kept by at least 6 in 10 of the 14 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 simplest types that make the required operations safe. Preserve the task's implementation or inspection scope and the repository's public contracts.
Keep types honest
- Strengthen types where an operation needs it. An empty collection can have a valid result or explicit absence; introduce a non-empty representation only when the contract requires one. Use discriminated unions for dependent fields and compiler-checked exhaustiveness for closed variants. Keep independently optional fields optional. Brand primitives where mixing identities or units causes a concrete error; a brand alone proves no runtime constraint.
- Use the authoritative contract. Infer from the existing schema or generated source when it owns the same contract. Keep stable public interfaces independent of private implementation details. Preserve legitimate callers and documented states, including ones absent from today's call sites. A generic must express a real relationship; letting a caller choose an unchecked return type proves nothing. Prefer inference over redundant annotations or elaborate type machinery.
- Parse untrusted values. Treat incoming untyped data as
unknown; reuse the project's validator and validate at the boundary that owns the contract. An annotation, generated client type,as,satisfies, or generic argument does not validate runtime data. Usesatisfiesto check static compatibility, not to repair a mismatch. Do not silence a real mismatch withany,!, double casts, suppression, or weaker compiler settings. Isolate a necessary assertion at a justified boundary and test the invariant it relies on;as constis not a claim that arbitrary input has been validated. - Check a predicate's whole promise. A declared
value is Tmust justify both branches: true meansT, false excludesT. Property presence or one checked field rarely proves a whole object. Assertion functions need the same scrutiny for the guarantee they claim after returning. - Keep guarantees valid until use.
readonlyandas constdo not freeze runtime objects. Mutation through aliases, callbacks, or across anawaitcan invalidate narrowing or a non-empty collection. Preserve ownership, capture a stable value, or recheck at the relevant transition. - Represent absence accurately. Arbitrary dictionary keys and array indices
can be missing, even with
Record<string, T>or a non-empty array. Distinguish omission, explicitundefined, andnullwhen the contract does.strictalone does not enablenoUncheckedIndexedAccessorexactOptionalPropertyTypes; do not assume either guarantee or turn a small change into an unrelated configuration migration. - Own asynchronous completion. An
asyncfunction can fit avoidcallback whose caller ignores its promise. Check whether completion and rejection reach the intended owner.void promiseonly discards the value. Useerror-handlingwhen recovery policy needs design; do not invent a catch-and-log policy here.
Verify the contract
Run the repository's checker against the changed files and affected consumers;
transpilation is not type checking. For changed type contracts, check valid and
invalid uses with assertions that actually fail on regression. A type alias
evaluating to false is not a failing test. Exercise runtime boundary behavior
separately. Keep formatting and enforceable style in existing tooling.
For compiler, import/export, or package changes, read compiler-and-modules.md. For requested upstream maintenance, read upstream-updates.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.

