data-structures

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

Implementations of custom JavaScript data structures such as queues, heaps, tries, graphs, linked lists, and caches. These structures are alternatives to the language’s standard collections when specific operations or behavior matter.

In plain words
What is it for?
Use it to build fast queues or stacks, priority queues, autocomplete tries, graph algorithms, least-recently-used caches, persistent lists, or other specialized collections.
Why use it?
It helps when built-in arrays, objects, maps, or sets do not provide the needed operation speed or data-sharing behavior.

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/metarhia/metaskills/data-structures
Any agent
npx skills add metarhia/metaskills --skill 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 data-structures

README.md
[![agentmods](https://agentmods.dev/badge/skills/metarhia/metaskills/data-structures.svg)](https://agentmods.dev/skills/metarhia/metaskills/data-structures)
Your own site
<a href="https://agentmods.dev/skills/metarhia/metaskills/data-structures"><img src="https://agentmods.dev/badge/skills/metarhia/metaskills/data-structures.svg" alt="Measured on agentmods" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,591 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.00084 $0.03591
Opus 5 $0.00042 $0.01795
Sonnet 5 $0.00017 $0.00718
Haiku 4.5 $0.00008 $0.00359

Measured 4d ago against content hash 27364c6c35e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

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 4d 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/data-structures/SKILL.md · 516 lines

How it starts

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

Custom Data Structures (JavaScript)

Complexity and code characteristics

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

Big-O (typical; n = size, k = key/word length):

  • Singly-linked push/pop at head: O(1); search / index: O(n)
  • Doubly-linked append/prepend / splice at known node: O(1); index: O(n) (nearer-end walk helps)
  • Cons prepend / uncons: O(1); reverse / map / random access: O(n); tails share structure
  • CircularBuffer / Queue / Deque / Stack ends: amortized O(1); grow rare O(n); never hot Array.shift
  • UnrolledList enqueue/dequeue: amortized O(1); better locality than per-item nodes; pool cuts allocs
  • BST insert/search: O(log n) balanced, O(n) skewed; in-order: O(n)
  • Binary heap push/pop: O(log n); peek: O(1)
  • Trie insert/has: O(k); autocomplete: O(matches × k)
  • Adjacency-list addEdge: O(1); BFS/DFS: O(V + E)
  • LRU (Map) get/set/evict: O(1); G-Counter inc O(1), merge O(replicas); Pool capture O(1) amortized
  • Prefer the structure whose hot operation is O(1) or O(log n); measure before optimizing rare paths

Readability and semantics:

  • Name by role: pending (Queue), frontier (Deque), undo (Stack) — not buffer1
  • Type states intent: ring/unrolled = throughput; cons = persistent; heap = priority; trie = prefix
  • Small public API (enqueue/dequeue) — do not expose nodes or buffers

Stability and contracts:

  • Return copies or iterators; document live vs snapshot and iteration order
  • Cap growth (capacity, pool size, LRU max); unbounded queues/caches are operability bugs
  • Immutable Cons/Struct: updates are new values (prepend, fork); mutable lists document aliasing

Testability:

  • Assert on contents ([...q], toArray(), size), not private fields; keep Symbol.iterator
  • Deterministic fixtures; inject clocks/timeouts for Pool waiters

Encapsulation and cost:

  • Hide representation so callers survive swaps (array → ring → unrolled)
  • Amortized grow and node pools trade memory for latency; clear slots on dequeue for GC
  • Power-of-2 ring capacity; index with & (len - 1) instead of %

Read the full file on GitHub · 516 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. 4d ago First seen · 516 lines · 0 tokens per session scan A 27364c6c35e4

Subscribe to this mod's changes

data-structures is a skill published in the GitHub repository metarhia/metaskills (48 stars, last pushed 28d ago), licensed MIT. It adds 84 tokens to every session and 3,591 once invoked, about $0.0004 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-08-30.

Related

Other skills, from other repositories

deno-sandbox

Use when building features that execute untrusted user code, AI-generated code, or need isolated code execution environments. Covers the @deno/sandbox SDK.

denoland/skills · 36 tokens

deno-frontend

Use when building a web frontend with Deno — running React, Vite, Astro, SvelteKit, Next.js, Nuxt or other npm frameworks under Deno, or working with Fresh, Deno's own island-architecture framework. Covers which path to pick, Fresh 2.x routes, handlers, islands, Preact signals, Tailwind, and Fresh 1.x to 2.x migration.

denoland/skills · 88 tokens

web-performance-reviewer

Review web frontends for performance issues by driving the rendered site through Chrome DevTools MCP — throttled performance traces, Core Web Vitals judged against thresholds, network waterfall analysis, and heap-snapshot leak checks for SPAs. Composes on top of web-static, web-sprinkles, or web-components. Strictly…

AdamBien/airails · 193 tokens

web-static

Build modern static websites using semantic HTML and CSS without external dependencies or build systems. Also owns the verification loop for such sites — drives the rendered pages through Chrome DevTools MCP (console, accessibility snapshot, viewport resize, dark/reduced-motion emulation, Lighthouse), executes the…

AdamBien/airails · 183 tokens

zcfg

Integrate zcfg (Zero Dependency Configuration Utility) into Java applications. Use when adding configuration loading, reading properties files, setting up application configuration, or integrating zcfg into a Java project. Triggers on "zcfg", "add configuration", "load properties", "application configuration with…

AdamBien/airails · 75 tokens

zcl

Add colored terminal output to Java applications using zcl (Zero-dependency Colour Logger). Use when adding colored console output, terminal logging with colors, ANSI color support, or integrating zcl into a Java project. Triggers on "zcl", "colored output", "colored logging", "terminal colors", "ANSI colors"…

AdamBien/airails · 85 tokens