modern-javascript
Installation
SKILL.md
Modern JavaScript
Use current JavaScript without confusing specification status, runtime support, and toolchain support. Treat these as three separate questions:
- Is it standardized? Check the frozen annual ECMA-262 edition or TC39's current proposal tracker.
- Does the target run it? Check the project's declared Node/browser targets and current compatibility data.
- Can tooling bridge the gap? Syntax may need a transform; built-ins need a polyfill. One does not imply the other.
Workflow
- Inspect
package.json(engines,browserslist, dependencies), runtime/deployment config,tsconfig.json, and Babel/bundler config. Do not invent a baseline. - Select the simplest standardized feature supported by that baseline.
- For a newer standard or mature proposal, state the required runtime, transform, or polyfill in the implementation or handoff.
- Preserve observable behavior while modernizing: mutation, evaluation order, iterator consumption, concurrency, cancellation, property descriptors, and error propagation matter more than shorter syntax.
- Run the project's formatter, type-checker, linter, and tests. Exercise both the native path and compatibility path when both ship.
Read references/COMPATIBILITY.md whenever support is uncertain, the feature is newer than ES2023, or a proposal is involved.