Skip to content
sergiodxa avatar

Frontend Js Best Practices

JavaScript and TypeScript performance and style rules covering loops, data structures, caching, and DOM access.

CCM score
52 of 100
skills.sh installs
341
GitHub stars
92
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers 17 rules for reducing unnecessary computation, optimizing data structures, and keeping consistent conventions
  • Includes patterns for Set/Map lookups, hoisted RegExp, cached property access, and batched DOM reads and writes
  • Enforces no default exports, no as type casts in favor of Zod or type guards, and toSorted() over sort()
  • Designed for writing, reviewing, or refactoring JS/TS code in hot paths and general optimization work

Install

$ npx -y skills add sergiodxa/agent-skills --skill frontend-js-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

JavaScript Best Practices

Performance optimization and code style patterns for JavaScript and TypeScript code. Contains 17 rules focused on reducing unnecessary computation, optimizing data structures, and maintaining consistent conventions.

When to Apply

Reference these guidelines when:

  • Writing loops or array operations
  • Working with data structures (Map, Set, arrays)
  • Manipulating the DOM directly
  • Caching values or function results
  • Optimizing hot code paths
  • Declaring variables or functions

Rules Summary

const-let-usage (MEDIUM) — @rules/const-let-usage.md

Use const at module level, let inside functions.

// Module level: const with UPPER_SNAKE_CASE for primitives
const MAX_RETRIES = 3;
const userCache = new Map<string, User>();

// Inside functions: always let
function process(items: Item[]) {
  let total = 0;
  let result = [];
  for (let item of items) {
    total += item.price;
  }
  return { total, result };
}

function-declarations (MEDIUM) — @rules/function-declarations.md

Prefer function declarations over arrow functions for named functions.

Details

Repository
github.com/sergiodxa/agent-skills
Categories
Frontend & UI Code, Code Review & Quality
First seen
Jun 3, 2026

Questions

What does the frontend-js-best-practices skill do?

It gives Claude 17 rules for JavaScript and TypeScript performance and code style, covering loops, Map and Set lookups, caching, DOM batching and variable declarations. The rules cut unnecessary computation and keep code conventions consistent. Claude applies them when writing, reviewing or refactoring code.

How do I install frontend-js-best-practices?

Run npx -y skills add sergiodxa/agent-skills --skill frontend-js-best-practices -y in your project. The command adds this skill from the sergiodxa/agent-skills repository. After that, Claude can follow its JavaScript performance rules in that project.

Which other skills lead the Frontend & UI Code category?

Frontend & UI Code includes vercel-react-best-practices, web-design-guidelines, design-taste-frontend, vercel-composition-patterns and lark-apps. This skill focuses on JavaScript and TypeScript performance patterns rather than React, design or UI composition. It suits code-level optimization work.

When should I use this skill while coding?

Use it when writing loops, array operations, DOM manipulation or caching logic in JavaScript or TypeScript. It also helps when you refactor hot code paths or review code for optimal patterns. The skill triggers on these tasks automatically.

More from sergiodxa/agent-skills

All 10

Similar to Frontend Js Best Practices

More Frontend & UI Code