AgentSkillsCN

js-ts-best-practices

当您编写 JavaScript/TypeScript 代码、实现控制流或状态管理、修复类型错误、添加校验或错误处理逻辑、优化性能(如循环、条件判断、缓存),或完善文档注释(JSDoc、代码注释)时,此技能将助您一臂之力。

SKILL.md
--- frontmatter
name: js-ts-best-practices
description: Use when writing JavaScript/TypeScript code, implementing control flow or state management, fixing type errors, adding validation or error handling, optimizing performance (loops, conditionals, caching), or improving documentation (JSDoc, comments).
license: Apache-2.0
metadata:
  author: gohypergiant
  version: "1.4"

JavaScript and TypeScript Best Practices

Comprehensive coding standards and performance optimization guide for JavaScript and TypeScript applications, designed for AI agents and LLMs working with modern JavaScript/TypeScript codebases.

When to Use This Skill

This skill provides expert-level patterns for JavaScript and TypeScript code. Load AGENTS.md to scan rule summaries and identify relevant optimizations for your task.

How to Use

This skill uses a progressive disclosure structure to minimize context usage:

1. Start with the Overview (AGENTS.md)

Read AGENTS.md for a concise overview of all rules with one-line summaries organized by category.

2. Load Specific Rules as Needed

When you identify a relevant pattern or issue, load the corresponding reference file for detailed implementation guidance:

Quick Start:

  • quick-start.md - Complete workflow examples with before/after code

General Best Practices:

TypeScript:

Safety:

Performance:

Documentation:

3. Apply the Pattern

Each reference file contains:

  • ❌ Incorrect examples showing the anti-pattern
  • ✅ Correct examples showing the optimal implementation
  • Explanations of why the pattern matters