agentleFS
JustinK33JustinK33/foreman/skills/perf/SKILL.md

perf

Skill3 starsChanged 56 days agoMITView on GitHub

Use when the user asks to improve performance, find bottlenecks, optimize the backend, or speed something up.

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use incident, scaffold and 8 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.
  • JkudjoSkill

    incident

    Production incident response — structured triage, hypothesis tree, safe remediation, incident record

    Also in 4 projects that use this

  • BerryKuipersSkill

    scaffold

    Detect project stack, apply architecture patterns, wire quality gates, and scaffold features. Use when bootstrapping a project, adding a vertical slice, wiring CI/CD, adding Docker compose, or setting up quality gates.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    test

    Also in 6 projects that use this

  • GitHubSkill

    refactor

    Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

    Also in 6 projects that use this

  • AnthropicSkill

    debug

    Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.

    Also in 7 projects that use this

  • NVIDIASkill

    preflight

    Use before a debugging workflow, when asked to check the environment, or when the local CLI tools needed for the requested task are not working.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read replicas or caching layers for read-heavy workloads.

    line 38
  2. Distinctive:

    Always name what a design change costs (consistency, complexity, operational surface) alongside what it buys.

    line 43
  3. Distinctive:

    Don't micro-optimize code that isn't on a hot path.

    line 47
  4. Distinctive:

    Don't recommend a caching layer, queue, or read replica as a first move if the actual problem is a missing index or an N+1 query, fix the …

    line 48
  5. Distinctive:

    Don't sacrifice correctness or readability for a speedup that hasn't been shown to matter.

    line 49

“Common” is measured: kept by at least 6 in 10 of the 19 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

Performance Review

Measure before you change anything, and change the thing that's actually slow, not the thing that's easiest to rewrite.

What to look at

$ARGUMENTS, when that is not empty. It is usually an endpoint (GET /reports), a function name, or a path. Find the code that serves it before theorizing about it.

With no argument, ask what is slow. "Optimize this codebase" has no measurable answer, and guessing at one is how you spend a day on a function called once at startup.

Method

  1. Find the bottleneck, don't guess it. Look for profiling data, logs, query timings, or APM traces first. If none exist, say so and either ask for a profile or reason from the code's structure (loop nesting, query patterns) while being explicit that this is an estimate, not a measurement.
  2. Prioritize by impact x frequency, not by what looks inelegant. A slightly ugly function called once at startup matters less than a mediocre one called per-request.
  3. Fix, then re-measure. A performance fix without a before/after number is a guess that happened to compile.

Backend patterns to check, roughly by how often they're the real cause

  1. N+1 queries - a loop that issues one query per iteration instead of one batched query (SELECT in a loop over an ORM relationship is the classic case). Usually the single highest-impact fix available.
  2. Missing or wrong indexes - slow queries on columns used in WHERE, JOIN, or ORDER BY without a supporting index; also indexes that exist but aren't used because of a function wrapped around the column or a type mismatch.
  3. Unbounded result sets - loading an entire table into memory instead of paginating, streaming, or filtering at the database layer.
  4. Synchronous I/O blocking a request path that doesn't need it - sequential awaited calls to independent services instead of concurrent ones; blocking calls on an async runtime's event loop.
  5. Missing caching for expensive, repeatable work - the same computation or query re-run per request when the result is stable for some useful window. Also check the inverse: caching that's gone stale or is invalidated incorrectly, which is worse than no cache.
  6. Algorithmic complexity - an O(n^2) pass over data that's routinely large, where a hash map or a single sorted pass gets it to O(n) or O(n log n). Only worth flagging where n is actually large in practice.
  7. Connection/resource churn - opening a new DB connection, HTTP client, or thread pool per request instead of reusing a pool.
  8. Serialization overhead - large payloads serialized/deserialized in full when only a subset of fields is needed downstream.

Design-level changes (bigger lever, bigger cost, mention with the tradeoff attached)

  • Read replicas or caching layers for read-heavy workloads.
  • Moving work off the request path into a background job/queue when the caller doesn't need the result synchronously.
  • Denormalizing a hot-path read to avoid an expensive join, at the cost of write complexity and eventual-consistency risk, state that cost explicitly.
  • Batching/debouncing high-frequency writes.

Always name what a design change costs (consistency, complexity, operational surface) alongside what it buys. A recommendation without the tradeoff isn't a complete recommendation.

What not to do

  • Don't micro-optimize code that isn't on a hot path; that's wasted effort and adds noise to the diff.
  • Don't recommend a caching layer, queue, or read replica as a first move if the actual problem is a missing index or an N+1 query, fix the cheap thing first.
  • Don't sacrifice correctness or readability for a speedup that hasn't been shown to matter. The fastest code is often also the simplest, but not always: when speed and clarity genuinely trade off, say so explicitly instead of quietly picking one.

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.