653
GitHub Stars
1
Bundled Files
3 weeks ago
Catalog Refreshed
2 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstart where the catalogue uses aiagentskills.
npx veilstart add skill dropseed/plain --skill plain-optimize- SKILL.md874 B
Overview
This skill captures and analyzes performance traces to surface slow queries and N+1 problems in Python web applications. It guides you from trace collection through analysis to verifying improvements, focusing on database hotspots and inefficient request paths. Use it to prioritize fixes that yield measurable latency and resource gains.
How this skill works
The skill instruments requests to record detailed traces, including database calls and timing information. You locate traces by request ID, inspect a trace in JSON to see spans and query patterns, and identify bottlenecks such as repeated similar queries or slow single queries. After fixes are applied, you re-run traces to confirm reduced latency and fewer redundant queries.
When to use it
- When an endpoint shows high latency or unpredictable response times.
- When profiling suggests many database queries per request (potential N+1).
- When investigating production incidents tied to DB performance.
- When planning targeted optimizations before adding caching or scaling.
- When validating the impact of index additions or ORM changes.
Best practices
- Capture traces for representative requests and user contexts, not just synthetic calls.
- Look for many similar query spans to spot N+1 issues before optimizing other areas.
- Prefer ORM techniques like select_related() and prefetch_related() to eliminate N+1 queries.
- Add indexes based on slow query patterns and verify with post-change traces.
- Measure before and after with identical scenarios to ensure changes help.
Example use cases
- Investigate an API route that slows under load to find missing indexes or heavy joins.
- Detect and fix N+1 in a list view that issues a query per item.
- Confirm that adding select_related() reduced query count and latency for a page.
- Validate that a new index speeds up a frequent filter used in production queries.
- Assess whether caching an expensive computation meaningfully reduces request time.
FAQ
Enable tracing for a request and persist the observer header when making the request so the trace is recorded for later inspection.
What indicates an N+1 problem in a trace?
Many repeated similar query spans for different object IDs or rows, often clustered in a single request span.
How do I verify that my fix worked?
Re-run the same traced request, compare the trace JSON for reduced query counts and faster span durations, and measure end-to-end latency.