Skip to content
Back to skills

Javascript Best Practices

ASecurity

Idiomatic JavaScript patterns and conventions for maintainable existing code. Use when reviewing or refactoring JavaScript language patterns; defer project scaffolding, dependency setup, and tool configuration.

  • 24 stars
  • 0 votes
  • 4 copies
  • 23 views
  • Added September 4, 2026
code-qualityjavascriptjavarefactoringapi

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill javascript-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Javascript Best Practices?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Javascript Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-javascript-best-practices/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-javascript-best-practices)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: javascript-best-practices
description: Idiomatic JavaScript patterns and conventions for maintainable existing code. Use when reviewing or refactoring JavaScript language patterns; defer project scaffolding, dependency setup, and tool configuration.
metadata:
  triggers:
    files:
    - '**/*.js'
    - '**/*.mjs'
    keywords:
    - module
    - import
    - export
    - error
    - validation
---
# JavaScript Best Practices

## **Priority: P1 (HIGH)**


## Implementation Guidelines

- **Naming**: `camelCase` (vars/funcs), `PascalCase` (classes), `UPPER_SNAKE` (constants).
- **Errors**: Throw `Error` objects only. Handle all async errors.
- **Comments**: JSDoc for APIs. Explain "why" not "what".
- **Files**: One entity per file. `index.js` for exports.
- **Modules**: Named exports only. Order: Ext -> Int -> Rel.

## Anti-Patterns

- **No Globals**: Encapsulate state.
- **No Magic Numbers**: Use `const`.
- **No Nesting**: Guard clauses/early returns.
- **No Defaults**: Use named exports.
- **No Side Effects**: Keep functions pure.

## Code & Reference

See [references/REFERENCE.md](references/REFERENCE.md) for constants, custom errors, async patterns, and module structure examples.

## Related Topics

language | tooling

## Canonical response anchors

When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
- Naming
- index.js

- Additional task-grounded exact anchors: Comments

Files in this skill

  • SKILL.md1.4 KB
  • evals/evals.json1.9 KB
  • references/REFERENCE.md2.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.