tech-stack%3Aadd-typescript-best-practices by neolabhq/context-engineering-kit
npx skills add https://github.com/neolabhq/context-engineering-kit --skill tech-stack:add-typescript-best-practices创建或更新 CLAUDE.md 文件,内容如下,请严格按原样书写,不要总结或引入任何额外信息:
## 代码风格规则
### 通用原则
- **TypeScript**:所有代码必须严格类型化,充分利用 TypeScript 的类型安全特性
### 代码风格规则
- 接口优于类型 - 对于对象类型使用接口
- 对常量值使用枚举,优先于字符串字面量
- 默认导出所有类型
- 使用类型守卫而非类型断言
### 最佳实践
#### 库优先方法
- 应优先使用库的常见领域:
- 日期/时间操作 → date-fns, dayjs
- 表单验证 → joi, yup, zod
- HTTP 请求 → axios, got
- 状态管理 → Redux, MobX, Zustand
- 工具函数 → lodash, ramda
#### 代码质量
- 尽可能使用对象解构:
- 使用 `const { name } = user` 替代 `const name = user.name`
- 使用 `const { data: user } = await getUser(userId)` 替代 `const result = await getUser(userId)`
- 使用 `const parseData = ({ name }) => name` 替代 `const parseData = (data) => data.name`
- 对于时间相关的配置和环境变量,使用 `ms` 包,而不是将数字乘以 1000
每周安装量
213
代码仓库
GitHub 星标数
699
首次出现
2026年2月19日
已安装于
opencode207
github-copilot206
codex206
gemini-cli205
cursor204
kimi-cli203
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Create or update CLAUDE.md in with following content, write it strictly as it is, do not summaraise or introduce and new additional information:
## 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
- 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
Weekly Installs
213
Repository
GitHub Stars
699
First Seen
Feb 19, 2026
Installed on
opencode207
github-copilot206
codex206
gemini-cli205
cursor204
kimi-cli203
Node.js 环境配置指南:多环境管理、类型安全与最佳实践
10,500 周安装
散文风格诊断技能:识别小说句子写作问题,提升写作质量与故事表现力
150 周安装
GitHub Copilot CLI 委托技能:非交互式命令、模型选择与安全权限指南
153 周安装
Claude Code 多智能体编排系统 - 基于 Git 的轻量级任务追踪与工作流管理
150 周安装
Next.js useSearchParams Suspense 模式详解:解决URL参数读取与服务器端渲染问题
151 周安装
财报交易分析器 - 五因子评分系统,精准识别财报后动量交易机会
157 周安装
Vercel AI SDK v6 完整指南:实现聊天、工具调用、结构化输出与智能体
150 周安装