js-data-structures

js-data-structures is a skill for Claude Code, Codex from metarhia/metaskills. It costs 77 tokens per session (2,224 once invoked), scanned A, original, MIT.

Guidance for choosing JavaScript’s built-in collections, such as arrays, sets, maps, and typed arrays. It explains which collection fits different data shapes, operations, and performance needs.

In plain words
What is it for?
Use it when deciding how to store lists, key-value data, unique values, object-linked data, or binary and numeric data in JavaScript.
Why use it?
It helps avoid awkward or inefficient data handling, such as using arrays for unique-value lookups or objects for keys that are not strings.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when deciding how to store lists, key-value data, unique values, object-linked data, or binary and numeric data in JavaScript.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/metarhia/metaskills/js-data-structures
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.

Any agent
npx skills add metarhia/metaskills --skill js-data-structures
Clone the repo
git clone --depth 1 https://github.com/metarhia/metaskills

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 js-data-structures

README.md
[![agentmods](https://agentmods.dev/badge/skills/metarhia/metaskills/js-data-structures/github.svg)](https://agentmods.dev/skills/metarhia/metaskills/js-data-structures)
Your own site
<a href="https://agentmods.dev/skills/metarhia/metaskills/js-data-structures"><img src="https://agentmods.dev/badge/skills/metarhia/metaskills/js-data-structures/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for js-data-structures

Your own site · 80×15
<a href="https://agentmods.dev/skills/metarhia/metaskills/js-data-structures"><img src="https://agentmods.dev/badge/skills/metarhia/metaskills/js-data-structures.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,224 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00077 $0.02224
Opus 5.5 $0.00031 $0.00890
Sonnet 5.5 $0.00015 $0.00445
Haiku 4.5 $0.00008 $0.00222

Measured 1mo ago against content hash aec3cd8159d1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

js-data-structures 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 1mo ago.

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.

skills/js-data-structures/SKILL.md · 210 lines

How it starts

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

Native Data Structures (JavaScript)

Choosing a native collection

  • Fixed schema / DTO / JSON: use Object (avoid Map, no JSON.stringify)
  • Dynamic string-to-value dict: use Map or Object.create(null) (avoid plain {} if keys are user input)
  • Non-string keys, insertion order, .size: use Map (avoid Object)
  • Ordered list, index access, transform: use Array (avoid Set, no indexes)
  • Unique values, fast membership: use Set (avoid Array.includes on large/dynamic sets)
  • Attach data to objects without retaining them: use WeakMap (avoid Map, leaks)
  • Track object presence without retaining: use WeakSet (avoid Set, leaks)
  • Numeric / binary data, I/O, crypto: use TypedArray / ArrayBuffer (avoid number[] for hot binary work)
  • Hot queue / deque / stack ends: do not rely on Array.shift/unshift — use a custom ring or linked structure

Complexity and code characteristics

Choose a structure for the property you need to control — not only for speed.

Big-O (typical average case; n = collection size):

  • Object field access: O(1) for fixed shapes; dynamic/delete-heavy objects degrade toward dictionary mode
  • Array index get/set, push/pop: O(1); includes/indexOf/splice/shift/unshift: O(n)
  • Map get/set/has/delete, Set add/has/delete: amortized O(1); iteration: O(n)
  • WeakMap/WeakSet get/set/has/delete: amortized O(1); no iteration
  • TypedArray index get/set: O(1); grow/copy: O(n)
  • Prefer the structure whose hot operation is O(1); measure before optimizing rare paths

Readability and semantics:

  • Let the type state the intent: Set = unique membership; Map = keyed registry; Array = ordered sequence; plain Object = record/DTO
  • Prefer a named collection over encoding the same idea in ad-hoc flags, parallel arrays, or stringly keys
  • Use array methods (.map, .filter, .reduce) when they match the transform; use explicit loops when control flow or performance matters
  • Avoid over-abstracting: a small static Array allowlist is clearer than a Set used once

Read the full file on GitHub · 210 lines

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. 1mo ago First seen · 210 lines · 77 tokens per session scan A aec3cd8159d1

Subscribe to this mod's changes

js-data-structures is a skill published in the GitHub repository metarhia/metaskills (59 stars, last pushed 2mo ago), licensed MIT. It adds 77 tokens to every session and 2,224 once invoked, about $0.0003 per session on Opus 5.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-08-30.

Related

Other skills, from other repositories

post-processing

Extract, analyze, and summarize simulation output data — pull spatial fields at specific timesteps, compute time-series trends and detect steady state, extract line profiles through the domain, generate statistical summaries and distributions, calculate derived quantities (gradients, fluxes, volume fractions…

HeshamFS/materials-simulation-skills · 130 tokens

nonlinear-solvers

Select and configure nonlinear solvers for root-finding f(x)=0, optimization min F(x), and least-squares problems — choose among Newton, Newton-Krylov, quasi-Newton (BFGS, L-BFGS), Broyden, Anderson acceleration, and Levenberg-Marquardt methods, configure line search or trust-region globalization, diagnose convergence…

HeshamFS/materials-simulation-skills · 153 tokens

ontology-explorer

Parse, navigate, and query materials science ontology structures — browse class hierarchies, inspect individual classes and their properties, look up object and data property definitions with domain/range, search for ontology terms by keyword, and parse or summarize raw OWL/XML files. Currently supports CMSO and ASMO…

HeshamFS/materials-simulation-skills · 151 tokens

simulation-orchestrator

Orchestrate multi-simulation campaigns — generate parameter sweep configurations (grid, linspace, or Latin Hypercube sampling), initialize and track batch job campaigns, monitor job completion status, and aggregate results with summary statistics across all runs. Use when running a parameter study across dt, kappa, or…

HeshamFS/materials-simulation-skills · 125 tokens

simulation-validator

Validate simulations across three stages — run pre-flight checks on configuration files (parameter ranges, required fields, disk space), monitor runtime logs for residual growth, NaN/Inf, and adaptive dt collapse, and perform post-flight validation of results (physical bounds, mass/energy conservation, convergence).…

HeshamFS/materials-simulation-skills · 123 tokens

convergence-study

Perform spatial and temporal convergence analysis for solution verification — compute observed convergence orders from grid or timestep refinement studies, apply Richardson extrapolation to estimate discretization error, and calculate the Grid Convergence Index (GCI) per ASME V&V 20 standards. Use when verifying that…

HeshamFS/materials-simulation-skills · 116 tokens