javascript

Enforce JavaScript and TypeScript coding standards with promise best practices.

16|1|Updated Jun 26, 2025
One-click install
npx skills add https://github.com/bendrucker/claude --skill javascript
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: javascript
Source: https://github.com/bendrucker/claude/tree/main/.claude/skills/javascript
Command: npx skills add https://github.com/bendrucker/claude --skill javascript

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill promotes modern JavaScript best practices, particularly around promise handling, to ensure cleaner, more reliable asynchronous code.

Core Features & Use Cases

  • Promise Best Practices: Guides on using existing promise-returning APIs instead of manual new Promise construction, reducing boilerplate and potential errors.
  • Consistent Standards: Applies to both JavaScript and TypeScript, ensuring a unified approach to coding.
  • Use Case: When integrating with an asynchronous API, this Skill helps you write concise and robust promise-based code, avoiding common pitfalls and improving code readability.

Quick Start

// Avoid: // new Promise((resolve, reject) => { // fs.readFile('file.txt', (err, data) => { // if (err) reject(err); // resolve(data); // }); // });

// Prefer: import { promises as fs } from 'fs'; fs.readFile('file.txt'); // Returns a promise directly

Frequently Asked Questions about javascript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What's the best way to handle promises in JavaScript instead of using new Promise?

Use promise-returning APIs directly instead of wrapping callbacks in `new Promise`. For example, use `fs.promises.readFile()` instead of manually constructing a Promise around `fs.readFile()`. This reduces boilerplate, improves readability, and avoids common error-handling pitfalls in asynchronous code.

How do I enforce JavaScript and TypeScript coding standards across my codebase?

Apply consistent coding standards to both JavaScript and TypeScript files by enforcing modern best practices, including proper promise handling, async/await patterns, and established conventions. This ensures unified code quality across your entire project, whether you're writing or reviewing code.

Can I apply these JavaScript best practices to TypeScript as well?

Yes. These coding standards and best practices apply to both JavaScript and the JavaScript-subset of TypeScript, ensuring consistent promise handling, async/await usage, and coding conventions across both languages in your codebase.

When should I avoid constructing new Promise instances?

Avoid `new Promise` when an existing API already returns a promise. Manual Promise construction adds unnecessary boilerplate and increases the risk of improper error handling. Modern Node.js APIs like `fs.promises` and most third-party libraries return promises directly, making manual wrapping redundant.

How do I integrate async APIs into my JavaScript code cleanly?

Chain promise-returning APIs using async/await or `.then()` syntax instead of nesting callbacks or manually constructing Promises. This approach produces concise, readable asynchronous code that adheres to modern JavaScript standards and handles errors predictably.