typescript-best-practices
Skill2 starsChanged 15 days agoMITView on GitHub
Use when implementing or reviewing TypeScript code, including type contracts and compiler or module configuration.
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 22 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 22 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.
Other versions70 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 70
- backnotprop/pstack★ 3.3ksame name
- jtaroreh/agystack★ 128same name
- uzairansaruzi/p3-stack★ 126same name
- dsebban/skills★ 71same name
- baekenough/oh-my-customcode★ 42same name
- overextended/skills★ 22same name
- Scino/fstack★ 18same name
- TheOnlyFusionCube/potetos-for-everyone★ 18same name
- creedants/pstack-t3★ 17same name
- korallis/skills-collection★ 14same name
60 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.
Used alongsideProjects with it also use setup-pstack, poteto-help and 9 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 21 projects that use this
ianclearySkillpoteto-help
Guides users through pstack setup, /poteto-mode, and picking the skill, playbook, or principle for a task. Type /poteto-help with a question.
Also in 8 projects that use this
alexnthnzSkillin-your-own-words
Restate in your own words what you think the user's goals are and what problem they're trying to solve. Use for /keel:in-your-own-words.
Also in 8 projects that use this
Xia-AtaraxiaSkillmake-bot-ui
Builds a small web page whose buttons wake an agent over a webhook: a local server keeps the sender key server-side and POSTs JSON to a webhook-triggered routine, and the page is exposed on the existing Tailscale node. Use for \"make a bot UI\", \"a dashboard with buttons that trigger the agent\", \"wake the bot from a page\", handing a webhook sender key to the server without pasting it in chat, or putting that UI on the tailnet. Not for general frontend work - use principle-frontend; not for tailnet health or reachability - use tailscale.
Also in 14 projects that use this
Xia-AtaraxiaSkillbenchmark-checklist
Vets performance measurements for the limiter, tuning, physical limits, errors, repeatability, relevance, and proof that timed work happened. It applies to 'check this benchmark', 'report this speedup', measured regressions, and choosing a library or configuration from numbers. It reports spread and gaps before drawing a conclusion. Not for general testing policy or choosing test oracles - use principle-testing.
Also in 15 projects that use this
fullerzzSkillcreate-formal-verification-skill
Generate a reusable project-local skill for model checking or proving code-linked properties. Use explicitly for /create-formal-verification-skill, model-checking a race, or proving an invariant; UI and service journey checks belong to create-verification-skill.
Also in 4 projects that use this
In this repository48 other files it gives its agents.
- accessibilitySkill
- agent-instructionsSkill
- analyze-change-effectsSkill
- article-processingSkill
- ci-cd-automationSkill
- comment-styleSkill
- commitSkill
- communicate-clearlySkill
- compare-solutionsSkill
- create-project-instructionsSkill
- daily-meeting-updateSkill
- debugSkill
- deprecate-and-removeSkill
- design-code-structureSkill
- domain-searchSkill
- error-handlingSkill
- explain-codeSkill
- explain-decisionsSkill
- github-actionsSkill
- handoffSkill
- humanizeSkill
- issue-workflowSkill
- observabilitySkill
- people-memorySkill
- performance-optimizationSkill
- planningSkill
- pr-followupSkill
- prototypeSkill
- pr-review-followupSkill
- pr-reviewSkill
- prSkill
- report-work-activitySkill
- retroSkill
- review-code-changesSkill
- simplify-codeSkill
- skill-maintenanceSkill
- stacked-prSkill
- task-breakdownSkill
- tddSkill
- teachSkill
- verification-authoringSkill
- verifySkill
- wayfinderSkill
- workflow-to-skillSkill
- work-modeSkill
- worktrunkSkill
- write-documentationSkill
- youtube-processingSkill
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.

