← 返回 Skills 市场
alirezarezvani

performance-profiler

作者 Alireza Rezvani · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
313
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install cs-performance-profiler
功能描述
Performance Profiler
使用说明 (SKILL.md)

Performance Profiler

Tier: POWERFUL
Category: Engineering
Domain: Performance Engineering


Overview

Systematic performance profiling for Node.js, Python, and Go applications. Identifies CPU, memory, and I/O bottlenecks; generates flamegraphs; analyzes bundle sizes; optimizes database queries; detects memory leaks; and runs load tests with k6 and Artillery. Always measures before and after.

Core Capabilities

  • CPU profiling — flamegraphs for Node.js, py-spy for Python, pprof for Go
  • Memory profiling — heap snapshots, leak detection, GC pressure
  • Bundle analysis — webpack-bundle-analyzer, Next.js bundle analyzer
  • Database optimization — EXPLAIN ANALYZE, slow query log, N+1 detection
  • Load testing — k6 scripts, Artillery scenarios, ramp-up patterns
  • Before/after measurement — establish baseline, profile, optimize, verify

When to Use

  • App is slow and you don't know where the bottleneck is
  • P99 latency exceeds SLA before a release
  • Memory usage grows over time (suspected leak)
  • Bundle size increased after adding dependencies
  • Preparing for a traffic spike (load test before launch)
  • Database queries taking >100ms

Golden Rule: Measure First

# Establish baseline BEFORE any optimization
# Record: P50, P95, P99 latency | RPS | error rate | memory usage

# Wrong: "I think the N+1 query is slow, let me fix it"
# Right: Profile → confirm bottleneck → fix → measure again → verify improvement

Node.js Profiling

→ See references/profiling-recipes.md for details

Before/After Measurement Template

## Performance Optimization: [What You Fixed]

**Date:** 2026-03-01  
**Engineer:** @username  
**Ticket:** PROJ-123  

### Problem
[1-2 sentences: what was slow, how was it observed]

### Root Cause
[What the profiler revealed]

### Baseline (Before)
| Metric | Value |
|--------|-------|
| P50 latency | 480ms |
| P95 latency | 1,240ms |
| P99 latency | 3,100ms |
| RPS @ 50 VUs | 42 |
| Error rate | 0.8% |
| DB queries/req | 23 (N+1) |

Profiler evidence: [link to flamegraph or screenshot]

### Fix Applied
[What changed — code diff or description]

### After
| Metric | Before | After | Delta |
|--------|--------|-------|-------|
| P50 latency | 480ms | 48ms | -90% |
| P95 latency | 1,240ms | 120ms | -90% |
| P99 latency | 3,100ms | 280ms | -91% |
| RPS @ 50 VUs | 42 | 380 | +804% |
| Error rate | 0.8% | 0% | -100% |
| DB queries/req | 23 | 1 | -96% |

### Verification
Load test run: [link to k6 output]

Optimization Checklist

Quick wins (check these first)

Database
□ Missing indexes on WHERE/ORDER BY columns
□ N+1 queries (check query count per request)
□ Loading all columns when only 2-3 needed (SELECT *)
□ No LIMIT on unbounded queries
□ Missing connection pool (creating new connection per request)

Node.js
□ Sync I/O (fs.readFileSync) in hot path
□ JSON.parse/stringify of large objects in hot loop
□ Missing caching for expensive computations
□ No compression (gzip/brotli) on responses
□ Dependencies loaded in request handler (move to module level)

Bundle
□ Moment.js → dayjs/date-fns
□ Lodash (full) → lodash/function imports
□ Static imports of heavy components → dynamic imports
□ Images not optimized / not using next/image
□ No code splitting on routes

API
□ No pagination on list endpoints
□ No response caching (Cache-Control headers)
□ Serial awaits that could be parallel (Promise.all)
□ Fetching related data in a loop instead of JOIN

Common Pitfalls

  • Optimizing without measuring — you'll optimize the wrong thing
  • Testing in development — profile against production-like data volumes
  • Ignoring P99 — P50 can look fine while P99 is catastrophic
  • Premature optimization — fix correctness first, then performance
  • Not re-measuring — always verify the fix actually improved things
  • Load testing production — use staging with production-size data

