Skip to content
Back to skills

Javascript

ASecurity

Best practices for JavaScript/TypeScript development including modern ES6+ patterns, error handling, and performance optimization.

  • 57 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 31, 2026
developmentjavascripttypescriptjavaperformance

Security analysis

A100/100

Scanned May 31, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill javascript --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Javascript?

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

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

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
description: Best practices for JavaScript/TypeScript development including modern ES6+ patterns, error handling, and performance optimization.
globs: ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.jsx", "**/*.ts", "**/*.tsx"]
priority: 100
tags: ["language"]
---

# JavaScript/TypeScript Best Practices

## Code Style
- Use const by default, let when reassignment is needed
- Use template literals for string interpolation
- Prefer arrow functions for callbacks
- Use destructuring for object/array access
- Use async/await over .then() chains
- Use semicolons consistently (pick a style)

## Error Handling
- Always handle promise rejections with .catch() or try/catch
- Use try/catch with async/await
- Provide meaningful error messages with context
- Don't swallow errors silently
- Create custom error classes for domain errors

## Modern Patterns
- Use optional chaining (?.) and nullish coalescing (??)
- Use spread operator for shallow object/array copies
- Use Map/Set for complex data structures
- Prefer for...of over forEach for iterables
- Use Object.entries/keys/values for object iteration
- Use Array.from() for array-like conversions

## TypeScript Specific
- Prefer interfaces over type aliases for objects
- Use strict mode in tsconfig.json
- Avoid 'any' type - use 'unknown' if needed
- Use generics for reusable type-safe code
- Use discriminated unions for type narrowing
- Leverage const assertions for literal types

## Performance
- Avoid creating functions inside loops
- Use object pools for frequent allocations
- Debounce/throttle expensive operations
- Use Web Workers for CPU-intensive tasks

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.

Comments

Loading comments…

Newsletter

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