# Debug Latency

> 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.

- **Type:** Skill
- **Install:** `agentstack add skill-pvnarp-agent-skills-debug-latency`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [pvnarp](https://agentstack.voostack.com/s/pvnarp)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [pvnarp](https://github.com/pvnarp)
- **Source:** https://github.com/pvnarp/agent-skills/tree/main/skills/debug-latency

## Install

```sh
agentstack add skill-pvnarp-agent-skills-debug-latency
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [pvnarp](https://github.com/pvnarp)
- **Source:** [pvnarp/agent-skills](https://github.com/pvnarp/agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-pvnarp-agent-skills-debug-latency
- Seller: https://agentstack.voostack.com/s/pvnarp
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
