- Home
- Skills
- Letsrevel
- Revel Backend
- Silk Debug
silk-debug_skill
- Python
69
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 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 veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill letsrevel/revel-backend --skill silk-debug- SKILL.md4.9 KB
Overview
This skill analyzes Django Silk profiling data to help debug slow requests, detect N+1 queries, and optimize database performance. It provides per-request diagnostics, aggregated endpoint stats, and actionable recommendations for fixing expensive queries and redundant work. Use it to quickly pinpoint DB hotspots and prioritize fixes that reduce latency.
How this skill works
Given a Silk request ID or a set of stored profiles, the tool inspects request metadata, SQL statements, execution timing, and optional Python cProfile output. It identifies duplicate or similar queries (N+1 patterns), flags slow queries above a configurable threshold, groups queries by table, and renders a timeline of query execution and gaps. Aggregate commands compute endpoint P95, slow-endpoint lists, and overall DB vs Python time breakdowns.
When to use it
- Investigating a single slow request by request ID to see exact queries and timeline
- Detecting N+1 query patterns after noticing many similar SQL statements in a request
- Profiling endpoints to find which paths contribute most to DB time (P95 or slow endpoints)
- Before and after applying a DB index or query change to validate impact
- Auditing batched operations to verify usage of bulk APIs and avoid per-item queries
Best practices
- Start with --list and sorting by db_time or duration to prioritize heavy endpoints
- Use --full on a representative slow request to see duplicates, slow queries, timeline, and cProfile together
- Treat repeated identical queries as N+1 candidates; fix with select_related/prefetch_related
- For expensive COUNT DISTINCT patterns, materialize IDs first and then filter with an IN clause
- Prefer bulk_create and prefetch shared data when creating or processing many objects
Example use cases
- Find the request that generated the most DB time this hour and inspect its timeline
- Diagnose an endpoint that times out by listing requests and filtering by min-time
- Confirm an index addition reduced P95 DB time by comparing endpoint summaries before/after
- Detect and fix a view that issues 20 similar queries by converting queries to prefetch_related
- Identify Python-side gaps between queries to determine if CPU or I/O work is delaying DB calls
FAQ
It groups similar SQL statements by structure and parameters and reports repeated occurrences that suggest the same query ran multiple times for different inputs.
What threshold is used for slow queries?
The default slow-query threshold is 5 ms, but you can customize it with --slow-threshold N (milliseconds).