Back to skills
SKILL.md
Javascript Best Practices
ASecurityIdiomatic JavaScript patterns and conventions for maintainable code. Use when writing or refactoring JavaScript following idiomatic patterns and conventions.
- 549 stars
- 0 votes
- 0 copies
- 3 views
- Added June 6, 2026
Works with
Security analysis
100/100Pro scans all 3 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill javascript-best-practices --agent claude-codeAre you the author of Javascript Best Practices?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-javascript-best-practices)---
name: javascript-best-practices
description: Idiomatic JavaScript patterns and conventions for maintainable code. Use when writing or refactoring JavaScript following idiomatic patterns and conventions.
metadata:
triggers:
files:
- '**/*.js'
- '**/*.mjs'
keywords:
- module
- import
- export
- error
- validation
---
# JavaScript Best Practices
## **Priority: P1 (OPERATIONAL)**
## 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 | toolingFiles in this skill
- SKILL.md
- evals/evals.json
- references/REFERENCE.md
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.