JavaScript Best Practices

Enforce idiomatic JavaScript patterns and conventions for maintainable code.

51|6|Updated Mar 28, 2019
One-click install
npx skills add https://github.com/Mte90/dotfiles --skill javascript-best-practices-mte90
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: JavaScript Best Practices
Source: https://github.com/Mte90/dotfiles/tree/main/.config/opencode/skills/javascript/best-practices
Command: npx skills add https://github.com/Mte90/dotfiles --skill javascript-best-practices-mte90

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more idiomatic, maintainable, and robust JavaScript code by enforcing best practices and conventions.

Core Features & Use Cases

  • Code Quality: Adheres to established naming conventions, error handling, and module patterns.
  • Maintainability: Promotes clear code structure, reducing complexity and improving readability.
  • Use Case: Ensure consistency across a large JavaScript codebase by applying these guidelines to all new modules and functions.

Quick Start

Apply JavaScript best practices to the provided code snippet.

Frequently Asked Questions about JavaScript Best Practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write more maintainable JavaScript code?

Maintainable JavaScript code requires enforcing idiomatic patterns, consistent naming conventions, clear module organization, and robust error handling. This approach reduces complexity and improves readability across large codebases.

What are the best practices for ES6 module organization?

ES6 module organization best practices involve adhering to established naming conventions and clear code structure. Proper module patterns reduce complexity and ensure consistency when managing asynchronous operations and dependencies.

How should I handle errors in asynchronous JavaScript operations?

Error handling in asynchronous JavaScript operations requires applying specific best practices for error management within ES6 modules. This ensures robust code execution and prevents unhandled promise rejections or callback failures.

What common JavaScript anti-patterns should I avoid?

JavaScript anti-patterns that hurt code quality include inconsistent naming conventions and poorly structured modules. Avoiding these patterns and enforcing idiomatic conventions improves overall code maintainability and reduces complexity.

Can I use these JavaScript conventions for an existing codebase?

These JavaScript conventions can be applied to existing codebases by enforcing guidelines on all new modules and functions. This ensures consistency and gradually improves the overall quality and maintainability of the project.