javascript-idioms
Installation
SKILL.md
JavaScript Idioms and Patterns
Modern JavaScript (ES2024+) rewards modules, async/await, and functional patterns. Idiomatic JS = strict mode, modular, well-tested.
Scope: Plain JavaScript only — projects with no
tsconfig.json. This skill is intentionally thin: most JS guidance (coercion traps, async pitfalls, scope bugs, security, collections, performance) is shared with TypeScript and lives in one place to avoid divergence.Loading guards:
- If
tsconfig.jsonexists, do NOT load this skill — load@.agents/skills/typescript-idioms/SKILL.mdinstead. TypeScript is preferred whenever available.- Coercion / async / scope / security / collection / performance pitfalls: see
@.agents/skills/typescript-idioms/references/ts-patterns-and-anti-patterns.md— despite the filename, it is scoped to "TypeScript/JavaScript" and covers runtime pitfalls that apply to plain JS verbatim.- Project layout: see
@.agents/skills/typescript-idioms/references/project-structure.md(the generic backend/library/monorepo layouts are language-level, not TS-only).
Module System
- ES modules over CommonJS for all new code:
// ✅ ESM import { createTask } from './task-service.js'; export function handler(req, res) { ... }