javascript-patterns

javascript-patterns is a skill for Claude Code, Codex from Everyone-Needs-A-Copilot/claude-copilot. It costs 108 tokens per session (2,422 once invoked), scanned A, original, MIT.

JavaScript and TypeScript patterns, anti-patterns, and quality rules — with deterministic regex-based anti-pattern detection for var usage, loose equality (==), leftover console.log, async without await, and common JS pitfalls. Covers Node.js, npm, ESLint, promise patterns, and async code. Use proactively when…

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/everyone-needs-a-copilot/claude-copilot/javascript-patterns
Any agent
npx skills add Everyone-Needs-A-Copilot/claude-copilot --skill javascript-patterns
Clone the repo
git clone --depth 1 https://github.com/Everyone-Needs-A-Copilot/claude-copilot

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for javascript-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/everyone-needs-a-copilot/claude-copilot/javascript-patterns.svg)](https://agentmods.dev/skills/everyone-needs-a-copilot/claude-copilot/javascript-patterns)
Your own site
<a href="https://agentmods.dev/skills/everyone-needs-a-copilot/claude-copilot/javascript-patterns"><img src="https://agentmods.dev/badge/skills/everyone-needs-a-copilot/claude-copilot/javascript-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 108 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,422 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00108 $0.02422
Opus 5 $0.00054 $0.01211
Sonnet 5 $0.00022 $0.00484
Haiku 4.5 $0.00011 $0.00242

Measured today against content hash ee57a1f507e9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

javascript-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/js_patterns.py, scripts/test_js_patterns.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/code/javascript-patterns/SKILL.md · 377 lines

How it starts

The opening of the file, as written. The whole thing — 377 lines — stays where its author put it; the contents beside it link to each section on GitHub.

JavaScript Patterns

Modern JavaScript/TypeScript patterns, anti-patterns, and quality rules.

Core Principles

Principle Description
Immutability Prefer const, avoid mutation
Pure Functions Same input = same output, no side effects
Async/Await Over raw promises and callbacks
Type Safety Use TypeScript for non-trivial projects

Patterns vs Anti-Patterns

Variable Declaration

// GOOD: const by default
const config = { timeout: 5000 };
const items = ['a', 'b', 'c'];

// OK: let when reassignment needed
let count = 0;
for (const item of items) {
  count++;
}

// BAD: var (hoisting issues)
var data = fetchData();  // Never use var

Async/Await

// GOOD: async/await
async function fetchUsers(): Promise<User[]> {
  try {
    const response = await fetch('/api/users');
    return await response.json();
  } catch (error) {
    throw new ApiError('Failed to fetch users', { cause: error });
  }
}

// GOOD: Parallel with Promise.all
const [users, posts] = await Promise.all([
  fetchUsers(),
  fetchPosts()
]);

// BAD: Sequential when parallel possible
const users = await fetchUsers();
const posts = await fetchPosts();  // Waits unnecessarily

Error Handling

// GOOD: Custom error classes
class ValidationError extends Error {
  constructor(
    message: string,
    public field: string,
    public code: string
  ) {
    super(message);
    this.name = 'ValidationError';
  }
}

// GOOD: Error boundary with type narrowing
function isApiError(error: unknown): error is ApiError {
  return error instanceof ApiError;
}

try {
  await riskyOperation();
} catch (error) {
  if (isApiError(error)) {
    handleApiError(error);
  } else {
    throw error;  // Re-throw unknown errors
  }
}

// BAD: Catch and ignore
try {
  await riskyOperation();
} catch (e) {
  // Silent failure - never do this
}

Nullish Handling

// GOOD: Nullish coalescing
const value = input ?? defaultValue;  // Only null/undefined

// GOOD: Optional chaining
const name = user?.profile?.name;
const result = callback?.();

// BAD: OR for defaults (falsy issues)
const value = input || defaultValue;  // 0, '', false become default!

// BAD: Manual null checks
const name = user && user.profile && user.profile.name;

Read the full file on GitHub · 377 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 377 lines · 108 tokens per session scan A ee57a1f507e9

Subscribe to this mod's changes

javascript-patterns is a skill published in the GitHub repository Everyone-Needs-A-Copilot/claude-copilot (13 stars, last pushed 10d ago), licensed MIT. It adds 108 tokens to every session and 2,422 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

javascript-typescript

Modern JavaScript and TypeScript development patterns.

miles990/claude-software-skills · 12 tokens

typescript-expert

Expert-level TypeScript development with modern tooling, advanced types, and best practices. Use this skill for TypeScript projects requiring type-safe code, modern bundling, and comprehensive testing.

personamanagmentlayer/pcl · 40 tokens

nodejs-expert

Expert-level Node.js backend development with Express, async patterns, streams, performance optimization, and production best practices. Use when the user mentions JavaScript, backend, Express, or async, or when the task involves Modern Node.js Features, Express Framework, File System Operations, or HTTP Requests.

personamanagmentlayer/pcl · 63 tokens

javascript-development

JavaScript/TypeScript ES2024+, async/await, DOM manipulation, Node.js, and API integration. Use when writing vanilla JS/TS code, working with REST/fetch APIs, implementing frontend logic, or configuring JS build tools.

PracticalSwan/agent-skills · 52 tokens

code-review-typescript

Deep TypeScript-specific code review covering type safety, ESM/CJS, async correctness, money precision, and domain modeling. Applied in addition to the generic code-review skill when TypeScript/JavaScript code is detected. Invoked when reviewing TS/JS PRs, TypeScript changes, or performing TypeScript-specific quality…

soulcodex/agentic · 71 tokens

api-first

Maintain the OpenAPI contract in docs, regenerate TypeScript types into src/generated/api, and wire client/server imports without hand-editing generated files.

bishopZ/2026-Boilerplate · 32 tokens