strict: true+noUncheckedIndexedAccessin tsconfig, neverany— useunknownwith type guards.- ESM imports only,
constoverlet,as constfor literals,interfaceovertypefor objects. import typefor type-only imports to avoid runtime overhead. Discriminated unions for type-safe state.- Formatting/linting: a formatter + linter (e.g., Prettier + ESLint, or Biome). Type checking:
tsc --noEmitin CI. - Testing: a fast test runner (e.g., Vitest or Jest), 80%+ coverage. Runtime validation at system boundaries with a schema validator (e.g., Zod).
- Error handling: discriminated unions for expected errors, throw only for unexpected.
- Package manager: a lockfile-based package manager (npm, pnpm, or yarn) with the lockfile committed, build: a bundler (e.g., tsup or esbuild).
- Monorepo: workspace protocol (
workspace:*), shared tsconfig base, a workspace manifest (e.g.,pnpm-workspace.yaml). - Node.js:
node:prefix for core modules,fetchoveraxios. - Security:
npm audit/pnpm auditfor dependency CVE scanning. Zero tolerance for critical/high vulnerabilities. - Anti-patterns: non-null assertions (
!), type assertions (as),enum(use unions),@ts-ignore.
Typescript Conventions
TypeScript code conventions covering strict tsconfig, ESM imports, discriminated unions, formatting/linting, Vitest testing, lockfile-based packaging, Node.js, and security. Load when writing or reviewing TypeScript code.
Typescript Conventions by goldziher · e80656d
npx skillmds@latest add goldziher/typescript-conventions File contents
---name: typescript-conventionsdescription: TypeScript code conventions covering strict tsconfig, ESM imports, discriminated unions, formatting/linting, Vitest testing, lockfile-based packaging, Node.js, and security. Load when writing or reviewing TypeScript code.---- `strict: true` + `noUncheckedIndexedAccess` in tsconfig, never `any` — use `unknown` with type guards.- ESM imports only, `const` over `let`, `as const` for literals, `interface` over `type` for objects.- `import type` for type-only imports to avoid runtime overhead. Discriminated unions for type-safe state.- Formatting/linting: a formatter + linter (e.g., Prettier + ESLint, or Biome). Type checking: `tsc --noEmit` in CI.- Testing: a fast test runner (e.g., Vitest or Jest), 80%+ coverage. Runtime validation at system boundaries with a schema validator (e.g., Zod).- Error handling: discriminated unions for expected errors, throw only for unexpected.- Package manager: a lockfile-based package manager (npm, pnpm, or yarn) with the lockfile committed, build: a bundler (e.g., tsup or esbuild).- Monorepo: workspace protocol (`workspace:*`), shared tsconfig base, a workspace manifest (e.g., `pnpm-workspace.yaml`).- Node.js: `node:` prefix for core modules, `fetch` over `axios`.- Security: `npm audit`/`pnpm audit` for dependency CVE scanning. Zero tolerance for critical/high vulnerabilities.- Anti-patterns: non-null assertions (`!`), type assertions (`as`), `enum` (use unions), `@ts-ignore`.
goldziher/ai-rulez/tree/main/internal/builtins/languages/typescript/skills/typescript-conventions commit e80656d010
Frequently asked questions
Run npx skillmds@latest add goldziher/typescript-conventions 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 code conventions covering strict tsconfig, ESM imports, discriminated unions, formatting/linting, Vitest testing, lockfile-based packaging, Node.js, and security. Load when writing or reviewing TypeScript code. It is listed under Security 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.
goldziher (@goldziher) published this skill. Their other Agent Skills are listed on their SkillMD profile.