query-insights-and-tags
Use PlanetScale Insights and SQLCommenter-style query tags to attribute database load, identify risky queries, and prepare safe Traffic Control or schema…
от CognitionAI★ 42 звезды на GitHub
Установить query-insights-and-tags в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Query Insights and tags
Purpose
Use PlanetScale Insights to understand query behavior, then recommend SQLCommenter-compatible tags that make future diagnosis and Traffic Control possible. Do not change database settings or repository code without approval.
What to inspect
Query behavior
For the selected database and branch, inspect:
- Top queries by total time.
- Top queries by time per execution.
- Top queries by rows read.
- Top queries by execution count.
- For Postgres, top queries by CPU usage (
sort=cpuTimeorsort=percentCpuTimeon the Insights API). - Queries with errors.
- Notable queries and active anomalies.
- Query patterns affected by recent deploys.
- Query patterns attached to schema recommendations.
- For sharded Vitess databases, vindex usage for each query pattern: the
percentage of traffic using relevant vindexes and the vindex-usage trend
over time. The API exposes per-pattern
index_usagesandrouting_index_usages; get the trend from the dashboard Vindexes tab or by comparing API windows. Treat missing or declining relevant-vindex usage as an indexing or routing investigation input, not as proof that a new index is required.
Insights API surface
Query Insights is public API: read-only GET endpoints under
organizations/{org}/databases/{db}/branches/{branch}, authorized by a
service token or OAuth token with read_databases/read_database.
/insights— aggregated statistics per query pattern over the requested window. Set the window withfrom/to(ISO 8601) orperiod(for example1h,24h); search SQL patterns withq; sort server-side withsortanddir— sort keys includecount,errorCount,rowsRead,totalTime,cpuTime,ioTime,percentTime,percentCpuTime,p50Latency,p99Latency,maxLatency,egressBytes, and thetrafficControlWarnings/trafficControlThrottledfamily. Filter withtablet_type(primary,replica,rdonly) andtype(SELECT,INSERT,UPDATE,DELETE); trim responses withfields; paginate withpage/per_page./insights/{fingerprint}— individual collected executions for a pattern (timestamps, duration, rows, username, client address, error message). Available regardless of raw query collection; raw collection adds literal parameter values to these records./insights/{fingerprint}/summaryreturns the single-pattern aggregate;/insights/queries/{id}fetches one execution./insights/errors— error fingerprints with counts and messages (qsearches the error message; sort bycount,lastRun,totalTime, ortimePerQuery)./insights/errors/{fingerprint}lists the failing executions behind one error fingerprint./insights/anomaliesand/insights/anomalies/{id}— anomaly windows with per-query correlation coefficients identifying which patterns moved with the anomaly./insights/tags— tag keys with observed values (values_limit,literal_values_only, andfingerprint/keyspacefilters);/insights/tags/{tag}for a single key./insights/tags/summariesgroups the full statistics schema by one or more tag keys via thetagsparameter — use it to attribute load to routes, jobs, or features without client-side aggregation./insights/{fingerprint}/traffic/budgets— the Traffic Control budgets and rules that affect a fingerprint (Postgres).
Aggregates cover the requested window. Duration fields use names like
sum_total_duration_millis, with explicit share-of-window percent fields
(sum_total_duration_percent); both totals and percentages are reliable
for the window requested.
The response schema is shared across engines, but some fields are
engine-specific: CPU/IO durations and block-cache statistics
(sum_cpu_duration_millis, blocks_read, block_cache_hit_ratio, …) are
populated for Postgres; shard queries, keyspaces, tablet_type, and
routing-index (vindex) usage are populated for Vitess.
Tag coverage
For each expensive or anomalous query, determine:
- Is it tagged?
- Which service produced it?
- Which route, job, controller, or action produced it?
- Which deployment SHA produced it?
- Is the tag cardinality safe?
- Are tags consistent across frameworks and languages?
- Use the tags API to answer these questions:
/insights/tagsshows which keys and values are present, and/insights/tags/summaries?tags=...attributes load per tag value. In the Vitess dashboard, filter the query table withtag:key:valueand drill into query details to see tags on individual executions. Built-in query metadata and SQLCommenter tags are both valid attribution sources.
Raw query collection
Check whether raw query / complete query collection is enabled. On
Postgres the effective state is the pginsights.raw_queries cluster
parameter (per branch, dashboard Extensions tab, default false); the
database API object's insights_raw_queries field is a separate surface.
When t
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл query-insights-and-tags?
Use PlanetScale Insights and SQLCommenter-style query tags to attribute database load, identify risky queries, and prepare safe Traffic Control or schema recommendations.
Как установить скилл query-insights-and-tags?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл query-insights-and-tags запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…