Help us improve
Share bugs, ideas, or general feedback.
From typescript
TypeScript 核心开发规范,覆盖 TS 5.7+ strict mode、tsconfig 配置、ESLint flat config、Biome 格式化、模块解析与现代工具链最佳实践。适用于新建 TS 项目、配置 TypeScript 编译选项、设置 linter/formatter 时加载。
npx claudepluginhub lazygophers/ccplugin --plugin typescriptHow this skill is triggered — by the user, by Claude, or both
Slash command
/typescript:coresonnetThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
| Agent | 说明 |
Enforces TypeScript strict mode configs, Vitest testing with 95%+ coverage, ESLint rules, and CI/CD quality check commands for TS projects.
Provides TypeScript 5.x patterns for strict mode, generics, utility types, interfaces, unions, intersections, literals, and narrowing. Use when writing TS code or typing JS projects.
Provides 2025 TypeScript strict mode tsconfig.json recommendations, explains strict flags like noUncheckedIndexedAccess, moduleResolution (Bundler vs NodeNext), verbatimModuleSyntax. Use for new projects or stricter type safety migrations.
Share bugs, ideas, or general feedback.
| Agent | 说明 |
|---|---|
| dev | TypeScript 开发专家 |
| debug | TypeScript 调试专家 |
| test | TypeScript 测试专家 |
| perf | TypeScript 性能优化专家 |
| 场景 | Skill | 说明 |
|---|---|---|
| 类型系统 | Skills(types) | discriminated unions、Zod、模板字面量 |
| 异步编程 | Skills(async) | Promise、AbortController、async iterators |
| React 开发 | Skills(react) | React 19、Server Components、Next.js 15 |
| Node.js | Skills(nodejs) | Node.js 22 LTS、ESM、fetch API |
| 安全编码 | Skills(security) | CSP、输入验证、XSS 防护 |
TypeScript 生态追求类型安全、现代工程、可维护性。
strict: true + noUncheckedIndexedAccess + noImplicitOverrideany,使用 unknown + 类型守卫eslint.config.ts 或 Biomeany 类型(使用 unknown 代替)@ts-ignore(使用 @ts-expect-error 并附注释)enum(使用 as const 对象替代)if (err) return err;)// 类型:PascalCase
type UserDTO = { id: string; name: string };
type Status = "active" | "inactive" | "pending";
// 变量/函数:camelCase
const userName = "John";
function getUserById(id: string): Promise<User> { /* ... */ }
// 常量:UPPER_SNAKE_CASE(模块级不可变值)
const MAX_RETRIES = 3;
const API_BASE_URL = "https://api.example.com";
// as const 替代 enum
const Role = { Admin: "admin", User: "user", Guest: "guest" } as const;
type Role = (typeof Role)[keyof typeof Role];
{
"compilerOptions": {
"target": "ES2024",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noFallthroughCasesInSwitch": true,
"verbatimModuleSyntax": true,
"isolatedModules": true,
"skipLibCheck": true,
"declaration": true,
"sourceMap": true,
"outDir": "./dist"
}
}
// eslint.config.ts
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
{
languageOptions: {
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
},
rules: {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
},
},
);
| 现象 | 问题 | 严重程度 |
|---|---|---|
使用 any | 类型安全漏洞 | 高 |
@ts-ignore | 隐藏真实类型错误 | 高 |
enum 关键字 | tree-shaking 不友好 | 中 |
.eslintrc.js | 旧版配置,应迁移到 flat config | 中 |
npm install | 应使用 pnpm | 中 |
| Jest 配置 | 应迁移到 Vitest 3.x | 中 |
strict: true + noUncheckedIndexedAccessany 类型@ts-ignoreas const 替代 enumimport type 分离类型导入