javascript
JavaScript ES6+ programming including async/await, DOM manipulation, modules, and Node.js. Use for .js files and web development.
Best use case
javascript is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
JavaScript ES6+ programming including async/await, DOM manipulation, modules, and Node.js. Use for .js files and web development.
Teams using javascript should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/javascript/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How javascript Compares
| Feature / Agent | javascript | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
JavaScript ES6+ programming including async/await, DOM manipulation, modules, and Node.js. Use for .js files and web development.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# JavaScript
Modern JavaScript development with ES6+ features, async patterns, and best practices.
## When to Use
- Working with `.js` files in web or Node.js projects
- Implementing async/await patterns and promises
- DOM manipulation and event handling
- Building frontend applications
## Quick Start
```javascript
// Modern async function with error handling
async function fetchData(url) {
try {
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return await response.json();
} catch (error) {
console.error("Fetch failed:", error);
throw error;
}
}
```
## Core Concepts
### Destructuring & Spread
```javascript
// Object destructuring with defaults
const { name, age = 18, ...rest } = user;
// Array destructuring
const [first, second, ...remaining] = items;
// Spread for immutable updates
const updated = { ...user, name: "New Name" };
const combined = [...array1, ...array2];
```
### Optional Chaining & Nullish Coalescing
```javascript
// Safe property access
const city = user?.address?.city;
const firstItem = items?.[0];
const result = callback?.();
// Nullish coalescing (null/undefined only)
const value = input ?? defaultValue;
// Logical assignment
user.name ??= "Anonymous";
user.permissions ||= [];
```
## Common Patterns
### Async/Await Best Practices
**Problem**: Managing multiple async operations efficiently.
**Solution**:
```javascript
// Parallel execution
async function fetchAllData(ids) {
const promises = ids.map((id) => fetchData(id));
return Promise.all(promises);
}
// Sequential with error handling
async function processItems(items) {
const results = [];
for (const item of items) {
try {
results.push(await processItem(item));
} catch (error) {
results.push({ error: error.message, item });
}
}
return results;
}
// AbortController for cancellation
async function fetchWithTimeout(url, ms = 5000) {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), ms);
try {
return await fetch(url, { signal: controller.signal });
} finally {
clearTimeout(timeout);
}
}
```
### Modules
```javascript
// Named exports (preferred)
export const API_URL = "https://api.example.com";
export function fetchUser(id) {
/* ... */
}
export class UserService {
/* ... */
}
// Re-exports
export { default as Button } from "./Button.js";
export * from "./utils.js";
// Dynamic imports
const module = await import(`./features/${feature}.js`);
```
## Best Practices
**Do**:
- Use `const` by default, `let` when reassignment needed
- Use optional chaining (`?.`) for safe property access
- Use `Promise.allSettled()` for independent async operations
- Use named exports for better tree-shaking
**Don't**:
- Use `var` (prefer `const`/`let`)
- Use `== ` for comparison (use `===`)
- Nest callbacks deeply (use async/await)
- Mutate arrays/objects directly (use spread/map/filter)
## Troubleshooting
| Error | Cause | Solution |
| ----------------------------------- | ------------------------------------------- | ------------------------------------- |
| `Cannot read property of undefined` | Accessing nested property on null/undefined | Use optional chaining `?.` |
| `Uncaught (in promise)` | Unhandled promise rejection | Add `.catch()` or try/catch |
| `X is not a function` | Calling undefined method | Check if method exists before calling |
## References
- [MDN JavaScript Guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide)
- [JavaScript.info](https://javascript.info/)Related Skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.
turbopack
Turbopack Rust-powered bundler. Use for fast builds.