agentleFS
wheeloswheelos/apollo-lite/.agents/skills/performance-optimization/SKILL.md

performance-optimization

Skill177 starsChanged 7 days agoApache-2.0View on GitHub

Measure before optimizing; collect profiles, identify the dominant bottleneck, and verify controlled improvements. Use for performance analysis, hotspot profiling, latency, CPU/GPU, memory growth, throughput, lock contention, and scheduler waits.

133 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use constraint-driven-development, using-agent-skills and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 16 projects that use this

  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 34 projects that use this

  • LLl0k0laDSkill

    git-workflow-and-versioning

    Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.

    Also in 43 projects that use this

  • HK-hubSkill

    deprecation-and-migration

    Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.

    Also in 40 projects that use this

  • HK-hubSkill

    observability-and-instrumentation

    Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.

    Also in 32 projects that use this

  • +7 more from LLl0k0laD

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 14 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 118 edited versions we read keep these.

  • 14

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use for resource-consumption or real-time-budget issues.

    line 10
  2. Very specific:

    If the primary symptom is a functional error, start with issue-localization.

    line 13
  3. Distinctive:

    Read the module contract, existing performance tools, and test entry points.

    line 15
  4. Distinctive:

    Use approved environments and permissions.

    line 17
  5. Distinctive:

    Do not stop another person's process or automatically change CPU frequency, affinity, or GPU power settings.

    line 34
  6. Distinctive:

    Use low-cost counters and per-stage timing to locate the area first, then select call-stack sampling, tracing, memory, lock, or GPU tools …

    line 39
  7. Distinctive:

    Check queue waits, upstream supply, and consumer rate limits so that waiting is not misdiagnosed as slow computation.

    line 61
  8. Distinctive:

    Test one primary causal hypothesis at a time.

    line 71
  9. Distinctive:

    Before implementation, check correctness, thread safety, data freshness, memory, and worst-case latency constraints.

    line 74
  10. Distinctive:

    If the difference falls within noise, state that no reliable improvement has been demonstrated.

    line 93
  11. Distinctive:

    Use a comparison without heavyweight profiling to confirm that an apparent gain is not merely a profiler artifact.

    line 97
  12. Distinctive:

    Run correctness regressions covering the change.

    line 100
  13. Distinctive:

    If only analysis was completed, report the confirmed bottleneck and next discriminating experiment.

    line 111
  14. Distinctive:

    If a tool is missing, permissions are insufficient, or profiling overhead is too high, stop that collection and use existing low-cost …

    line 116
  15. Distinctive:

    If the alternative cannot support a conclusion, state the blocker.

    line 118
  16. Distinctive:

    If no hotspot is found, continue narrowing the scope rather than optimizing randomly.

    line 120

“Common” is measured: kept by at least 6 in 10 of the 118 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Evidence-Driven Performance Optimization

Scope and prerequisites

Use for resource-consumption or real-time-budget issues. Analyze, measure, and attribute the bottleneck before optimizing; do not guess hotspots from code appearance. If the primary symptom is a functional error, start with issue-localization. Read the module contract, existing performance tools, and test entry points; see the skill index for authoritative command references. Use approved environments and permissions. Do not automatically install a profiler or change shared-machine runtime settings.

Workflow

1. Define metrics and freeze conditions

Define metrics, measurement intervals, the current problem, and target budgets, based on user-visible behavior or contractual requirements. Distinguish end-to-end latency, per-stage time, CPU time, throughput, memory peak, and long-term growth. Select mean, tail latency, deadline misses, or frame-drop rate as appropriate; they are not interchangeable.

Fix code and dependency versions, build mode, hardware, container, data, configuration, concurrency, and replay rate. Record warm-up, cache state, input volume, other loads, and measurement overhead. If a shared environment cannot be isolated, report the limitation. Do not stop another person's process or automatically change CPU frequency, affinity, or GPU power settings.

2. Measure a baseline, then localize the bottleneck layer by layer

Use low-cost counters and per-stage timing to locate the area first, then select call-stack sampling, tracing, memory, lock, or GPU tools based on evidence. Do not enable every heavyweight profiler before understanding the problem. Save the profiling scope, tool parameters, and raw results; do not repeat collection when existing evidence is sufficient.

Distinguish bottleneck types:

  • Compute: CPU/GPU core work, repeated computation, or growth in problem size.
  • Data: Copying, allocation, serialization, I/O, cache, or memory bandwidth.
  • Waiting: Locks, queues, scheduling, inter-process communication, and downstream backpressure.
  • Memory: Peak, retention, fragmentation, and continued growth; an increase in RSS does not by itself mean a leak.

Explain hotspots using call counts, input size, inclusive/self time, and the critical path. A CPU hotspot does not necessarily cause wall-clock latency. Asynchronous GPU submission time does not mean the kernel has completed; measure at the appropriate completion boundary and state how synchronization perturbs production execution. Check queue waits, upstream supply, and consumer rate limits so that waiting is not misdiagnosed as slow computation.

3. Form an optimization hypothesis

State the chain “evidence → dominant bottleneck → cause → minimal change → expected observable change.” Prioritize the modifiable cause that contributes most to the target metric, estimate the upper bound of its overall benefit, and avoid optimizing expensive functions that are not on the critical path. Test one primary causal hypothesis at a time; do not combine algorithm, thread-count, precision, and cache-policy changes in one experiment.

Before implementation, check correctness, thread safety, data freshness, memory, and worst-case latency constraints. Reducing precision, scenario coverage, or data; increasing caches; or changing behavior is not a free optimization. Make the trade-off explicit and obtain necessary confirmation.

4. Validate a comparison under equivalent conditions

Compare baseline and change using the same input, build mode, metric definition, and timing boundaries. Warm up for steady-state metrics. Keep separate cold-start measurements for cold-start issues; do not use warm-up to hide the cost. Repeat samples based on variability and required decision precision. When useful, interleave baseline and candidate runs to reduce environmental drift. Preserve every sample, sample count, and distribution; do not present a microbenchmark's repeated mean as per-frame P99.

Report absolute values, relative changes, variability, and whether pre-agreed thresholds were met. If the difference falls within noise, state that no reliable improvement has been demonstrated; do not cherry-pick the best run. Microbenchmarks validate local mechanisms; end-to-end performance claims still require evidence under the relevant workload. Use a comparison without heavyweight profiling to confirm that an apparent gain is not merely a profiler artifact.

Run correctness regressions covering the change. Confirm that cost was not shifted to other threads, the GPU, memory, or downstream components and that algorithm quality and tail latency were not sacrificed. Stop once evidence is sufficient.

Deliverables and acceptance

Report workload and environment, metrics and budgets, baseline, profiling evidence, bottleneck attribution, changes, comparison samples, correctness results, and remaining limitations. Performance conclusions must be traceable to raw results. If only analysis was completed, report the confirmed bottleneck and next discriminating experiment; do not claim optimization.

Failure handling

If a tool is missing, permissions are insufficient, or profiling overhead is too high, stop that collection and use existing low-cost evidence. If the alternative cannot support a conclusion, state the blocker. Ask before installing tools or changing the environment. If no hotspot is found, continue narrowing the scope rather than optimizing randomly. Recheck the hypothesis when gains are unstable or functional regressions occur. Revert only experimental changes that are clearly separable and yours; preserve others' work.

Basis

Reuse the performance-layering approach from existing context; comparative measurement is informed by Google Benchmark. This workflow includes its own validation steps and does not depend on the currently missing performance-testing.md or require a new benchmark library.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.