js-set-map-lookups
Replaces inefficient O(n) array lookups with O(1) Set or Map operations for better performance.
Install
mkdir -p .claude/skills/js-set-map-lookups && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3350" && unzip -o skill.zip -d .claude/skills/js-set-map-lookups && rm skill.zipInstalls to .claude/skills/js-set-map-lookups
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use Set and Map for O(1) membership lookups instead of array.includes(). Apply when checking membership repeatedly or performing frequent lookups against a collection.Key capabilities
- →Identify array.includes() for repeated checks
- →Suggest converting arrays to Set for O(1) lookups
- →Suggest converting arrays to Map for O(1) lookups
How it works
The skill analyzes code for array.includes() calls used in repeated membership checks and provides an optimized alternative using JavaScript Set or Map objects.
Inputs & outputs
When to use js-set-map-lookups
- →Optimizing large data filter operations
- →Refactoring slow array.includes() calls
- →Improving lookup speed for ID collections
About this skill
Use Set/Map for O(1) Lookups
Convert arrays to Set/Map for repeated membership checks.
Incorrect (O(n) per check):
const allowedIds = ['a', 'b', 'c', ...]
items.filter(item => allowedIds.includes(item.id))
Correct (O(1) per check):
const allowedIds = new Set(['a', 'b', 'c', ...])
items.filter(item => allowedIds.has(item.id))
How it compares
This skill automatically suggests and demonstrates a performance optimization for membership checks, contrasting with manual code review and refactoring.
Compared to similar skills
js-set-map-lookups side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| js-set-map-lookups (this skill) | 1 | 7mo | No flags | Beginner |
| agent-refinement | 1 | 6mo | Review | Advanced |
| typescript-review | 39 | 2mo | No flags | Intermediate |
| react-modernization | 21 | 2mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by TheOrcDev
View all by TheOrcDev →You might also like
agent-refinement
ruvnet
Agent skill for refinement - invoke with $agent-refinement
typescript-review
metabase
Review TypeScript and JavaScript code changes for compliance with Metabase coding standards, style violations, and code quality issues. Use when reviewing pull requests or diffs containing TypeScript/JavaScript code.
react-modernization
wshobson
Upgrade React applications to latest versions, migrate from class components to hooks, and adopt concurrent features. Use when modernizing React codebases, migrating to React Hooks, or upgrading to latest React versions.
reviewing-nextjs-16-patterns
djankies
Review code for Next.js 16 compliance - security patterns, caching, breaking changes. Use when reviewing Next.js code, preparing for migration, or auditing for violations.
react-best-practices
redpanda-data
Client-side React performance optimization patterns.
web-games
davila7
Web browser game development principles. Framework selection, WebGPU, optimization, PWA.