Best practices

From Mte90/dotfiles · View interactive version

Best practices is an AI agent skill from the GitHub repository Mte90/dotfiles. Idiomatic JavaScript patterns and conventions for maintainable code.

How to use this skill

Skill file

JavaScript Best Practices

**Priority: P1 (OPERATIONAL)**

Conventions and patterns for writing maintainable JavaScript.

Implementation Guidelines

Anti-Patterns

Code

// 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();
}

Reference & Examples

For module patterns and project structure:

See references/REFERENCE.md.

Related Topics

language | tooling

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.