javascript-best-practices

Modern JavaScript best practices and performance optimization guidelines. Use when writing, reviewing, or refactoring JavaScript code to ensure optimal performance, maintainability, and modern patterns.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "javascript-best-practices" with this command: npx skills add blackbytessa/agent-skills/blackbytessa-agent-skills-javascript-best-practices

JavaScript Best Practices

Comprehensive guide for modern JavaScript development covering performance, code quality, and best practices.

When to Apply

Reference these guidelines when:

  • Writing new JavaScript code
  • Reviewing code for performance or quality issues
  • Refactoring existing JavaScript code
  • Optimizing application performance
  • Ensuring code maintainability

Rule Categories by Priority

PriorityCategoryImpactPrefix
1PerformanceCRITICALperf-
2Async PatternsHIGHasync-
3Error HandlingHIGHerror-
4Code QualityHIGHquality-
5Modern SyntaxMEDIUMmodern-
6ArraysMEDIUMarray-

Quick Reference

1. Performance (CRITICAL)

  • perf-avoid-memory-leaks - Always cleanup event listeners, timers, intervals, subscriptions, and observers

2. Async Patterns (HIGH)

  • async-promise-chains - Prefer async/await over .then()/.catch() chains for better readability

3. Error Handling (HIGH)

  • error-defensive-programming - Use guard clauses and validate input at system boundaries
  • error-explicit-validation - Don't hide data errors with optional chaining - validate explicitly

4. Code Quality (HIGH)

  • quality-strict-equality - Use === instead of == (except for null checks)
  • quality-explicit-boolean-checks - Don't rely on truthy/falsy for non-boolean values
  • quality-small-functions - Keep functions focused on one task (5-15 lines ideal)
  • quality-no-magic-numbers - Extract numbers to named constants
  • quality-immutability - Prefer creating new objects/arrays over mutating existing ones
  • quality-pure-functions - Write functions with no side effects when possible
  • quality-naming-conventions - Use meaningful, consistent names (camelCase, PascalCase, UPPER_SNAKE_CASE)
  • quality-commenting - Comments explain "why", not "what" - code should be self-documenting
  • quality-avoid-console-log - Use structured logging with levels in production

5. Modern Syntax (MEDIUM)

  • modern-const-let-no-var - Never use var; prefer const, use let only when reassignment is needed

6. Arrays (MEDIUM)

  • array-mutation-safety - Avoid in-place mutations (push, sort, reverse) on shared arrays

How to Use

Read individual rule files for detailed explanations and code examples:

rules/perf-avoid-memory-leaks.md
rules/async-promise-chains.md
rules/error-defensive-programming.md
rules/quality-strict-equality.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

vercel-react-best-practices

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

Repository Source
213.6K23Kvercel
Coding

svelte5-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

apify-actor-development

No summary provided by upstream source.

Repository SourceNeeds Review
2.1K-apify
Coding

code-simplifier

No summary provided by upstream source.

Repository SourceNeeds Review