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
- [Array & Object Operations](#arrays)
- [Destructuring & Spread](#destructuring)
- [Async / Promises](#async)
- [Functions & Closures](#functions)
- [TypeScript Types](#types)
- [React (if applicable)](#react)
- [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
| Source | community |
|---|---|
| License | — |
| Risk label | safe ("critical" means the skill may run commands or touch files — read before use) |
| Files | SKILL.md |
| Added | 2026-06-16 |
