agentleFS
pvnarppvnarp/agent-skills/skills/debug-latency/SKILL.md

debug-latency

Skill1 starsChanged 9 months agoMITView on GitHub

Diagnoses and fixes latency issues across the full request/response path. Traces from user action to visible feedback across all system layers. Use when investigating lag, slow responses, or latency complaints.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    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:

    No heavy computation blocking the main/UI thread

    line 14
  2. Distinctive:

    No redundant re-renders or recomputations before sending

    line 16
  3. Distinctive:

    No connection pooling (new TCP + TLS per request)

    line 32
  4. Distinctive:

    No N+1 query patterns

    line 41
  5. Distinctive:

    No unnecessary serialization/deserialization

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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

Latency Diagnosis

Trace the FULL path from trigger to response. Latency hides in the handoffs between components.

1. Client-Side Latency (User Action → Request Sent)

Check:

  • Event handler fires immediately on user action (no debounce/throttle unless intentional)
  • No heavy computation blocking the main/UI thread
  • Request constructed and sent without unnecessary delays
  • No redundant re-renders or recomputations before sending

Common culprits:

  • Heavy synchronous work on UI thread
  • Unnecessary state updates triggering re-renders before the actual action
  • DNS resolution on first request (cold start)

2. Network Latency (Request → Server Receives)

Check:

  • Connection reuse (keep-alive, HTTP/2)
  • Payload size reasonable (compress large bodies)
  • CDN or edge caching for static/cacheable content
  • TLS handshake overhead on new connections

Common culprits:

  • No connection pooling (new TCP + TLS per request)
  • Large uncompressed payloads
  • Wrong region (server far from users)
  • Missing CDN for static assets

3. Server Processing Latency (Receive → Response Ready)

Check:

  • Database queries use indexes (check EXPLAIN)
  • No N+1 query patterns
  • Expensive operations are cached
  • External service calls have timeouts
  • No unnecessary serialization/deserialization

Common culprits:

  • Missing database indexes (full table scans)
  • Synchronous external API calls that could be parallel
  • Lock contention on shared resources
  • Logging or tracing overhead in hot paths

4. Response Latency (Server Sends → User Sees Result)

Check:

  • Response size minimized (no over-fetching)
  • Streaming for large responses where possible
  • Client-side rendering/parsing efficient
  • UI updates immediately on data arrival (no artificial delays)

Common culprits:

  • Sending entire objects when client needs one field
  • Waiting for all data before rendering (could stream/paginate)
  • Heavy client-side processing of response data

Output

CLIENT PATH:  [action] → [handler] → [request] | Est: Xms
NETWORK PATH: [send] → [receive]               | Est: Xms
SERVER PATH:  [receive] → [process] → [respond] | Est: Xms
RENDER PATH:  [receive] → [parse] → [display]   | Est: Xms
TOTAL: ~Xms

FIXES (priority):
1. [fix] - saves ~Xms
2. [fix] - saves ~Xms

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.