ns-validate-optimization

Validates Node.js code optimizations with controlled A/B benchmarks and statistical significance testing.

6|7|Updated Jun 4, 2026
One-click install
npx skills add https://github.com/nodesource/nsolid-plugin --skill ns-validate-optimization-nodesource
Or copy as Structured Prompt for Agentโ–ผ
Please help me install this Agent Skill.
Skill: ns-validate-optimization
Source: https://github.com/nodesource/nsolid-plugin/tree/main/skills/ns-validate-optimization
Command: npx skills add https://github.com/nodesource/nsolid-plugin --skill ns-validate-optimization-nodesource

SYSTEM DOCUMENTATION & REQUIREMENTS

๐Ÿ’ก This Skill includes scripts (resource) components.

What problem does it solve? Proving that a code change actually improves performance requires more than a single timing run. This Skill runs controlled A/B benchmarks of an original and an optimized Node.js function, then applies statistical tests (p-value, significance, improvement percentage) to confirm whether the optimization is genuinely effective. ## Core Features & Use Cases - Controlled A/B Benchmarking: Runs the original and optimized implementations with identical arguments, mock setup, and benchmark configuration so the comparison is statistically valid. - Statistical Verdicts: Compares results using p-value (< 0.05) and improvement percentage (> 25%) to produce an optimization_effective verdict, with up to 3 optimized retry attempts. - Structured Reporting: Generates a markdown report with ops/sec, histograms, variance assessment, and a side-by-side comparison table, optionally saved to .nsolid/assets/. - Use Case: After a CPU spike analysis identifies a hot function and proposes a fix, use this Skill to benchmark both versions and obtain statistical proof that the fix improves throughput before applying it. ## Quick Start Ask the assistant to validate the proposed optimization of the hot function by running an A/B benchmark against the original implementation.

Frequently Asked Questions about ns-validate-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prove a Node.js code optimization actually improves performance?โ–ผ

Run a controlled A/B benchmark comparing the original and optimized function with identical arguments and configuration. The comparison computes ops/sec, a p-value, and improvement percentage, and only reports optimization_effective when the result is statistically significant and improvement exceeds 25%.

What makes an A/B benchmark comparison statistically valid?โ–ผ

Both runs must use identical args, argSetupCode, and benchmarkConfig (repeatSuite, minSamples, minTime, maxTime). The p-value must be below 0.05 for significance, and high histogram variance should trigger more suite runs or sample inspection.

When should I use A/B validation instead of a single benchmark run?โ–ผ

Use A/B validation when comparing two implementations of the same function to prove an optimization works. Use a single benchmark run only when timing one version in isolation without needing a statistical comparison.

What happens if the optimized code fails the effectiveness threshold?โ–ผ

The optimized implementation is revised within the approved contract and re-benchmarked, up to 3 total attempts. If none pass, the best attempt is still reported with an explicit statement that the effectiveness threshold was not met.

Why must benchmark arguments come from real call sites and tests?โ–ผ

Arguments derived from actual invocation sites and existing tests reflect real usage patterns, making benchmark results representative. Invented inputs can produce misleading ops/sec figures that do not translate to production behavior.