javascript-pro
jeffallan/claude-skills
Write, debug, and refactor modern JavaScript using ES2023+, async/await, and Node.js best practices.
What is javascript-pro?
JavaScript Pro handles vanilla JavaScript development with ES2023+ syntax, async/await patterns, ESM modules, and Node.js APIs. Use it when building JavaScript applications, optimizing performance, implementing async flows, or reviewing code for correctness and best practices.
- Writes ES2023+ JavaScript with proper async/await and Promise handling
- Debugs and refactors code for memory leaks, performance, and correctness
- Implements ESM and CommonJS module systems with proper exports
- Develops Node.js backend services using fs/promises, streams, and worker threads
- Works with browser APIs including Fetch, Web Workers, Service Workers, and Storage
- Validates code with linting, testing (85%+ coverage), and bundle analysis
How to install javascript-pro
npx skills add https://github.com/jeffallan/claude-skills --skill javascript-proHow to use javascript-pro
- 1.Review package.json and confirm module system (ESM/CJS) and Node version target
- 2.Analyze requirements and plan module architecture with async flows
- 3.Write code using ES2023+ features, async/await, and optional chaining patterns
- 4.Run eslint --fix and resolve all linting issues before proceeding
- 5.Check for memory leaks using DevTools or --inspect flag; resolve any found
- 6.Write comprehensive tests with Jest targeting 85%+ coverage; add missing test cases if needed
- 7.Verify no unhandled Promise rejections and confirm bundle size acceptable
Use cases
- Building vanilla JavaScript applications with modern syntax and patterns
- Implementing Promise-based async flows with proper error handling
- Optimizing browser performance and detecting memory leaks with DevTools
- Developing Node.js backend services with async I/O and streams
- Reviewing .js/.mjs/.cjs files for ES2023+ compliance and best practices
- JavaScript developers building vanilla applications
- Node.js backend engineers
- Frontend developers optimizing performance
- Code reviewers ensuring modern standards
- Full-stack developers working with ESM modules
javascript-pro FAQ
Use ESM (import/export) for new projects. Only use CommonJS (.cjs) for legacy Node.js projects or when required by dependencies. Do not mix both in the same module.
Always wrap async operations in try/catch blocks. Check response.ok for fetch calls and throw errors explicitly. Return null or a default value on failure rather than letting rejections propagate unhandled.
Use async/await for all asynchronous operations. Promises are acceptable but async/await is preferred for readability and error handling.
Use DevTools or Node.js --inspect flag to profile memory. Avoid retaining large objects, properly clean up event listeners, and ensure Web Workers are terminated when no longer needed.
Aim for 85%+ code coverage with Jest. Add tests for error cases, edge conditions, and async flows. Ensure all Promise rejections are handled in tests.
Full instructions (SKILL.md)
Source of truth, from jeffallan/claude-skills.
name: javascript-pro description: Writes, debugs, and refactors JavaScript code using modern ES2023+ features, async/await patterns, ESM module systems, and Node.js APIs. Use when building vanilla JavaScript applications, implementing Promise-based async flows, optimising browser or Node.js performance, working with Web Workers or Fetch API, or reviewing .js/.mjs/.cjs files for correctness and best practices. license: MIT metadata: author: https://github.com/Jeffallan version: "1.1.0" domain: language triggers: JavaScript, ES2023, async await, Node.js, vanilla JavaScript, Web Workers, Fetch API, browser API, module system role: specialist scope: implementation output-format: code related-skills: fullstack-guardian
JavaScript Pro
When to Use This Skill
- Building vanilla JavaScript applications
- Implementing async/await patterns and Promise handling
- Working with modern module systems (ESM/CJS)
- Optimizing browser performance and memory usage
- Developing Node.js backend services
- Implementing Web Workers, Service Workers, or browser APIs
Core Workflow
- Analyze requirements — Review
package.json, module system, Node version, browser targets; confirm.js/.mjs/.cjsconventions - Design architecture — Plan modules, async flows, and error handling strategies
- Implement — Write ES2023+ code with proper patterns and optimisations
- Validate — Run linter (
eslint --fix); if linter fails, fix all reported issues and re-run before proceeding. Check for memory leaks with DevTools or--inspect, verify bundle size; if leaks are found, resolve them before continuing - Test — Write comprehensive tests with Jest achieving 85%+ coverage; if coverage falls short, add missing cases and re-run. Confirm no unhandled Promise rejections
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Modern Syntax | references/modern-syntax.md | ES2023+ features, optional chaining, private fields |
| Async Patterns | references/async-patterns.md | Promises, async/await, error handling, event loop |
| Modules | references/modules.md | ESM vs CJS, dynamic imports, package.json exports |
| Browser APIs | references/browser-apis.md | Fetch, Web Workers, Storage, IntersectionObserver |
| Node Essentials | references/node-essentials.md | fs/promises, streams, EventEmitter, worker threads |
Constraints
MUST DO
- Use ES2023+ features exclusively
- Use
X | nullorX | undefinedpatterns - Use optional chaining (
?.) and nullish coalescing (??) - Use async/await for all asynchronous operations
- Use ESM (
import/export) for new projects - Implement proper error handling with try/catch
- Add JSDoc comments for complex functions
- Follow functional programming principles
MUST NOT DO
- Use
var(always useconstorlet) - Use callback-based patterns (prefer Promises)
- Mix CommonJS and ESM in the same module
- Ignore memory leaks or performance issues
- Skip error handling in async functions
- Use synchronous I/O in Node.js
- Mutate function parameters
- Create blocking operations in the browser
Key Patterns with Examples
Async/Await Error Handling
// ✅ Correct — always handle async errors explicitly
async function fetchUser(id) {
try {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return await response.json();
} catch (err) {
console.error("fetchUser failed:", err);
return null;
}
}
// ❌ Incorrect — unhandled rejection, no null guard
async function fetchUser(id) {
const response = await fetch(`/api/users/${id}`);
return response.json();
}
Optional Chaining & Nullish Coalescing
// ✅ Correct
const city = user?.address?.city ?? "Unknown";
// ❌ Incorrect — throws if address is undefined
const city = user.address.city || "Unknown";
ESM Module Structure
// ✅ Correct — named exports, no default-only exports for libraries
// utils/math.mjs
export const add = (a, b) => a + b;
export const multiply = (a, b) => a * b;
// consumer.mjs
import { add } from "./utils/math.mjs";
// ❌ Incorrect — mixing require() with ESM
const { add } = require("./utils/math.mjs");
Avoid var / Prefer const
// ✅ Correct
const MAX_RETRIES = 3;
let attempts = 0;
// ❌ Incorrect
var MAX_RETRIES = 3;
var attempts = 0;
Output Templates
When implementing JavaScript features, provide:
- Module file with clean exports
- Test file with comprehensive coverage
- JSDoc documentation for public APIs
- Brief explanation of patterns used
Related skills
More from jeffallan/claude-skills and the wider catalog.
laravel-specialist
Build Laravel 10+ applications with Eloquent models, Sanctum auth, queues, APIs, and Livewire components.
golang-pro
Senior Go developer for concurrent systems, microservices, and production-grade performance optimization.
flutter-expert
Senior Flutter engineer for cross-platform apps with Riverpod, Bloc, GoRouter, and performance optimization.
php-pro
Senior PHP developer for modern PHP 8.3+, Laravel, Symfony with strict typing, PHPStan level 9, and enterprise patterns.
kubernetes-specialist
Deploy and manage Kubernetes workloads with secure manifests, RBAC, networking, and troubleshooting.
devops-engineer
Creates Dockerfiles, CI/CD pipelines, Kubernetes manifests, and infrastructure-as-code templates for deployment automation.