sergiodxa avatar

Frontend Js Best Practices

A solid collection of 17 performance-focused rules for JavaScript and TypeScript that Claude will apply when you're writing or reviewing code. The guidelines cover the usual suspects like preferring Set/Map over array includes, caching expensive lookups, and batching DOM operations, plus some opinionated style choices like function declarations over arrows and named exports only. Each rule includes severity ratings and practical before/after examples. It's designed to trigger automatically when you're working with loops, data structures, or DOM manipulation. Not groundbreaking advice, but having these patterns codified means you won't bikeshed the same optimization questions on every code review.

skills.sh installs
336
GitHub stars
92
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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.

Sponsors

Details

Repository
github.com/sergiodxa/agent-skills
Categories
Frontend Development, Documentation, Code Review & Quality, AI & Agent Building, Debugging
First seen
Jun 3, 2026

More from sergiodxa/agent-skills

All 10
1wsimmonds avatarnextjs-advanced-routingwsimmonds/claude-nextjs-skillsGuide for advanced Next.js App Router patterns including Route Handlers, Parallel Routes, Intercepting Routes, Server Actions, error boundaries, draft mode, and336skills.sh installs
2secondsky avatarbun-nuxtsecondsky/claude-skillsUse when running Nuxt 3 with Bun runtime, building Vue/Nuxt apps with Bun, or configuring Nuxt projects to use Bun for development and production.323skills.sh installs
3patricio0312rev avatartailwind-gradient-builderpatricio0312rev/skillsCreates modern CSS gradients using Tailwind CSS including linear, radial, conic, mesh gradients, animated gradients, glassmorphism, and gradient text effects. U318skills.sh installs
4patricio0312rev avatarfrontend-refactor-plannerpatricio0312rev/skillsCreates safe refactor plans for messy UI code including component splitting strategies, state simplification, performance optimizations, and accessibility impro317skills.sh installs
5pproenca avatartailwind-refactorpproenca/dot-skillsTailwind CSS code refactoring patterns for v4 migration and anti-pattern cleanup. This skill should be used when refactoring Tailwind utility classes, migrating314skills.sh installs
6wsimmonds avatarnextjs-dynamic-routes-paramswsimmonds/claude-nextjs-skillsGuide for Next.js App Router dynamic routes and pathname parameters. Use when building pages that depend on URL segments (IDs, slugs, nested paths), accessing t304skills.sh installs