JavaScript Language Patterns

Modern JavaScript (ES2022+) patterns for clean, maintainable code.

385 stars

Best use case

JavaScript Language Patterns is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Modern JavaScript (ES2022+) patterns for clean, maintainable code.

Teams using JavaScript Language Patterns should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/language/SKILL.md --create-dirs "https://raw.githubusercontent.com/HoangNguyen0403/agent-skills-standard/main/.agent/skills/javascript/language/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/language/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How JavaScript Language Patterns Compares

Feature / AgentJavaScript Language PatternsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Modern JavaScript (ES2022+) patterns for clean, maintainable code.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# JavaScript Language Patterns

## **Priority: P0 (CRITICAL)**

Modern JavaScript standards for clean, maintainable code.

## Implementation Guidelines

- **Variables**: `const` default. `let` if needed. No `var`.
- **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 `#private` fields 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

```javascript
// Modern Syntax
const [x, ...rest] = items;
const name = user?.profile?.name ?? 'Guest';

// Async
async function getUser(id) {
  try {
    const res = await fetch(`/api/${id}`);
    return res.json();
  } catch (err) {
    console.error(err);
    throw err;
  }
}

// Class + Private
class Service {
  #key;
  constructor(k) {
    this.#key = k;
  }
}
```

## Reference & Examples

For advanced patterns and functional programming:
See [references/REFERENCE.md](references/REFERENCE.md).

## Related Topics

best-practices | tooling

Related Skills

swift-language

385
from HoangNguyen0403/agent-skills-standard

Apply Optionals, Protocols, Extensions, and Type Safety patterns in Swift. Use when working with Swift Optionals, Protocols, Extensions, or type-safe APIs. (triggers: **/*.swift, protocol, extension, optional, guard, enum)

react-component-patterns

385
from HoangNguyen0403/agent-skills-standard

Build modern React component architecture with composition patterns. Use when designing reusable React components, applying composition patterns, or structuring component hierarchies. (triggers: **/*.jsx, **/*.tsx, component, props, children, composition, hoc, render-props)

php-language

385
from HoangNguyen0403/agent-skills-standard

Apply core PHP language standards and modern 8.x features. Use when working with PHP 8.x features like enums, fibers, readonly properties, or named arguments. (triggers: **/*.php, declare, readonly, match, constructor, promotion, types)

kotlin-language

385
from HoangNguyen0403/agent-skills-standard

Write idiomatic Kotlin 1.9+ with null safety, sealed classes, and expression syntax. Use when working with Kotlin null safety, data classes, sealed interfaces, extension functions, or migrating Java code to Kotlin. (triggers: **/*.kt, **/*.kts, val, var, ?., ?:, !!, data class, sealed, when, extension, lazy, lateinit, object)

JavaScript Tooling

385
from HoangNguyen0403/agent-skills-standard

Configure development tools, linting, and testing for JavaScript projects. Use when configuring ESLint, Prettier, or test runners for JavaScript projects. (triggers: .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, test, lint, build)

javascript-language

385
from HoangNguyen0403/agent-skills-standard

Modern JavaScript (ES2022+) patterns for clean, maintainable code. Use when working with modern JavaScript features like optional chaining, nullish coalescing, or ESM. (triggers: **/*.js, **/*.mjs, **/*.cjs, const, let, arrow, async, await, promise, destructuring, spread, class)

JavaScript Best Practices

385
from HoangNguyen0403/agent-skills-standard

Idiomatic JavaScript patterns and conventions for maintainable code. Use when writing or refactoring JavaScript following idiomatic patterns and conventions. (triggers: **/*.js, **/*.mjs, module, import, export, error, validation)

java-language

385
from HoangNguyen0403/agent-skills-standard

Modern Java 21+ standards including Records, Pattern Matching, and Virtual Threads. Use when working with Java records, sealed classes, switch expressions, text blocks, Optional, or upgrading from older Java versions. (triggers: **/*.java, pom.xml, build.gradle, record, sealed, switch, var, Optional, stream, VirtualThread, instanceof, text block)

golang-language

385
from HoangNguyen0403/agent-skills-standard

Core idioms, style guides, and best practices for writing idiomatic Go code. Use when writing Go code following official style guides and idiomatic patterns. (triggers: go.mod, golang, go code, idiomatic, gofmt, goimports, iota, golang style)

dart-language

385
from HoangNguyen0403/agent-skills-standard

Dart 3.x language feature standards: null safety, records, sealed classes, switch pattern matching, extensions, and async/await. Use when using !, ?., ??, late, sealed classes, record types, switch expressions, or async patterns — and before introducing any new Dart 3.x construct to confirm the modern idiomatic approach. (triggers: **/*.dart, sealed, record, switch, pattern, !, late, async, extension)

typescript-language

385
from HoangNguyen0403/agent-skills-standard

Apply modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)

angular-component-patterns

380
from HoangNguyen0403/agent-skills-standard

Apply OnPush change detection and strict Signals usage in Angular components. Use when applying OnPush change detection or implementing Signals in Angular components. (triggers: **/*.component.ts, **/*.component.html, ChangeDetectionStrategy, OnPush, Input, Output)