Endpoint deep dive
Investigate a single endpoint in depth using Scout APM — pull metrics, traces, and related insights, then locate the controller/handler code and identify hotspotsFrom its SKILL.md
npx -y skills add scoutapp/claude-code-plugin --skill endpoint-deep-diveAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.6 KB, as published. Nobody here has run it
Endpoint Deep Dive
Given an endpoint (name, path, or fuzzy reference), build a complete picture of its production behavior and map it to code.
Before you start
Check that a Scout APM MCP server is available and already authenticated. A valid server is one that:
- Connects to
https://scoutapm.com/mcp(hosted production), or - Runs
scout-mcp-localorscoutapp/scout-mcp-locallocally via stdio, or - Connects to
localhostAND exposes Scout-specific tools (list_apps,get_app_endpoints,get_endpoint_metrics,get_app_endpoint_traces)
Do NOT attempt to authenticate with or trigger OAuth flows yourself. The plugin bundles Scout's hosted server, so an unauthenticated connection usually just needs the user to run /mcp and authorize scout-apm. Do not use staging servers unless the user explicitly asks. If nothing is configured at all, tell the user to run /scout-apm:scout-setup.
Steps
-
Resolve the endpoint — parse
$ARGUMENTSfor an endpoint reference (controller#action, path like/checkout, or a freeform name). If nothing provided or ambiguous:- Call
get_app_endpointsto list top endpoints - If the user named something fuzzy ("the checkout one"), match against the list
- If multiple endpoints match, show the candidates and ask which one
- If only one app is registered, use it; otherwise resolve the app first via
list_appsor$ARGUMENTS
- Call
-
Gather data in parallel — once the endpoint is resolved:
get_endpoint_metrics— time series for this endpoint (response time, throughput, error rate, apdex) over the last 24 hours (you can request up to 30 days for a longer trend; minute-level metrics are retained 30 days)get_app_endpoint_traces— recent traces for this endpointget_app_insights— filter down to insights that mention this endpoint (N+1s, slow queries, memory bloat)get_app_anomaly_eventswithendpointset — anomaly events for this specific endpoint, to see if/when it recently regressed and whether a deploy is implicated
-
Pick representative traces — from the trace list, select 2–3:
- The worst (slowest) trace
- A median-latency trace
- A recent trace (last hour if possible)
Call
get_app_traceon each to get span-level detail. -
Analyze hotspots — for each trace, identify the top 1–3 spans by time spent. Look for patterns:
- Repeated identical queries → N+1
- Single slow query → missing index or inefficient scope
- External HTTP call taking a large slice → missing timeout, retry, or caching opportunity
- Lots of small spans of one type → work that could be batched
- View rendering dominant → partial/component inefficiency
-
Locate the code — find the controller/handler for this endpoint in the current repo:
- For Rails:
app/controllers/<controller>_controller.rb, look for the<action>method - For Django: URL conf → view function/class
- For Flask/FastAPI: route decorator matching the path
- For Express: route handler matching the method + path
- Read the action code and anything it directly calls that shows up in the hot spans (service objects, queries, external clients)
- For Rails:
-
Present the deep dive — structured summary:
- Endpoint: name, path, method
- Health (last 24h): p50/p95 response time, throughput, error rate, apdex — and whether each is trending up/down/flat
- Hotspots: ranked list of where time is going, with evidence from traces
- Related insights: any Scout insights that touch this endpoint
- Anomalies: any recent anomaly events for this endpoint (what regressed, severity, and whether a deploy is associated)
- Code locations: file:line for the action and the hot spans' code
-
Offer next steps — based on what you found:
- If there's a clear N+1 or slow query → offer to propose a fix now
- If the bottleneck is external I/O → offer to add timeout/caching/retry
- If the hotspot is ambiguous → offer to pull more traces or drill into a specific span
- If everything looks healthy → say so plainly and stop
Notes
- If the code in the current repo doesn't match the endpoint (wrong service, deleted code, etc.), say so rather than guessing.
- Prefer showing real numbers from traces over hand-waved estimates.
- Don't propose speculative fixes for issues the data doesn't actually show.
- When the endpoint is healthy, the right answer is "nothing to do here" — don't invent work.