跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

ln-31-performance-optimizer

Optimizes a measured latency, throughput, memory, CPU, or I/O problem through profiling and keep-or-discard experiments. Use for a known bottleneck; not unbiased A/B comparison.

levnikolaevich · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add levnikolaevich/claude-code-skills --skill ln-31-performance-optimizer

技能说明


name: ln-31-performance-optimizer description: "Optimizes a measured latency, throughput, memory, CPU, or I/O problem through profiling and keep-or-discard experiments. Use for a known bottleneck; not unbiased A/B comparison."

Performance Optimizer

Goal: Optimize only measured problems. Preserve correctness, isolate experiments, and retain a change only when comparable evidence shows that it improves the agreed metric without unacceptable regressions.

Execution contract: Treat the ordered checkbox workflow below as this skill's Definition of Done. Track every checkbox as PENDING, then resolve it to PROVEN with concrete evidence, CLEARED with evidence that its conditional trigger is absent, or UNPROVEN; reading, mentioning, delegating, skipping, or tool failure is not proof. Before returning, resolve every PENDING, count only PROVEN and CLEARED items as complete, apply this skill's verdict, decision, and approval rules to every UNPROVEN, and prepend Checklist: X/Y completeIncomplete: None | section/item — reason; outcome impact; exact next action; list every UNPROVEN item.

Tool Routing

NeedPreferred toolUse it whenFallback
Repository state and safe edit boundaryGit status, diff, branch or worktree inspection, and repository instructionsAlways before profiling or editingStop if user changes cannot be isolated safely
Baseline and final metricExisting benchmark, load test, reproducible command, or production-like replayThe metric and workload reflect the reported problemCreate the smallest local benchmark that reproduces the behavior without inventing production scale
Bottleneck evidenceExisting profiler, tracing, query diagnostics, allocation tools, or OS-level metricsLocating CPU, memory, I/O, lock, query, network, or scheduler costTargeted instrumentation with cleanup plan
Code path and blast radiusLanguage server or host-native code intelligenceFollowing hot symbols, callers, implementations, and affected contractsNarrow search plus direct inspection of definitions and consumers
Correctness and regressionsRepository-defined tests, build, lint, type, and smoke commandsBefore and after every retained experimentChoose the smallest portfolio action when current evidence cannot detect the likely material regression
Runtime and dependency semanticsOfficial documentation, release notes, and specifications matching installed versionsA hypothesis depends on optimizer, runtime, database, framework, or library behaviorPrimary-source web research; otherwise mark the hypothesis UNVERIFIED
Independent challengeOne native subagent or advisor when policy and scope allowCompeting hypotheses, unfamiliar runtime behavior, or high-risk change needs independent scrutinySeparate adversarial hypothesis review

Do not optimize by aesthetic preference or benchmark a different workload from the reported problem. Never discard user changes, use destructive Git reset, or run uncontrolled load against production.

Evidence Rules

  • Define the primary metric and acceptance threshold before editing; do not move the goal after seeing results.
  • Compare the same workload, environment, build mode, data, warmup, and measurement method before and after.
  • Use repeated runs and report distribution or variance; a single faster run is not proof.
  • Separate cold-start, warm steady-state, and saturated-load behavior when the reported problem can occur in more than one regime.
  • Profile contribution and end-to-end impact separately: a hot function can improve while the user-visible metric does not.
  • Treat profiler estimates, synthetic workloads, and production observations as different evidence classes and label them.
  • Correctness, resource safety, and operational stability are hard constraints, not secondary metrics.

Checklist

1. Define the Problem and Protect the Workspace

  • Resolve the user-visible problem, affected workflow, target metric, workload, environment, constraints, and acceptance threshold.
  • Run the wrong-tool gate: confirm the symptom is a performance problem rather than correctness, configuration, capacity, dependency, or observability failure.
  • Read repository instructions and inspect Git state, branches, uncommitted changes, ignored artifacts, and available isolation mechanisms.
  • Preserve user work and isolate experiments in a safe branch or worktree when changes, benchmarks, or generated artifacts could interfere.
  • Start a run-owned resource ledger with every created absolute path, worktree, process ID, cache, profile, and temporary artifact; never register pre-existing resources as cleanup targets.
  • Identify correctness, security, memory, cost, compatibility, and operational constraints that no optimization may violate.
  • Locate existing benchmarks, profiles, performance tests, production traces, service-level objectives, and known environmental variability.

2. Establish a Reproducible Baseline

  • Use the same metric type as the observed problem: latency distribution, throughput, CPU, memory, allocation, I/O, query count, lock wait, or another direct measure.
  • Make the workload representative and deterministic enough to compare, including data size, concurrency, cache state, warmup, and build mode.
  • Cover the operating points that could reverse the conclusion--at minimum the reported case plus relevant data-size or concurrency boundaries--without inventing synthetic scale.
  • Run enough repetitions to expose noise and record raw results, median or appropriate percentile, spread, failures, and environment details.
  • When drift or noise is material, interleave or randomize baseline and candidate runs and prefer paired comparisons over one block of "before" followed by one block of "after."
  • Verify that the benchmark detects an intentionally slower or obviou
阅读完整来源 ↗