moai-adk-main/.claude/skills/moai-lang-javascript/SKILL.md
Enterprise JavaScript for Node.js and browser: Node.js 22.11.0 LTS (Jod), npm 11.x, ES2025 features, async operations, module systems, package management; activates for server-side development, scripting, tooling, package management, and runtime optimization.
npx skillsauth add ajbcoding/claude-skill-eval moai-lang-javascriptInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Field | Value | | ----- | ----- | | Version | 4.0.0 Enterprise | | Created | 2025-11-12 | | Updated | 2025-11-12 | | Lines | ~950 lines | | Size | ~30KB | | Tier | 3 (Professional) | | Allowed tools | Read, Bash, WebSearch, WebFetch | | Auto-load | Node.js runtime, async operations, npm ecosystem, ES2025 features | | Trigger cues | JavaScript, Node.js, npm, async, module, ES2025, runtime, npm scripts |
Node.js 22.11.0 LTS (Jod, long-term support until 2027)
Bun 1.1.x (Alternative runtime)
Deno 2.x (Modern runtime)
npm 11.x (Default package manager)
yarn 4.x (Alternative, v4 faster)
pnpm 9.x (Efficient package management)
Express 4.21.x (Mature framework)
Fastify 5.x (Performance-focused)
Hapi 21.x (Enterprise framework)
Node.js 22 brings ES2025 features and improvements:
Basic HTTP Server:
const http = require('http');
const server = http.createServer((req, res) => {
if (req.url === '/hello') {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ message: 'Hello, World!' }));
} else {
res.writeHead(404);
res.end('Not Found');
}
});
server.listen(3000, () => {
console.log('Server running on :3000');
});
ES Modules:
// math.mjs
export function add(a, b) {
return a + b;
}
export function multiply(a, b) {
return a * b;
}
// app.mjs
import { add, multiply } from './math.mjs';
console.log(add(2, 3)); // 5
console.log(multiply(2, 3)); // 6
Async/Await Patterns:
async function fetchUserData(userId) {
try {
const response = await fetch(\`https://api.example.com/users/\${userId}\`);
if (!response.ok) {
throw new Error(\`API error: \${response.statusText}\`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Fetch failed:', error);
throw error;
}
}
async function main() {
const user = await fetchUserData(1);
console.log(user);
}
main();
npm 11 provides modern package management:
Package.json Best Practices:
{
"name": "@org/myapp",
"version": "1.0.0",
"description": "Application description",
"type": "module",
"main": "dist/index.js",
"exports": {
".": "./dist/index.js",
"./utils": "./dist/utils.js"
},
"engines": {
"node": ">=22.0.0",
"npm": ">=11.0.0"
},
"scripts": {
"dev": "node --watch src/index.js",
"build": "tsc",
"test": "vitest",
"lint": "eslint ."
},
"dependencies": {
"express": "^4.21.0",
"dotenv": "^16.0.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"vitest": "^2.0.0"
}
}
npm Scripts:
# Development
npm run dev
# Build
npm run build
# Test
npm test
# Publish
npm publish
# Audit dependencies
npm audit
npm audit fix
Express provides a lightweight web framework:
Basic Express App:
import express from 'express';
import { json } from 'express';
const app = express();
app.use(json());
// Routes
app.get('/users', (req, res) => {
res.json([
{ id: 1, name: 'John' },
{ id: 2, name: 'Jane' }
]);
});
app.post('/users', (req, res) => {
const { name } = req.body;
res.status(201).json({ id: 3, name });
});
app.get('/users/:id', (req, res) => {
const { id } = req.params;
res.json({ id: parseInt(id), name: 'User' });
});
// Error handling
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).json({ error: 'Internal Server Error' });
});
app.listen(3000, () => {
console.log('Server running on :3000');
});
Middleware:
// Logging middleware
const logger = (req, res, next) => {
console.log(\`\${req.method} \${req.path}\`);
next();
};
// Authentication middleware
const authenticateToken = (req, res, next) => {
const authHeader = req.headers['authorization'];
const token = authHeader && authHeader.split(' ')[1];
if (!token) {
return res.status(401).json({ error: 'Missing token' });
}
// Verify token...
next();
};
app.use(logger);
app.use('/api/protected', authenticateToken);
app.get('/api/protected/data', (req, res) => {
res.json({ data: 'sensitive information' });
});
Fastify is performance-focused alternative:
Fastify Setup:
import Fastify from 'fastify';
const fastify = Fastify({ logger: true });
fastify.post<{ Body: { name: string } }>('/users', async (request, reply) => {
const { name } = request.body;
return { id: 1, name };
});
fastify.get<{ Params: { id: string } }>('/users/:id', async (request, reply) => {
const { id } = request.params;
return { id: parseInt(id), name: 'User' };
});
fastify.listen({ port: 3000 }, (err, address) => {
if (err) throw err;
console.log(\`Server listening at \${address}\`);
});
Advanced Promise usage:
Promise Composition:
// Promise.all - parallel execution
async function fetchMultipleUsers() {
const [user1, user2, user3] = await Promise.all([
fetch('/api/users/1').then(r => r.json()),
fetch('/api/users/2').then(r => r.json()),
fetch('/api/users/3').then(r => r.json()),
]);
return [user1, user2, user3];
}
// Promise.race - first to complete
async function fetchWithTimeout(promise, timeout) {
return Promise.race([
promise,
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Timeout')), timeout)
),
]);
}
// Promise.allSettled - all results
async function fetchAll(urls) {
const results = await Promise.allSettled(
urls.map(url => fetch(url).then(r => r.json()))
);
return results;
}
Vitest for modern testing:
Unit Tests:
import { describe, it, expect } from 'vitest';
import { add, multiply } from './math.js';
describe('Math utils', () => {
it('should add numbers', () => {
expect(add(2, 3)).toBe(5);
});
it('should multiply numbers', () => {
expect(multiply(2, 3)).toBe(6);
});
});
Integration Tests:
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { createServer } from './server.js';
describe('API Endpoints', () => {
let server;
beforeEach(() => {
server = createServer();
});
afterEach(() => {
server.close();
});
it('GET /users returns user list', async () => {
const response = await fetch('http://localhost:3000/users');
const data = await response.json();
expect(response.ok).toBe(true);
expect(Array.isArray(data)).toBe(true);
});
});
PM2 for Process Management:
npm install -g pm2
pm2 start app.js --name "myapp"
pm2 save
pm2 startup
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["node", "src/index.js"]
// config.js
const config = {
development: {
port: 3000,
database: 'mongodb://localhost:27017/mydb',
logLevel: 'debug',
},
production: {
port: process.env.PORT || 8080,
database: process.env.DATABASE_URL,
logLevel: 'info',
},
};
const env = process.env.NODE_ENV || 'development';
export default config[env];
This Skill activates when you:
content-media
Download YouTube video transcripts when user provides a YouTube URL or asks to download/get/fetch a transcript from YouTube. Also use when user wants to transcribe or get captions/subtitles from a YouTube video.
development
Transform learning content (like YouTube transcripts, articles, tutorials) into actionable implementation plans using the Ship-Learn-Next framework. Use when user wants to turn advice, lessons, or educational content into concrete action steps, reps, or a learning quest.
tools
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.
tools
Replace with description of the skill and when Claude should use it.