360 Secure SkillHub
360 安全技能中心

typescript

面向 TypeScript 项目的规则指南,按优先级覆盖类型系统性能、tsconfig 配置、异步模式、模块组织、类型安全、内存管理与运行时优化等 8 类共 44 条规则,每条规则文档给出原因说明及错误与正确代码示例,并附检测与迁移说明。

PyModel
热度 0.00
最近更新 2026-10-18 21:48:38
分类:开发依赖:代码执行应用场景:代码审查 / 代码生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add pymodel/react-frontend-skills/typescript
Metadata
name
typescript
description
TypeScript types, tsconfig and TypeScript 7 migration.

TypeScript Best Practices

Comprehensive TypeScript 7-compatible guide with 44 rules across 8 categories, covering compiler configuration, type-system performance, async code, modules, safety, and measured runtime optimization.

When to Apply

Reference these guidelines when:

  • Configuring tsconfig.json for a new or existing project
  • Writing complex type definitions or generics
  • Optimizing async/await patterns and data fetching
  • Organizing modules and managing imports
  • Reviewing code for compilation or runtime performance

Rule Categories by Priority

Priority Category Impact Prefix
1 Type System Performance CRITICAL type-
2 Compiler Configuration CRITICAL tscfg-
3 Async Patterns HIGH async-
4 Module Organization HIGH module-
5 Type Safety Patterns MEDIUM-HIGH safety-
6 Memory Management MEDIUM mem-
7 Runtime Optimization LOW-MEDIUM runtime-
8 Advanced Patterns LOW advanced-

Table of Contents

  1. Type System Performance — CRITICAL
  2. Compiler Configuration — CRITICAL
  3. Async Patterns — HIGH
  4. Module Organization — HIGH
  5. Type Safety Patterns — MEDIUM-HIGH
  6. Memory Management — MEDIUM
  7. Runtime Optimization — LOW-MEDIUM
  8. Advanced Patterns — LOW

How to Use

Run in the project root first:

npx -y @pymodel/react-frontend-skills detect                   # installed vs. targeted versions
npx -y @pymodel/react-frontend-skills scan --skill typescript  # deprecated APIs → rule IDs

Read references/<rule-id>.md for each rule above that matches the task and for each scan hit: why it matters, then incorrect vs. correct code.

References

  1. https://github.com/microsoft/TypeScript/wiki/Performance
  2. https://www.typescriptlang.org/docs/handbook/
  3. https://v8.dev/blog
  4. https://nodejs.org/en/learn/diagnostics/memory