Javascript Pro

Writes, debugs, and refactors JavaScript code using modern ES2023+ features, async/await patterns, ESM module systems, and Node.js APIs.

Development / Languagesdevelopmentlanguages
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptThis async function sometimes returns undefined. Why?
Beforegeneric AI agent
Async functions returning undefined usually means something isn't being awaited or returned properly. Common causes:

- Forgetting to return the value from the async function
- Not awaiting a Promise inside the function
- A race condition where the value isn't ready yet
- An error being swallowed by a try/catch

I'd check whether every Promise is awaited and whether the function actually returns the result. Adding some logging can help trace where the value gets lost.

Can you share the function?
Afterwith Javascript Pro
Undefined from an async function is almost always one of three bugs.
Diagnose in this order:

1. MISSING RETURN INSIDE .then / callback
   const get = async () => { fetchData().then(d => d.value) }
   The arrow returns nothing; the .then result is discarded. Fix: await
   and return, or return the chain.

2. FORGOTTEN await ON A NESTED CALL
   const x = getUser()  // returns a Promise, not a user
   x.name is undefined because x is a pending Promise. await it.

3. forEach WITH async — the silent one
   arr.forEach(async i => { results.push(await f(i)) })
   forEach ignores the returned Promises; the function moves on before
   any push happens. This is the single most common cause.
   Fix: for...of with await, or Promise.all(arr.map(f)).

MODERN FIX FOR #3
  const results = await Promise.all(arr.map(f))
  Runs them concurrently AND waits for all — forEach does neither.

THE DEBUGGING MOVE
Log typeof at the return: a "object" that's actually a Promise (has a
.then) tells you it's a missing await, not a missing value. A genuine
undefined tells you it's a missing return.

Paste the function and I'll point at the exact line.

About this skill


name: javascript-pro description: Use when Writes, debugs, and refactors JavaScript code using modern ES2023+ features, async/await patterns, ESM module systems, and Node.js APIs.

Javascript Pro

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.

What you get

  • Public GitHub repo
  • the skills/javascript-pro folder with SKILL.md and references.

Customize your output

  • Fork the repo and extend the skill's reference files for your own stack conventions.

Example output

Activates on a matching request (e.g. building or reviewing Javascript Pro code) and can chain with other skills in the pack.

Best for

Full-stack developers and engineering teams using Claude Code.

SKILL.md preview

SKILL.md
---
name: javascript-pro
description: Use this skill when writing, debugging, or refactoring JavaScript using modern ES2023+ features, async/await patterns, ESM modules, and Node.js APIs.
version: 1.0.0
category: Development / Languages
author: AgentVolt
license: proprietary
tags:
  - development
  - languages
---

# Javascript Pro

Writes and refactors modern JavaScript using current ES features, correct async patterns, ESM conventions, and Node.js APIs, reviewing .js/.mjs/.cjs files for correctness and idiomatic style.

## When to use

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →