mit einem Klick
plain-optimize
// Captures and analyzes performance traces to identify slow queries and N+1 problems. Use when a page is slow, there are too many queries, or the user asks about performance.
// Captures and analyzes performance traces to identify slow queries and N+1 problems. Use when a page is slow, there are too many queries, or the user asks about performance.
| name | plain-optimize |
| description | Captures and analyzes performance traces to identify slow queries and N+1 problems. Use when a page is slow, there are too many queries, or the user asks about performance. |
| context | fork |
Make a request and get structured JSON — response metadata plus a full trace analysis:
uv run plain request /path --json
uv run plain request /path --json --user 1
uv run plain request /path --json --method POST --data '{"key": "value"}'
The --user flag accepts a user ID or email.
The trace object has two parts — analysis (derived) and spans (raw):
analysis.query_count / analysis.duplicate_query_count — query summaryanalysis.duration_ms — total trace durationanalysis.issues — pre-detected problems (N+1 queries, exceptions)analysis.queries — each unique query with count, total duration, and source locationsspans — raw OpenTelemetry spans, a flat list (parent_span_id gives the structure)Check analysis.issues first — duplicate queries are flagged automatically with source locations. Then review:
total_duration_ms)select_related() / prefetch_related() for N+1Re-run uv run plain request /path --json and compare analysis.query_count, analysis.duplicate_query_count, and analysis.duration_ms.
Upgrades Plain packages and applies required migration changes. Use when updating to newer package versions.
Answer questions about the Plain framework by researching docs and source code. Use when asked "how do I...", "does Plain support...", or "how does X work?" questions.
Check overall database health — schema correctness and operational health. Use when asked to check the database, validate schema, optimize indexes, or diagnose Postgres problems.
Submit a bug report for the Plain framework. Use when the user wants to report a bug, error, or unexpected behavior. Collects context and creates a GitHub issue.
Open a remote Python shell on a production machine via encrypted tunnel. Use when you need to inspect production data, debug issues, run queries, or transfer files.
Releases Plain packages with intelligent version suggestions and parallel release notes generation. Use when releasing packages to PyPI.