ai-profile

Measures CPU, memory, bundle size, and Web Vitals for Node.js modules inside a sandboxed environment.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/Vimurai/ai-os --skill ai-profile-vimurai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ai-profile
Source: https://github.com/Vimurai/ai-os/tree/main/.claude/skills/ai-profile
Command: npx skills add https://github.com/Vimurai/ai-os --skill ai-profile-vimurai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Profiling Node.js code for CPU and memory regressions is ad hoc and error-prone, and results often lack structure for downstream analysis. This Skill provides a repeatable profiling workflow that runs measurements in an isolated sandbox and returns structured JSON data to the performance_engineer agent. ## Core Features & Use Cases - Sandboxed CPU and Memory Profiling: Executes test fixtures inside the code-execution-mcp Docker sandbox using process.cpuUsage() and heapUsed deltas with a 5-second timeout and 512MB memory cap. - Bundle and Web Vitals Measurement: Runs build-size analysis and headless Lighthouse audits via the Bash tool for metrics requiring network access. - Structured JSON Output: Returns a standardized envelope with measurement value, unit, baseline delta percentage, and raw output for the performance_engineer agent to synthesize into reports. - Use Case: Before deploying a change to src/core/scheduler.js, invoke the skill with metric=cpu and a baseline SHA to detect whether the new code increased CPU time by more than an acceptable threshold. ## Quick Start Ask the agent to profile src/core/scheduler.js for CPU usage with the ai-profile skill and compare it against a baseline commit.

Frequently Asked Questions about ai-profile

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

FAQPage Schema
How do I profile CPU usage of a Node.js module?▼

Invoke the skill with the target file path and metric set to cpu. It generates a fixture that exercises the module's hot path for 10,000 iterations and measures the delta with process.cpuUsage() inside the code-execution-mcp sandbox.

How to measure memory usage in Node.js without gc()?▼

The skill uses process.memoryUsage().heapUsed deltas with a short settling loop instead of forced gc() calls, since the --expose-gc flag is unavailable in the sandbox. It measures heap before and after exercising the target module and reports the byte delta.

Can I run Lighthouse audits inside a Docker sandbox?▼

No, the code-execution-mcp sandbox runs with --network=none, so Lighthouse and external HTTP requests fail there. The skill uses the Bash tool instead for vitals and bundle metrics, which have network access.

Does this skill generate flamegraphs for Node.js?▼

No, true flamegraph generation is deferred because the performance-mcp server is not built yet. The skill currently uses process.cpuUsage() as a proxy measurement and will upgrade to real flamegraph analysis when performance-mcp becomes available.

What happens when the profiling sandbox is unavailable?▼

The skill gracefully degrades to local profiling via the Bash tool, marking results as [SANDBOX_FALLBACK]. These results are less isolated but still usable for analysis.