js-best-practices

Apply JavaScript and TypeScript performance best practices during code review or refactoring.

Updated Feb 1, 2026
One-click install
npx skills add https://github.com/vfshera/agent-skills --skill js-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: js-best-practices
Source: https://github.com/vfshera/agent-skills/tree/main/skills/js-best-practices
Command: npx skills add https://github.com/vfshera/agent-skills --skill js-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides clear JavaScript and TypeScript performance guidelines to help developers write faster, more maintainable code.

Core Features & Use Cases

  • Guidelines cover loops, data structures, DOM manipulation, caching, and immutability to reduce overhead and improve runtime performance.
  • Use cases include reviewing or refactoring code to optimize hot paths and align with best practices like const-let usage, hoisting, and avoiding default exports.

Quick Start

Scan your codebase for common patterns and apply the recommended improvements across modules to realize measurable performance gains.

Frequently Asked Questions about js-best-practices

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

FAQPage Schema
How do I optimize JavaScript performance when refactoring existing code?

To optimize JavaScript performance, apply best practices for loops, data structures, and DOM manipulation. Refactoring hot paths using const-let usage, hoisting regexps, and batch DOM CSS updates reduces runtime overhead and improves efficiency.

What are the best practices for direct DOM manipulation in JavaScript?

Best practices for direct DOM manipulation include batching CSS updates and applying caching strategies. This minimizes layout thrashing and reduces the runtime overhead associated with frequent document changes during code execution.

Does using const and let instead of var actually improve JavaScript performance?

Using const and let improves code maintainability and enforces block scoping, which helps engines optimize execution. While primarily a code-quality rule, consistent const-let usage prevents hoisting issues and supports better runtime efficiency.

How do I optimize JavaScript loops and data structures for faster execution?

Optimize JavaScript loops and data structures by applying caching strategies and selecting efficient storage patterns. This reduces iteration overhead and memory footprint, leading to measurable runtime performance gains in critical paths.

Can I use these JavaScript performance guidelines for TypeScript codebases?

Yes, these performance guidelines apply directly to TypeScript codebases. The rules cover TypeScript optimization techniques including avoiding default exports, enforcing const-let usage, and applying structural improvements during code reviews.

Why should I avoid default exports when optimizing JavaScript code?

Avoiding default exports is a code-quality best practice that improves module maintainability and predictability. It enforces explicit naming conventions, which helps static analysis tools and optimizers process modules more effectively.