TypeScript Best Practices
A collection of best practices and patterns for writing clean, idiomatic TypeScript code.
Install
mkdir -p .claude/skills/typescript-best-practices-fierzone && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10798" && unzip -o skill.zip -d .claude/skills/typescript-best-practices-fierzone && rm skill.zipInstalls to .claude/skills/typescript-best-practices-fierzone
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Idiomatic TypeScript patterns for clean, maintainable code.Key capabilities
- →Review code for idioms
- →Implement clean module exports
- →Refactor class structures
How it works
It enforces naming, async patterns, and module structure conventions for maintainability.
Inputs & outputs
When to use TypeScript Best Practices
- →Review TypeScript code for idioms
- →Implement clean module exports
- →Refactor class structures
About this skill
TypeScript Best Practices
Priority: P1 (OPERATIONAL)
Implementation Guidelines
- Naming: Classes/Types=
PascalCase, vars/funcs=camelCase, consts=UPPER_SNAKE. PrefixIonly if needed. - Functions: Arrows for callbacks; regular for exports. Always type public API returns.
- Modules: Named exports only. Import order: external → internal → relative.
- Async: Use
async/await, not raw Promises.Promise.all()for parallel. - Classes: Explicit access modifiers. Favor composition. Use
readonly. - Types: Use
neverfor exhaustiveness,assertsfor runtime checks. - Optional: Use
?:, not| undefined. - Imports: Use
import typefor tree-shaking.
Anti-Patterns
- No Default Exports: Use named exports.
- No Implicit Returns: Specify return types.
- No Unused Variables: Enable
noUnusedLocals. - No
require: Use ES6import. - No Empty Interfaces: Use
typeor non-empty interface. - Use any: Never use
any, useunknownonly when necessary.
Reference & Examples
See references/examples.md for code samples including:
- Immutable Interfaces
- Exhaustiveness Checking
- Assertion Functions
- Dependency Injection Patterns
- Import Organization
Related Topics
language | tooling | security
When not to use it
- →Implicit returns
- →Using any
Limitations
- →Never use any
How it compares
It provides a set of strict idiomatic rules rather than general coding guidelines.
Compared to similar skills
TypeScript Best Practices side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| TypeScript Best Practices (this skill) | 0 | 6mo | No flags | Intermediate |
| react-component-patterns | 3 | 28d | No flags | Intermediate |
| typescript-pro | 3 | 4mo | No flags | Advanced |
| nx-generate | 1 | 6mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by fierzone
View all by fierzone →You might also like
react-component-patterns
HoangNguyen0403
Modern React component architecture and composition patterns.
typescript-pro
sickn33
Master TypeScript with advanced types, generics, and strict type safety. Handles complex type systems, decorators, and enterprise-grade patterns. Use PROACTIVELY for TypeScript architecture, type inference optimization, or advanced typing patterns.
nx-generate
nrwl
Generate code using nx generators. USE WHEN scaffolding code or transforming existing code - for example creating libraries or applications, or anything else that is boilerplate code or automates repetitive tasks. ALWAYS use this first when generating code with Nx instead of calling MCP tools or running nx generate immediately.
generate-subsystem-skills
llama-farm
Generate specialized skills for each subsystem in the monorepo. Creates shared language skills and subsystem-specific checklists for high-quality AI code generation.
ark-sdk-development
mckinsey
Regenerate and debug types across the ARK stack (SDK, API, Dashboard). Use when fixing TypeScript type errors in ark-dashboard, updating types after CRD changes, regenerating types.ts from OpenAPI spec, debugging "Property does not exist on type" schema errors, or adding custom SDK functionality via overlays. Covers the full type pipeline from Kubernetes CRDs to TypeScript.
effect-patterns-domain-modeling
PaulJPhilp
Effect-TS patterns for Domain Modeling. Use when working with domain modeling in Effect-TS applications.