Skip to content

Prefer const and let over var

Reviews and rewrites JavaScript to replace var with const or let, explaining scope and hoisting fixes.

Stars
74,632
Licence
MIT
Files
2 files

What it does

When installed, the agent gets a checklist-style guide for a common JavaScript best practice: replacing the old var keyword with const (for values that never change) or let (for values that do). Asked to check a file, it flags every var with line numbers, rewrites them, and explains the scope, hoisting, and temporal dead zone reasons behind the change. It also reviews scripts and browser-side code for related issues and suggests how to verify fixes in a browser.

Great for

  • Developers cleaning up older JavaScript that still uses var
  • Students learning the difference between var, let, and const
  • Code reviewers who want a consistent checklist for this rule

Skip it if

  • Projects that need a full, automated linter run; the skill reviews by reading code, not by running tooling, so it may miss occurrences in large codebases
  • Reviews of performance bottlenecks or bugs in code that does not use var; the browser-review instructions are broad and can produce generic advice

Try asking

  • “Check this JavaScript file for any var declarations and list them with line numbers.”
  • “Replace all var declarations in this script with const or let as appropriate.”
  • “Explain why const and let are preferred over var, including the temporal dead zone.”
  • “Review this client component for code that violates the const/let rule and suggest how to verify the change in the browser.”
Step-by-step guide: how to use Prefer const and let over varInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 2 original files, the MIT licence and an attribution note.

    const-let.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip const-let.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip const-let.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Paste or point to the specific file so the agent can give exact line numbers for var uses.
  • Ask for a before-and-after diff so you can review each change before accepting it.
  • Remember that const prevents reassignment but not mutation of objects and arrays; check that your intent matches.

What's inside

  • references/rule.md
  • SKILL.md

Redistributed unmodified from thedaviddias/Front-End-Checklist under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.