query-pattern-analysis
Analyzes query behavior for correctness and performance risk. Use when a request changes filtering, pagination, aggregation, eager loading, write batching or another query path that real data volume could regress.
- License 许可
- MIT
- 所属仓库
- Eliyce/paqad-ai
- 最近更新
- 2026-11-13
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- query-pattern-analysis
- metadata
- { "cacheable": "true", "model_tier": "reasoning", "paqad-meta": "skill.meta.yaml", "output_format": "markdown" }
- description
- Analyzes query behavior for correctness and performance risk. Use when a request changes filtering, pagination, aggregation, eager loading, write batching or another query path that real data volume could regress.
02 资源文件 7
- 参考文档agents/openai.yaml132 B
- 资产文件assets/output.template.md470 B
- 资产文件assets/risk-rules.txt665 B
- 参考文档references/query-risk-guide.md237 B
- 脚本scripts/lint-output.sh751 B
- 脚本scripts/scan-query-risks.sh1.4 KB
- 参考文档skill.meta.yaml374 B
03 SKILL.md 正文
What It Does
Analyzes changed query behavior for correctness, safety, and runtime cost so new data access patterns are reviewed against realistic usage rather than tiny fixture assumptions.
Use This When
When a request changes filtering, pagination, aggregation, eager loading, write batching, or any query path that could regress with real data volume.
Inputs
- Read the changed query code and the module query/schema docs first.
- Read
references/query-risk-guide.mdbefore classifying issues. - Read any existing performance rules or query inventories relevant to the stack.
Procedure
- Run
scripts/scan-query-risks.sh <files...>to surface candidate risks (orm-find-in-loop, await-in-map, select-*, unbounded pagination, ORDER BY RANDOM, leading-wildcard LIKE, group-having). - For each hit, look up the remediation rule in
assets/risk-rules.txt. - Confirm whether the changed query relies on schema/index assumptions; treat missing index as a Migration Safety risk, not Performance.
- Bucket findings per
assets/output.template.md. - Validate with
scripts/lint-output.sh.
Output Contract
- Return sections named
Correctness Risks,Migration Safety Risks, andPerformance Risks. - Each finding must name the affected query path and the user or operational impact.
- If one bucket has no issues, write it explicitly as
none.
Escalate / Stop Conditions
- Ask when expected row counts, pagination strategy, or consistency rules are unknown and would change the analysis.
- Warn when a query relies on undefined ordering, broad scans, or hidden fan-out behavior.
- Do not treat micro-optimizations as findings if the changed behavior is not on a meaningful path.
Resources
references/query-risk-guide.mdscripts/scan-query-risks.shscripts/lint-output.shassets/output.template.mdassets/risk-rules.txtruntime/capabilities/coding/stacks/laravel/rules/performance/guide.mdagents/openai.yaml
04 同仓库更多 Skills
sample-skill
Sample bundled skill fixture
processing-invoices
Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.
processing-invoices
Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.
understand-idea
Chat and Claude Code: Step 1 of the discover journey: clarifies the goal, who benefits, success and constraints into the idea block. Use when the journey directs it to step 1, not directly.
size-work
Chat and Claude Code: Suggest a size for a ticket from comparable finished work, as a labelled suggestion the team still owns. Use it when someone asks "how big is this?", "roughly how much work is ABC-12?", or wants a backlog item sized. It finds the team's sizing scale at first use, picks two to five of the closest finished tickets with links, and gives a size or range with the drivers behind it and a confidence of low, medium or high, lowered and explained when the area's documents are template text. Every result is labelled a suggested size, never a date or a commitment. It writes nothing into the size field unless the user says "set it", and it refuses to overwrite an existing size unless the user asks to replace it. Produces the sizing block of the record.
refine-ticket
Chat and Claude Code: Improve one or more existing tracker tickets without losing the author's intent. Use it when someone wants a ticket read, diagnosed and tidied up ("this ticket is vague", "fix up ABC-12", "split this, it's too big"). It reads each ticket in full and snapshots it with its last-updated time, says what is wrong with evidence, and proposes a field-by-field before and after change set limited to summary, description, labels, parent, links and new child tickets on a split. It writes nothing until an explicit "apply it" bound to that exact change set, re-checks the ticket for conflicting edits just before writing, never replaces rich descriptions with plain text, never deletes or closes a ticket, and reads each ticket back after applying. Produces the existing and changes blocks of the record.