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

performance-aware-coding

Use during implementation or review when changes touch repeated work, growing data, rendering, I/O, persistence, or resource use, and when investigating a performance issue. Provides stack-neutral cost analysis, on-demand ecosystem research, and evidence-based validation.

LordGhostX · 已有静态检查记录

安装与使用

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

npx skills add LordGhostX/agents-skills --skill performance-aware-coding

技能说明


name: performance-aware-coding description: Use during implementation or review when changes touch repeated work, growing data, rendering, I/O, persistence, or resource use, and when investigating a performance issue. Provides stack-neutral cost analysis, on-demand ecosystem research, and evidence-based validation.

Performance-Aware Coding

Help prevent avoidable performance costs while preserving behavior. Apply a brief cost check when a change touches work that repeats, sits on a latency-sensitive path, or grows with data or traffic. Do deeper investigation when the user asks for it, the code or workload suggests material impact, or evidence points to a bottleneck. This guidance applies across interactive UI, APIs, data access, background work, command-line tools, and other runtime paths; do not divide the method by language or framework.

Choose the right depth

  • While implementing a feature: inspect the affected path and do a quick cost pass. Call out or change a concern only when there is a concrete mechanism and a plausible impact; don't turn routine work into a performance audit.
  • When investigating or reviewing performance: map the path and workload, use measurements or the smallest useful diagnostic to locate the bottleneck, rank candidate fixes, and validate the result.
  • When there is no concrete issue: say so briefly when relevant. No findings is a valid result; do not generate generic advice to fill space.

Understand the path and workload

  1. Read applicable repository instructions. Inspect the changed code, its entry point, immediate callers, and the next relevant operations. Keep the investigation scoped to the path that could carry the cost.
  2. Locate where the work runs: for example, once per page load, interaction, request, record, retry, batch, or scheduled job. Note whether it is user-blocking, on a shared resource, or off the critical path.
  3. Use repository evidence to understand bounds and workload: collection sizes, page limits, payloads, request rates, concurrency, refresh frequency, existing performance budgets, telemetry, and benchmarks. Ask the user only for missing information that could materially change the recommendation; otherwise proceed and label the uncertainty.
  4. Name the performance objective that matters for this path. It may be response or interaction latency, tail latency, throughput, CPU, memory, allocations, I/O, query count, payload size, startup time, or another concrete measure. Avoid optimizing a proxy that does not represent the user's goal.

Research the actual stack as needed

  • Identify the runtime, framework, dependency versions, data stores, providers, and build tools from manifests and actual call sites. Do not assume an API, execution model, cache behavior, or performance characteristic based on familiarity with another stack.
  • When a decision depends on a library or runtime detail, inspect the installed version's types, implementation, and current primary documentation. For profiler commands and platform behavior, look up the current tool guidance for the project in front of you.
  • Prefer tools already configured in the repository. Choose a profiler or trace that can answer the question at hand; do not install dependencies or add instrumentation merely because a tool is commonly used.
  • Use general performance principles first, then translate them into the detected stack. Do not preload or reproduce separate language playbooks when targeted research can resolve the specific question.

Look for concrete costs

These are cues for inspection, not findings on their own:

  • Repeated work: a full scan, sort, normalization, parse, date/string formatting, conversion, or serialization repeated for each item; nested loops or repeated lookups whose cost grows with the input.
  • Chatty I/O: a query or network/provider call inside a per-item loop, duplicate reads, one update per record, repeated setup/probe calls, or sequential request dependencies that create a waterfall.
  • Excess data movement: cloning or copying large values, repeated encoding/decoding, rebuilding equivalent objects, transferring fields the caller does not use, or expensive work on a UI/main thread or request path.
  • Unbounded work: outbound calls or pool waits without effective time bounds, missing pagination or limits, unbounded buffers or queues, excessive or synchronized retries, uncontrolled fan-out, or work that grows with input size without a justified bound.
  • Contention and waiting: lock or pool contention, blocked event loops or threads, serialized independent operations, and background work competing with critical paths.
  • Frontend delivery and interaction: repeated data fetches, avoidable waterfalls, oversized assets or bundles, expensive render/update work, layout or main-thread blocking, and work done before it is needed.
  • Backend request and data paths: N+1 access patterns, repeated provider calls, poor query shapes, unnecessary setup work, oversized responses, and expensive per-request computation.

For each candidate, connect the code location to its repetition or growth, where it sits in the path, and the workload under which it matters. Check for counter-evidence such as small enforced limits, existing memoization, batching, caching, lazy loading, or a library that already performs the work.

Select a proportionate fix

  • Prefer removing unnecessary work and fixing algorithmic or structural causes before tuning small operations. A suitable lookup structure may replace repeated scans; one batch operation may replace per-item I/O; an existing result may be reused instead of fetched or derived again.
  • For database write paths, compare row-by-row calls, the driver's batch API, and set-based SQL at realistic batch sizes. Fewer round trips alone do not prove a faster path.
  • Combine or parallelize independent work only when the API and semantics support it. Bound concurrency and preserve requ
阅读完整来源 ↗