Add Typescript Best Practices — 添加 Typescript Best Practices
v1.0.0设置up TypeScript best practices and code style rules in CLAUDE.md
0· 196·0 当前·0 累计
下载技能包
License
MIT-0
运行时依赖
无特殊依赖
安装命令
点击复制官方npx clawhub@latest install add-typescript-best-practices
镜像加速npx clawhub@latest install add-typescript-best-practices --registry https://cn.longxiaskill.com镜像同步中
技能文档
设置up TypeScript Best Practices
创建 or 更新 CLAUDE.md in with following content, write it strictly as it is, do not summarAIse or introduce and new 添加itional in格式化ion:
Code Style Rules
General 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
- 导出 all types by default
- Use type 防护s instead of type assertions
Best Practices
库-First 应用roach
- Common areas where libraries should be preferred:
代码质量
- Use destructuring of objects where possible:
const name = user.name use const { name } = user
- Instead of const 结果 = awAIt 获取User(userId) use const { data: user } = awAIt 获取User(userId)
- Instead of const 解析Data = (data) => data.name use const 解析Data = ({ name }) => name
- Use
mspackage for time related configuration and 环境 variables, instead of multiplying numbers by 1000