← ClaudeAtlas

occam-typescriptlisted

TypeScript and JavaScript guidance on null versus undefined, runtime validation, promises and cancellation, number precision, output escaping, builds, modules, naming, test results. Use alongside occam to write, debug or review TypeScript or JavaScript where these matter.
stephenoffer/occam · ★ 1 · Code & Development · score 77
Install: claude install-skill stephenoffer/occam
# TypeScript and JavaScript Read the actual manifest and conventions before choosing commands, and use the ecosystem's established tools. Don't translate patterns from another language mechanically. - **Tooling:** check `package.json` scripts, the lockfile and its package manager, the Node version, `tsconfig` strictness, and whether the project is ESM or CommonJS. - **Nullability:** `null`, `undefined` and a missing key differ. Use `??` rather than `||` when `0` or `""` are valid. A truthiness check on an optional security value is a common way to skip it. - **Types are erased:** a TypeScript type or `as` assertion validates nothing at runtime. Validate at trust boundaries. `any` silently disables checks downstream. - **Async:** an unawaited promise loses its errors. `Promise.all` rejects early without cancelling the others, so use `AbortController` for cancellation. `forEach` doesn't await, and `filter`, `some` and `find` treat an async callback's promise as true. Bound concurrency, since mapping a large list to promises starts everything at once. A response that arrives after a newer request was sent mustn't overwrite the newer state, so abort the old request or check which request it answers. - **Merging objects:** copying keys from parsed JSON or a request into an object lets a `__proto__` key replace its prototype, and a deep merge can reach `Object.prototype`, which every object shares. Allow-list the keys, skip `__proto__`, `constructor` and `prototype`, or build int