Idiomatic JavaScript patterns and conventions for maintainable code.
Conventions and patterns for writing maintainable JavaScript.
camelCase (vars/funcs), PascalCase (classes), UPPER_SNAKE (constants).Error objects only. Handle all async errors.index.js for exports.const.// Constants
const STATUS = { OK: 200, ERROR: 500 };
// Errors
class APIError extends Error {
constructor(msg, code) {
super(msg);
this.code = code;
}
}
// Async + JDoc
/** @throws {APIError} */
export async function getData(id) {
if (!id) throw new APIError('Missing ID', 400);
const res = await fetch(`/api/${id}`);
if (!res.ok) throw new APIError('Failed', res.status);
return res.json();
}For module patterns and project structure: See references/REFERENCE.md.
language | tooling
19a1140
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.