# ns-optimize-function

> Claude/Codex skill by [@nodesource](https://omgskills.com/library/nodesource/index.md) · 0 stars · Updated 2026-09-16

Optimizes a specific local Node.js function selected by the user. Use when the user points to code and asks to make it faster, improve throughput, reduce CPU/memory cost, or fix a slow function. Requires workspace source; analyzes blast radius, proposes a behavior-preserving rewrite, and hands off to benchmark validation. Not for live N|Solid diagnostics alone.

## Install

```sh
git clone https://github.com/nodesource/nsolid-skills-plugin /tmp/nsolid-skills-plugin && ln -s /tmp/nsolid-skills-plugin/skills/ns-optimize-function ~/.claude/skills/ns-optimize-function
```

## From README

Acquire the Target Function The user selects a function via code-lens, names it, or pastes its code. Read it from the workspace. If they name it but don't point at a location, search the workspace for the definition and confirm the match before proceeding. Do not guess which definition they meant when multiple exist — ask. Record the exact file path, start/end lines, and the function signature. Analyze Context & Impact This is the grounding step. Do not write any optimization yet. Read the function body and everything it references (helpers, constants, external imports, closures). Search the workspace for call sites and tests to understand real and the actual input shapes callers pass in. Assess and state explicitly: What it does and its current complexity — the algorithmic shape (loops, nested iterations, recursion, allocations, serialization, I/O).

## Links

- HTML page: https://omgskills.com/library/nodesource/nsolid-skills-plugin/skills/ns-optimize-function/
- GitHub: https://github.com/nodesource/nsolid-skills-plugin
- Author: [@nodesource](https://omgskills.com/library/nodesource/index.md)

## More from this repo

- [ns-advanced-memory-leak-hunter](https://omgskills.com/library/nodesource/nsolid-skills-plugin/skills/ns-advanced-memory-leak-hunter/index.md) — Performs an advanced N|Solid memory leak hunt comparing baseline vs peak heap evidence to isolate retained...
   - [@nodesource](https://omgskills.com/library/nodesource/index.md) · 0 stars
- [ns-analyze-asset](https://omgskills.com/library/nodesource/nsolid-skills-plugin/skills/ns-analyze-asset/index.md) — Analyzes an existing N|Solid diagnostic asset by asset ID or local asset path using asset-summary.
   - [@nodesource](https://omgskills.com/library/nodesource/index.md) · 0 stars
- [ns-analyze-event](https://omgskills.com/library/nodesource/nsolid-skills-plugin/skills/ns-analyze-event/index.md) — Investigates an existing N|Solid event payload and correlates relevant MCP evidence.
   - [@nodesource](https://omgskills.com/library/nodesource/index.md) · 0 stars
