Prefer explicit types for public APIs, function parameters, and complex data structures.
Avoid any; use unknown when the type is genuinely unknown.
Prefer type inference for simple local variables.
Use interfaces or type aliases consistently with existing project conventions.
Reuse existing types instead of duplicating definitions.
Use discriminated unions for state and variant-based logic when appropriate.
Handle null and undefined explicitly.
Avoid unsafe type assertions (as) unless necessary and justified.
Prefer type guards over casting.
Use generics when they improve type safety and reusability.
Keep types simple, readable, and close to where they are used.
Avoid over-engineering types for simple code.
Preserve existing TypeScript configuration and project conventions.
Run TypeScript checks, lint, tests, or build after significant changes when available.
1---2name: typescript3description: TypeScript Coding Skill4---5# TypeScript Coding Skill67- Use strict, type-safe TypeScript.8- Prefer explicit types for public APIs, function parameters, and complex data structures.9- Avoid `any`; use `unknown` when the type is genuinely unknown.10- Prefer type inference for simple local variables.11- Use interfaces or type aliases consistently with existing project conventions.12- Reuse existing types instead of duplicating definitions.13- Use discriminated unions for state and variant-based logic when appropriate.14- Handle `null` and `undefined` explicitly.15- Avoid unsafe type assertions (`as`) unless necessary and justified.16- Prefer type guards over casting.17- Use generics when they improve type safety and reusability.18- Keep types simple, readable, and close to where they are used.19- Avoid over-engineering types for simple code.20- Preserve existing TypeScript configuration and project conventions.21- Run TypeScript checks, lint, tests, or build after significant changes when available.
Run npx skillmds@latest add quannv1198/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 Skill It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. 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.
quannv1198 (@quannv1198) published this skill. Their other Agent Skills are listed on their SkillMD profile.