typescript-development
Skill1 starsChanged 10 months agoISCView on GitHub
Comprehensive guidelines for writing type-safe, scalable TypeScript applications. Use when working with .ts files, TypeScript projects, or when adding type safety to JavaScript code.
We split this skill into the rules it gives an agent
29 rules. About 0 are common, 24 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈24
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use this skill when:
- Very specific: line 21
Avoid Any: Never use any type. Use unknown for truly unknown types, then narrow with type guards.
- Very specific: line 22
Strict Mode: Always enable strict mode in tsconfig.json for maximum type safety.
- Very specific: line 24
Const Assertions: Use as const for immutable literal types and readonly arrays/objects.
- Distinctive: line 28
Interfaces vs Types: Use interfaces for object shapes and public APIs.
- Distinctive: line 29
Discriminated Unions: Use discriminated unions for type-safe state machines and variants.
- Distinctive: line 30
Generics: Use generics to create reusable, type-safe functions and components.
- Distinctive: line 36
Mapped Types: Create types that transform properties of existing types.
- Distinctive: line 37
Conditional Types: Use conditional types for type-level logic and inference.
- Distinctive: line 39
Branded Types: Use branded types (nominal typing) to prevent primitive obsession.
- Distinctive: line 40
Index Signatures: Use index signatures carefully.
- Very specific: line 64
Module Resolution: Use "bundler" for modern projects, "node" for traditional Node.js.
- Very specific: line 70
Declaration Files: Create .d.ts files for ambient declarations and module augmentation.
- Distinctive: line 73
Global Declarations: Use declare global sparingly for truly global augmentations.
- Distinctive: line 74
Triple-Slash Directives: Avoid triple-slash directives except for reference types in declaration files.
- Distinctive: line 78
Generic Constraints: Use extends to constrain generic types appropriately.
- Distinctive: line 86
Access Modifiers: Use private, protected, public explicitly for class members.
- Distinctive: line 88
Abstract Classes: Use abstract classes for base classes that shouldn't be instantiated.
- Distinctive: line 89
Parameter Properties: Use parameter properties shorthand in constructors.
- Distinctive: line 95
Zod/Yup Integration: Use schema validation libraries for runtime type checking.
- Distinctive: line 96
Custom Error Types: Create typed error classes for domain-specific errors.
- Distinctive: line 97
Never Type: Use never for exhaustive checks and unreachable code paths.
- Distinctive: line 98
Result Types: Consider Result<T, E> pattern for explicit error handling.
- Distinctive: line 104
Type Assertion Safety: Use type assertions (as) sparingly and only when type is guaranteed.
- Distinctive: line 106
Branded IDs: Use branded types for IDs to prevent mixing different entity IDs.
- Distinctive: line 110
Functional Components: Use React.FC sparingly. Prefer explicit typing.
- Distinctive: line 113
Refs: Use useRef with proper type parameters.
- Distinctive: line 135
JSDoc First: Add JSDoc comments before full TypeScript conversion.
- Distinctive: line 142
Before submitting TypeScript code, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeScript Development Skills
When to Use This Skill
Use this skill when:
- Writing or refactoring TypeScript code (.ts, .tsx files)
- Adding type definitions to existing JavaScript projects
- Building type-safe APIs and applications
- Working with complex data structures requiring type safety
- Configuring TypeScript compiler options
I. TypeScript Fundamentals
- Type Everything: Provide explicit types for function parameters, return values, and complex variables.
- Avoid Any: Never use
anytype. Useunknownfor truly unknown types, then narrow with type guards. - Strict Mode: Always enable strict mode in tsconfig.json for maximum type safety.
- Type Inference: Let TypeScript infer types when obvious. Don't over-annotate simple cases.
- Const Assertions: Use
as constfor immutable literal types and readonly arrays/objects.
II. Type System Best Practices
- Interfaces vs Types: Use interfaces for object shapes and public APIs. Use type aliases for unions, intersections, and complex types.
- Discriminated Unions: Use discriminated unions for type-safe state machines and variants.
- Generics: Use generics to create reusable, type-safe functions and components.
- Type Guards: Implement custom type guards (is predicates) for runtime type narrowing.
- Utility Types: Leverage built-in utility types (Partial, Required, Pick, Omit, Record, etc.).
III. Advanced Type Patterns
- Mapped Types: Create types that transform properties of existing types.
- Conditional Types: Use conditional types for type-level logic and inference.
- Template Literal Types: Leverage template literal types for string manipulation at type level.
- Branded Types: Use branded types (nominal typing) to prevent primitive obsession.
- Index Signatures: Use index signatures carefully. Prefer Record<K, V> when possible.
IV. Configuration (tsconfig.json)
Essential Compiler Options:
{
"compilerOptions": {
"strict": true,
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true
}
}- Strict Checks: Enable all strict flags (strictNullChecks, strictFunctionTypes, etc.).
- Module Resolution: Use "bundler" for modern projects, "node" for traditional Node.js.
- Path Mapping: Configure path aliases for cleaner imports.
- Declaration Files: Enable declaration generation for library projects.
V. Type Definitions & Declarations
- Declaration Files: Create .d.ts files for ambient declarations and module augmentation.
- DefinitelyTyped: Install @types packages for third-party libraries without types.
- Module Augmentation: Extend existing module types when necessary using declare module.
- Global Declarations: Use declare global sparingly for truly global augmentations.
- Triple-Slash Directives: Avoid triple-slash directives except for reference types in declaration files.
VI. Functions & Generics
- Generic Constraints: Use extends to constrain generic types appropriately.
- Function Overloads: Provide overloads for functions with multiple call signatures.
- Return Type Inference: Let TypeScript infer return types for simple functions.
- Explicit Returns for APIs: Explicitly type return values for public API functions.
- Generic Functions: Make functions generic when they work with multiple types similarly.
VII. Classes & OOP
- Access Modifiers: Use private, protected, public explicitly for class members.
- Readonly Properties: Mark immutable properties as readonly.
- Abstract Classes: Use abstract classes for base classes that shouldn't be instantiated.
- Parameter Properties: Use parameter properties shorthand in constructors.
- Implements vs Extends: Implement interfaces, extend classes. Understand the difference.
VIII. Error Handling & Validation
- Type Guards for Runtime: Implement runtime validation for external data (API responses, user input).
- Zod/Yup Integration: Use schema validation libraries for runtime type checking.
- Custom Error Types: Create typed error classes for domain-specific errors.
- Never Type: Use never for exhaustive checks and unreachable code paths.
- Result Types: Consider Result<T, E> pattern for explicit error handling.
IX. Working with External Data
- API Response Types: Define interfaces for all API response shapes.
- JSON Parsing: Validate JSON parsing results with type guards or validators.
- Type Assertion Safety: Use type assertions (as) sparingly and only when type is guaranteed.
- Unknown First: Parse external data as unknown, then validate and narrow.
- Branded IDs: Use branded types for IDs to prevent mixing different entity IDs.
X. React & TypeScript Integration
- Functional Components: Use React.FC sparingly. Prefer explicit typing.
- Props Interfaces: Define clear interfaces for component props.
- Event Handlers: Type event handlers explicitly (React.MouseEvent, React.ChangeEvent).
- Refs: Use useRef with proper type parameters.
- Context: Provide proper types for Context providers and consumers.
XI. Common Patterns
Good Patterns:
- Discriminated unions for state management
- Readonly
<T>for immutable data structures - Type predicates (is) for type narrowing
- Branded types for domain modeling
- Builder pattern with fluent interfaces
Anti-Patterns to Avoid:
- Using any or @ts-ignore to bypass errors
- Type assertions without validation
- Overly complex generic constraints
- Ignoring strict null checks
- Implicit any in function parameters
XII. Migration from JavaScript
- Gradual Migration: Enable allowJs and incrementally convert files.
- JSDoc First: Add JSDoc comments before full TypeScript conversion.
- Type Inference: Let TypeScript infer types during migration, refine later.
- External Types: Install @types packages before converting dependencies.
- Strictness Gradual: Enable strict flags incrementally during migration.
XIII. Best Practices Checklist
Before submitting TypeScript code, verify:
- Strict mode enabled in tsconfig.json
- No any types (use unknown and narrow)
- Public APIs have explicit return types
- Interfaces used for object shapes
- Generics constrained appropriately
- Runtime validation for external data
- No type assertions without validation
- Discriminated unions for complex states
- Utility types used where appropriate
- No @ts-ignore or @ts-expect-error comments
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- sammcj/agentic-coding★ 164same name
- hiromaily/go-crypto-wallet★ 128same name
- CODE-SAURABH/OpenSkills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- ai-development-assistantSkill
- angular-developmentSkill
- bun-package-managerSkill
- css-developmentSkill
- go-developmentSkill
- html-developmentSkill
- javascript-developmentSkill
- npm-package-managerSkill
- pnpm-package-managerSkill
- python-developmentSkill
- react-developmentSkill
- rust-developmentSkill
- vue-developmentSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

