Agent skill
JavaScript Language Patterns
Modern JavaScript (ES2022+) patterns for clean, maintainable code.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/language
Metadata
Additional technical details for this skill
- labels
-
javascript language es6 modern-js
- triggers
-
{ "files": [ "**/*.js", "**/*.mjs", "**/*.cjs" ], "keywords": [ "const", "let", "arrow", "async", "await", "promise", "destructuring", "spread", "class" ] }
SKILL.md
JavaScript Language Patterns
Priority: P0 (CRITICAL)
Implementation Guidelines
- Variables:
constdefault.letif needed. Novar. - Functions: Arrows for callbacks. Declarations for top-level.
- Async:
async/await+try/catch. - Objects: Destructuring, Spread
..., Optional Chain?., Nullish??. - Strings: Template literals
${}. - Arrays:
map,filter,reduce. No loops. - Modules: ESM
import/export. Export only what is necessary. - Classes: Use
#privatefields for true privacy.
Anti-Patterns
- No
var: Block scope only. - No
==: Strict===. - No
new Object(): Use literals{}. - No Callbacks: Promisify everything.
- No Mutation: Immutability first.
Code
// Modern Syntax
const [x, ...rest] = items;
const name = user?.profile?.name ?? 'Guest';
// Async + Error Handling
async function getUser(id) {
const res = await fetch(`/api/${id}`);
return res.json(); // Errors propagate
}
// Private Fields
class Service {
#key;
constructor(k) {
this.#key = k;
}
}
Reference & Examples
For advanced patterns and functional programming: See references/REFERENCE.md.
Related Topics
best-practices | tooling
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?