- no barrel files
- no
voidfor async - use async/effect (exception vscode-window-messages) - no
export *- name exports explicitly - prefer
undefinedover null (unless server requires null) - prefer
undefinedover empty string - prefer map/filter over loops/conditionals
- avoid mutation
- avoid
any - derive types from the source of truth; don't hand-write or narrow them to satisfy the compiler. ex: use ReturnType<> to match something
- no enums or namespaces (enums compile to weird JS; use string union types instead; exception: interfaces defined outside this repo that we can't change)
- no runtime errors for developer mistakes (use types to ensure exhaustive switch/case; don't throw for null/undefined when input/consumer is within our control)
- .ts filenames: camelCase, no hyphens, no leading capitals
- preserve comments when refactoring; remove/fix if wrong/obsolete
- exported functions: single-line jsdoc /*_ foo _/ if name unclear; no params/return (TS provides types)
- look for uses of (Object|Map).groupBy instead of older patterns
- redundant empty-collection guards: if
arr.find/some/every/map/filter/reducealready returns the same value for an empty array, drop theif (arr.length === 0) return …guard. e.g.findon[]isundefined, so guardingreturn undefinedis dead code. - no needless const declarations: return directly instead of
const x = val; return x(exception: complex expressions where const improves readability)
Typescript
TypeScript coding standards — apply when writing, reviewing, or refactoring .ts/.tsx, or naming/renaming .ts files (camelCase casing).
Typescript by forcedotcom · 2ecc625
npx skillmds@latest add forcedotcom/typescript File contents
---name: typescriptdescription: TypeScript coding standards — apply when writing, reviewing, or refactoring .ts/.tsx, or naming/renaming .ts files (camelCase casing).---- no barrel files- no `void` for async - use async/effect (exception [vscode-window-messages](../vscode-window-messages/SKILL.md))- no `export *` - name exports explicitly- prefer `undefined` over null (unless server requires null)- prefer `undefined` over empty string- prefer map/filter over loops/conditionals- avoid mutation- avoid `any`- derive types from the source of truth; don't hand-write or narrow them to satisfy the compiler. ex: use ReturnType<> to match something- no enums or namespaces (enums compile to weird JS; use string union types instead; exception: interfaces defined outside this repo that we can't change)- no runtime errors for developer mistakes (use types to ensure exhaustive switch/case; don't throw for null/undefined when input/consumer is within our control)- .ts filenames: camelCase, no hyphens, no leading capitals- preserve comments when refactoring; remove/fix if wrong/obsolete- exported functions: single-line jsdoc /\*_ foo _/ if name unclear; no params/return (TS provides types)- look for uses of (Object|Map).groupBy instead of older patterns- redundant empty-collection guards: if `arr.find/some/every/map/filter/reduce` already returns the same value for an empty array, drop the `if (arr.length === 0) return …` guard. e.g. `find` on `[]` is `undefined`, so guarding `return undefined` is dead code.- no needless const declarations: return directly instead of `const x = val; return x` (exception: complex expressions where const improves readability)
forcedotcom/salesforcedx-vscode/tree/main/.claude/skills/typescript commit 2ecc625878
Frequently asked questions
Run npx skillmds@latest add forcedotcom/typescript in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
TypeScript coding standards — apply when writing, reviewing, or refactoring .ts/.tsx, or naming/renaming .ts files (camelCase casing). It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
forcedotcom (@forcedotcom) published this skill. Their other Agent Skills are listed on their SkillMD profile.