Complete AI TrainingYourJobSkills for your job

Skills / super-code

typescript

Language-specific super-code guidelines for typescript.

TypeScript / JavaScript: Idiomatic Efficiency Reference

When to Use

  • Use this skill when the task matches this description: Language-specific super-code guidelines for typescript.

Table of Contents

  1. [Array & Object Operations](#arrays)
  2. [Destructuring & Spread](#destructuring)
  3. [Async / Promises](#async)
  4. [Functions & Closures](#functions)
  5. [TypeScript Types](#types)
  6. [React (if applicable)](#react)
  7. [Anti-patterns specific to TS/JS](#antipatterns)

1. Array & Object Operations {#arrays}

// ❌ Imperative push loop
const result: string[] = []
for (const item of items) {
    if (item.active) result.push(item.name.toUpperCase())
}

// ✅
const result = items.filter(i => i.active).map(i => i.name.toUpperCase())
// ❌ Manual reduce for sum
let total = 0
for (const o of orders) total += o.amount

// ✅
const total = orders.reduce((sum, o) => sum + o.amount, 0)
// ❌ Manual object copy + override
const updated = Object.assign({}, user)
updated.name = "Alice"

// ✅
const updated = { ...user, name: "Alice" }
// ❌ Existence check before property access
const city = user.address ? user.address.city : undefined

// ✅
const city = user.address?.city

2. Destructuring & Spread {#destructuring}

// ❌ Separate variable assignments
const name = user.name
const age = user.age

// ✅
const { name, age } = user
``

Subscribers only

The full skill, its 1 bundled files and every download is included with every paid Complete AI plan.

Details

Sourcecommunity
License
Risk labelsafe ("critical" means the skill may run commands or touch files — read before use)
FilesSKILL.md
Added2026-06-16

Related skills

bash

Language-specific super-code guidelines for bash.

c

Language-specific super-code guidelines for c.

cpp

Language-specific super-code guidelines for cpp.

csharp

Language-specific super-code guidelines for csharp.

dart

Language-specific super-code guidelines for dart.

elixir

Language-specific super-code guidelines for elixir.