Agent skill · Backend & API

nodejs-patterns

Async control flow, error handling, module design, streams, and production hardening

Cosmic Stack3,294★ · 2 repos on radarProfile →
claude-codeMIT
Install
npx skills add cosmicstack-labs/mercury-agent-skills --skill nodejs-patterns --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Version: 1.0.0
Declared author: cosmicstack-labs
Path: categories/backend/nodejs-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 364
Language: JavaScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Node.js Patterns Production-grade Node.js backend patterns. ## Async Patterns ### Prefer Async/Await ```javascript // Good async function getUser(id) { const user = await db.findUser(id); return user; } // Avoid raw callbacks or.then() chains ``` ### Parallel Execution ```javascript // Sequential (slow) const user = await fetchUser(id); const posts = await fetchPosts(id); // Parallel (fast) const [user, posts] = await Promise.all([ fetchUser(id), fetchPosts(id), ]); ``` ## Error Handling ### Global Handler ```javascript process.on('uncaughtException', (err) => { console.error('Uncaught:', err); // Graceful shutdown server.close(() => process.exit(1)); }); process.on('unhandledRejection', (reason) => { console.error('Unhandled Rejection:', reason); }); ``` ### Express Error Middleware ```javascript app.use((err, req, res, next) => { const status = err.status || 500; res.status(status).json({ error: err.message, ...(process.env.NODE_ENV === 'development' && { stack: err.stack }), }); }); ``` ## Module Design - Single responsibility per module - Export a class or factory function, not plain objects - Use dependency injection for testability - Prefer CommonJS (require) or ESM (import

What's inside
Steps it walks through
  1. Async Patterns
  2. Prefer Async/Await
  3. Parallel Execution
  4. Error Handling
  5. Global Handler
  6. Express Error Middleware
  7. Module Design
  8. Production Hardening
More from mercury-agent-skills
All skills →
About this skill
What does the nodejs-patterns skill do?

Async control flow, error handling, module design, streams, and production hardening

How do I install it?

Run `npx skills add cosmicstack-labs/mercury-agent-skills --skill nodejs-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From cosmicstack-labs/mercury-agent-skills, a repository with 364 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going