typescript-best-practices
Installation
SKILL.md
TypeScript Best Practices
Priority: P1 (OPERATIONAL)
Implementation Guidelines
- Naming: Use
PascalCasefor Classes/Types/Interfaces,camelCasefor variables/functions, andUPPER_SNAKEfor static constants. - Functions: Use
arrow functionsfor callbacks/logic;function declarationfor top-level exports. Always typepublic APIreturns. - Modules: Use
Named exportsONLY to enable better refactoring/auto-imports. - Async: Use
async/awaitwithPromise.all()for parallel execution. Implementtry-catchfor error handling; typecatch(e) as unknownand narrow before use. Avoid.then().catch()chains. - Classes: Explicitly use
private,protected, andpublicmodifiers. Favorcompositionover inheritance anddependency injectionwithconstructor injectionand interfaces over singletons for testability. - Type Safety: Use
neverfor exhaustiveness checks in switch-cases. - Optional: Use
optional chaining(?.) andnullish coalescing(??) over manual checks. - Imports: Enforce
external packages → internal modules → relative importsorder automatically viaeslint-plugin-import. Useimport typefor interfaces/types to ensure better tree-shaking and zero runtime overhead. - Validation: Use
ZodorTsoafor runtime boundary validation.
Anti-Patterns
Related skills
More from hoangnguyen0403/agent-skills-standard
skill creator
Standards for creating new High-Density Agent Skills with optimal token economy.
183caveman
>
1java-language
Modern Java 21+ standards including Records, Pattern Matching, and Virtual Threads. Use when working with Java records, sealed classes, switch expressions, text blocks, Optional, or upgrading from older Java versions. (triggers: **/*.java, pom.xml, build.gradle, record, sealed, switch, var, Optional, stream, VirtualThread, instanceof, text block)
1swift swiftui
Standards for State Management, View Lifecycle, and Property Wrappers
1swift tooling
Standards for SPM, Build Configs, and Code Quality
1swift testing
Standards for XCTest, Async Tests, and Test Organization
1