npx skills add smithery/pluginagentmarketplace --skill data-structures
pluginagentmarketplace/custom-plugin-javascript · Archived
data-structures
Master JavaScript objects and arrays including manipulation methods, prototypal inheritance, and complex data structure patterns.
Installation
npx skills add pluginagentmarketplace/custom-plugin-javascript --skill data-structures
Stronger alternatives
This repository is archived — consider an actively maintained alternative.
Master asynchronous JavaScript patterns including callbacks, promises, async/await, event loop …
5 installsJavaScript performance optimization and Web Vitals improvement techniques.
5 installsJavaScript testing with Jest, Vitest, and Testing Library for comprehensive test coverage.
4 installsJavaScript security best practices and vulnerability prevention.
4 installsSimilar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Helps users discover and install agent skills when they ask questions like "how do I do X", "fi…
3.3M installsBrowser automation CLI for AI agents. Use when the user needs to interact with websites, includ…
810.4K installsReview UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "chec…
617.3K installsBuild, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and …
576.5K installsPrepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Te…
568.3K installsAlso in this package
Other skills from pluginagentmarketplace/custom-plugin-javascript · top by installs.
npx skills add pluginagentmarketplace/custom-plugin-javascript
Browse all from pluginagentmarketplace/custom-plugin-javascript
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
main
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md4,460 B -
docs
SUMMARY.md152 B
History
- First seen on skills.sh
- First recorded snapshot · 7 installs
SKILL.md
Data Structures Skill
Quick Reference Card
Object Operations
// Create
const obj = { name: 'Alice', age: 30 };
// Access
obj.name; // Dot notation
obj['name']; // Bracket notation
obj?.address?.city; // Optional chaining
// Modify
obj.email = '[email protected]'; // Add/update
delete obj.age; // Remove
const { name, ...rest } = obj; // Destructure
Object Methods
Object.keys(obj); // ['name', 'age']
Object.values(obj); // ['Alice', 30]
Object.entries(obj); // [['name','Alice'], ['age',30]]
Object.fromEntries(entries); // Reverse
Object.assign({}, a, b); // Shallow merge
{ ...a, ...b }; // Spread merge (preferred)
Object.freeze(obj); // Immutable
Object.seal(obj); // No add/delete
Array Methods Cheat Sheet
Transform (new array)
arr.map(x => x * 2); // Transform each
arr.filter(x => x > 0); // Keep matches
arr.slice(1, 3); // Extract portion
arr.flat(2); // Flatten nested
arr.flatMap(x => [x, x*2]); // Map + flatten
Search
arr.find(x => x > 5); // First match
arr.findIndex(x => x > 5); // First index
arr.findLast(x => x > 5); // Last match (ES2023)
arr.includes(5); // Boolean check
arr.indexOf(5); // Index or -1
Reduce
arr.reduce((acc, x) => acc + x, 0); // Sum
arr.reduce((acc, x) => ({ ...acc, [x.id]: x }), {}); // Index by
Check
arr.every(x => x > 0); // All pass
arr.some(x => x > 0); // Any pass
Mutate (modify original)
arr.push(x); // Add end
arr.pop(); // Remove end
arr.unshift(x); // Add start
arr.shift(); // Remove start
arr.splice(i, n, ...items); // Remove/insert
arr.sort((a,b) => a - b); // Sort
arr.reverse(); // Reverse
Destructuring
// Object
const { name, age = 0 } = user;
const { name: userName } = user; // Rename
const { address: { city } } = user; // Nested
// Array
const [first, , third] = arr; // Skip
const [head, ...tail] = arr; // Rest
[a, b] = [b, a]; // Swap
Data Transformation Patterns
// Group by
const byRole = users.reduce((acc, u) => {
(acc[u.role] ??= []).push(u);
return acc;
}, {});
// Unique values
const unique = [...new Set(arr)];
// Index by ID
const byId = arr.reduce((acc, x) => ({ ...acc, [x.id]: x }), {});
Troubleshooting
Common Issues
| Problem | Symptom | Fix |
|---|---|---|
| Shallow copy bug | Nested changes shared | Use structuredClone() |
| Mutation side effect | Original changed | Use spread/map |
undefined access |
Property doesn't exist | Use ?. optional chain |
| Sort not working | Wrong order | Provide compare function |
Deep Clone
// Modern (preferred)
const deep = structuredClone(original);
// JSON (limited - no functions, dates)
const deep = JSON.parse(JSON.stringify(original));
Debug Checklist
// 1. Inspect structure
console.log(JSON.stringify(obj, null, 2));
// 2. Check array vs object
console.log(Array.isArray(value));
// 3. Check prototype
console.log(Object.getPrototypeOf(obj));
Production Patterns
Immutable Update
// Object
const updated = { ...user, name: 'New Name' };
// Array
const added = [...arr, newItem];
const removed = arr.filter(x => x.id !== id);
const updated = arr.map(x => x.id === id ? { ...x, ...changes } : x);
Safe Access
const city = user?.address?.city ?? 'Unknown';
const first = arr?.[0] ?? defaultValue;
Related
- Agent 03: Objects & Arrays (detailed learning)
- Skill: fundamentals: Variables and types
- Skill: modern-javascript: ES6+ features