AI & Integration v1.0.0

tech-stack-add-typescript-best-practices

Setup TypeScript best practices and code style rules in CLAUDE.md

hahamumu08 更新于 2026-04-17 1 浏览
下载 SKILL

技能说明

Setup TypeScript best practices and code style rules in CLAUDE.md

使用场景

Create or update CLAUDE.md in with following content, <criticalwrite it strictly as it is<critical, do not summaraise or introduce and new additional information:

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

帮我下载并安装这个SKILL:https://skillhub.cstcloud.cn/download/tech-stack-add-typescript-best-practices
  1. 点击上方「下载 SKILL」按钮,获取技能压缩包。
  2. 将压缩包解压到你的 Agent 技能目录。
  3. 重启客户端后即可在技能列表中选择该技能。

技能文件内容

4 个文件 · 13 kB
SKILL.md text/markdown
---
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, <critical>write it strictly as it is<critical>, do not summaraise or introduce and new additional information:

```markdown
## 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
```

文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。