JS/TS Performance Audit
Audit JavaScript and TypeScript codebases to eliminate runtime bottlenecks, memory leaks, and O(n^2) algorithmic waste.
$5
JS/TS Performance Audit
Example session with this skill installed
Audit src/services/user-processor.ts for cost. The file handles batch updates of user records in a loop.
- Read your context and instructions
- Compiled the js ts performance
I have audited src/services/user-processor.ts focusing on reducing compute cost.
Goal: cost (asked)
Findings
| # | Impact | Risk | Where | Problem → fix |
|---|---|---|---|---|
| 1 | High | None | src/services/user-processor.ts:42 | includes() inside batch loop, O(n * m) → Set, O(n + m) |
| 2 | Medium | Low | src/services/user-processor.ts:88 | Sequential await on independent lookups → Promise.all |
| 3 | Medium | None | src/services/user-processor.ts:102 | Rebuilding Intl.DateTimeFormat in loop → hoist to module scope |
1. O(n^2) lookup in batch loop
The processor checks every user ID against a list of blacklisted IDs using array.includes(). Converting the blacklist to a Set before the loop removes redundant scans.
// Before
const filtered = users.filter(u => !blacklist.includes(u.id));
// After
const blacklistSet = new Set(blacklist);
const filtered = users.filter(u => !blacklistSet.has(u.id));
2. Parallelize metadata fetches
The fetchProfile and fetchPermissions calls do not depend on each other. Running them concurrently reduces worker idle time.
// Before
const profile = await fetchProfile(id);
const perms = await fetchPermissions(id);
// After
const [profile, perms] = await Promise.all([fetchProfile(id), fetchPermissions(id)]);
Memoization candidates (confirmation required)
| Resource | Key | Max | TTL | Invalidation |
|---|---|---|---|---|
| Organization Config | orgId | 100 | 5m | None (read-only) |
Next steps
- Would you like me to apply the
Setoptimization andIntlhoisting now? - Should I add
lru-cacheto handle the Organization Config memoization? - Shall I run a dead-code check on the supporting
utils/formatters.tsfile?
Connects securely to your tools. The creator never sees your data.
About this skill
High-level performance audits for JavaScript and TypeScript projects often get bogged down in subjective style debates or micro-benchmarks that don't matter. This skill delivers a cold-blooded technical review focused exclusively on runtime speed and infrastructure cost. It identifies the O(n^2) bottlenecks, memory leaks, and unnecessary allocations that actually impact your production metrics.
What it does
- Runtime Profiling identifies algorithmic inefficiencies like linear scans in loops that should be using
MaporSetlookups. - Memory Optimization flags unnecessary object spreads, deep copies, and chained array transformations that spike GC pressure.
- Concurrency Audits finds sequential
awaitcalls that can be parallelized or bounded to prevent resource exhaustion. - Dead Code Detection locates unreferenced files and unused dependencies that bloat bundles and slow down cold starts.
- Memoization Strategy suggests specific caching patterns using
lru-cachefor frequent, expensive data fetches.
How it works
- Define the Goal by selecting either
speed(latency-focused for frontend) orcost(compute-focused for backend/serverless). - Scan Hot Paths to prioritize code executed per request, per frame, or over large data collections.
- Analyze & Audit for specific anti-patterns like
deleteon hot objects or unboundedPromise.allcalls. - Generate Report with findings ranked by impact (High/Medium/Low) and risk of regression.
- Apply Edits one by one upon request, verifying that behavior remains identical to the original implementation.
Frameworks & tools
Works across the JS/TS ecosystem including Node.js, browser environments, and serverless handlers. Integrates with Knip for dead code analysis and lru-cache for memoization.
Why this beats prompting it yourself
Generic prompts often suggest "cleaner" code that is actually slower or triggers V8 dictionary mode. This skill uses specific heuristics measured on modern runtimes to ensure every suggestion removes actual work without changing the public API.
Use cases
- Auditing a Node.js API to reduce p99 latency and CPU usage.
- Reviewing a React/frontend codebase to trim bundle size and reduce main-thread blocking.
- Fixing memory leaks in long-running worker processes or CLI tools.
- Optimizing data transformation pipelines that handle large JSON datasets.
Known limitations
Does not perform live benchmarking unless explicitly requested with specific environment setup. Optimization rules are tuned for V8 runtimes.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 17 days ago
- Software
Node.jsknip
Permissions
What's inside
Creator
Tiago Bértolo
Frequently Asked Questions
New in LLM Ops
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.