Best Practices

  1. Baseline first, always — record metrics before touching anything
  2. One change at a time — isolate the variable to confirm causation
  3. Profile with realistic data — 10 rows in dev, millions in prod — different bottlenecks
  4. Set performance budgetsp(95) \x3C 200ms in CI thresholds with k6
  5. Monitor continuously — add Datadog/Prometheus metrics for key paths
  6. Cache invalidation strategy — cache aggressively, invalidate precisely
  7. Document the win — before/after in the PR description motivates the team
安全使用建议
This is a legitimate profiling cookbook. Before you use it: (1) Never expose debug endpoints (heap snapshot, /debug/pprof) publicly — protect them with authentication, network ACLs, or bind to localhost. (2) Heap snapshots and pprof data may contain sensitive memory (tokens, PII), so store and share them carefully and delete after use. (3) Run heavy profiling and load tests against staging or isolated environments to avoid impacting production. (4) Installing global tooling (npm -g, pip) is optional — prefer virtualenvs/containers. (5) Audit any code you paste from the guide before adding debug endpoints to your app. If you want a stricter check, provide the exact commands you plan to run and the environment (prod/staging) so potential hazards can be reviewed.
功能分析
Type: OpenClaw Skill Name: cs-performance-profiler Version: 1.0.0 The skill bundle is a comprehensive and legitimate toolkit for performance engineering across Node.js, Python, and Go environments. It provides standard industry practices and code snippets for CPU/memory profiling, database optimization, and load testing using established tools like clinic.js, py-spy, pprof, and k6. While it includes powerful capabilities such as heap snapshot generation and process inspection, these are strictly aligned with the stated purpose of performance analysis and include explicit security warnings (e.g., protecting debug endpoints with authentication) in files like SKILL.md and references/profiling-recipes.md.
能力评估
Purpose & Capability
The name/description (performance profiling) matches the content: Node.js/Python/Go profiling, flamegraphs, bundle analysis, DB EXPLAINs, and load testing. Nothing in the files asks for unrelated credentials, binaries, or system-wide access that would be inconsistent with profiling.
Instruction Scope
SKILL.md and references contain concrete instructions to add debug endpoints (/debug/heap-snapshot, pprof endpoints), run profilers, and run load tests. These are expected for profiling, but they can expose sensitive memory/state or administrative endpoints if not properly protected and can cause production impact if run against live traffic. The guidance sometimes reminds to 'protect with auth' or 'use staging', but enforcement is left to the operator.
Install Mechanism
This is an instruction-only skill with no install spec or code files. The docs suggest installing tools (clinic, py-spy, memory-profiler) via npm/pip, which is normal for profiling workflows and are executed by the user rather than installed by the skill itself.
Credentials
No environment variables, credentials, or config paths are required by the skill. The content references typical env usage (e.g., ANALYZE=true) and monitoring services, but does not request tokens or secrets — this is proportionate to its purpose.
Persistence & Privilege
The skill does not request persistent presence, does not modify other skills, and is not always-enabled. It’s a passive instruction set the agent can follow when invoked.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cs-performance-profiler
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cs-performance-profiler 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial publish (prefixed slug)
v2.1.2
- Added comprehensive documentation outlining the skill's profiling features for Node.js, Python, and Go. - Included clear guidance for before/after measurement and benchmarking optimizations. - Provided practical checklists for common performance bottlenecks and quick optimization wins. - Added best practices and common pitfalls to improve profiling accuracy and effectiveness. - Introduced a standardized template for documenting performance improvements.
元数据
Slug cs-performance-profiler
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

performance-profiler 是什么?

Performance Profiler. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 313 次。

如何安装 performance-profiler?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cs-performance-profiler」即可一键安装,无需额外配置。

performance-profiler 是免费的吗?

是的,performance-profiler 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

performance-profiler 支持哪些平台?

performance-profiler 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 performance-profiler?

由 Alireza Rezvani(@alirezarezvani)开发并维护,当前版本 v1.0.0。

💬 留言讨论