π¦ ClawHub
Add Typescript Best Practices
by @hahamumu08
Setup TypeScript best practices and code style rules in CLAUDE.md
TERMINAL
clawhub install add-typescript-best-practicesπ About This Skill
name: tech-stack:add-typescript-best-practices description: Setup TypeScript best practices and code style rules in CLAUDE.md argument-hint: Optional argument which practices to add or avoid
Setup TypeScript Best Practices
Create or update CLAUDE.md in with following content,
## Code Style RulesGeneral Principles
TypeScript: All code must be strictly typed, leverage TypeScript's type safety features Code style rules
Interfaces over types - use interfaces for object types
Use enum for constant values, prefer them over string literals
Export all types by default
Use type guards instead of type assertions Best Practices
#### Library-First Approach
Common areas where libraries should be preferred:
- Date/time manipulation β date-fns, dayjs
- Form validation β joi, yup, zod
- HTTP requests β axios, got
- State management β Redux, MobX, Zustand
- Utility functions β lodash, ramda#### Code Quality
Use destructuring of objects where possible:
- Instead of const name = user.name use const { name } = user
- Instead of const result = await getUser(userId) use const { data: user } = await getUser(userId)
- Instead of const parseData = (data) => data.name use const parseData = ({ name }) => name
Use ms package for time related configuration and environment variables, instead of multiplying numbers by 1000
π Tips & Best Practices
#### Library-First Approach
#### Code Quality
const name = user.name use const { name } = user
- Instead of const result = await getUser(userId) use const { data: user } = await getUser(userId)
- Instead of const parseData = (data) => data.name use const parseData = ({ name }) => name
ms package for time related configuration and environment variables, instead of multiplying numbers by 1000