Token导航 LogoToken导航

Agent Skill · 研究检索

query-optimize(查询优化)

query-optimize 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

query-optimize 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 45,286。

总安装 857周安装 35GitHub Stars 93下载 277核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:query-optimize(查询优化)
来源仓库:https://github.com/letta-ai/skills
仓库路径:skills/query-optimize
安装命令:
npx skills add https://github.com/letta-ai/skills --skill query-optimize
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/letta-ai/skills --skill query-optimize

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息,支持关键词快速定位候选结果。适合在开发过程中根据任务场景或来源线索获取技术资料。可结合仓库 README 核验具体用法,提升信息检索效率。安装前建议确认权限范围和维护状态,避免触发不必要的网络或文件操作。适用于 Codex、Claude、Cursor 等主流 AI 宿主环境。

来源仓库内路径:skills/query-optimize

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/letta-ai/skills --skill query-optimize;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

query-optimize 怎么安装?

在终端执行 npx skills add https://github.com/letta-ai/skills --skill query-optimize。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

query-optimize 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

query-optimize 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

query-optimize 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

query-optimize 用的人多吗?

公开数据是累计安装 857 次,近一周安装 35 次,下载 277 次,GitHub 93 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

query-optimize 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
query-optimize

查询优化 · 本页

85793只读MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

SQL Query Optimization

This skill provides procedural guidance for optimizing SQL queries effectively, with emphasis on proper benchmarking, query plan analysis, and iterative refinement.

Core Optimization Workflow

1. Establish Performance Baselines

Before making any changes, establish clear performance metrics:

  • Identify the target: Determine what "optimal" performance looks like. Look for reference implementations, documented benchmarks, or theoretical analysis of query complexity.
  • Measure the original query: Record execution time with multiple runs to account for caching effects.
  • Document the goal: Define success as "as fast as possible" not just "faster than the original."

2. Analyze Query Plans

Always use query plan analysis before and after optimization:

-- SQLite
EXPLAIN QUERY PLAN <query>;

-- PostgreSQL
EXPLAIN ANALYZE <query>;

-- MySQL
EXPLAIN <query>;

Key indicators to look for in query plans:

  • Full table scans (SCAN TABLE) vs index usage (SEARCH TABLE USING INDEX)
  • Correlated subqueries executing per-row
  • Temporary B-tree creation for sorting/grouping
  • Materialization of intermediate results
  • Join order and join types

3. Identify Common Performance Issues

Correlated Subqueries: Subqueries that reference outer query columns execute once per row. Transform to JOINs or CTEs when possible.

Repeated Computations: The same subquery appearing multiple times should be factored out into a CTE or subquery.

Missing Indexes: Check for indexes on columns used in WHERE, JOIN, and ORDER BY clauses.

Inefficient Aggregations: GROUP BY on large result sets before filtering. Consider filtering earlier with WHERE.

4. Apply Optimization Techniques

Consider multiple approaches rather than stopping at the first working solution:

Approach 1: CTEs (Common Table Expressions)

  • Pre-compute values used multiple times
  • Improve readability
  • Note: Some databases materialize CTEs which may hurt performance

Approach 2: Window Functions

  • Efficient for ranking, running totals, and row numbering
  • Avoid when simpler alternatives exist

Approach 3: Subquery Restructuring

  • Convert correlated subqueries to JOINs
  • Push predicates into subqueries to reduce intermediate result sizes

Approach 4: Join Optimization

  • Reorder joins to filter early
  • Use appropriate join types (INNER vs LEFT)
  • Consider join hints if available

5. Database-Specific Considerations

SQLite:

  • No parallel query execution
  • CTEs may be materialized (can hurt performance)
  • Limited optimizer compared to enterprise databases
  • Consider using covering indexes

PostgreSQL:

  • Supports parallel execution
  • Advanced optimizer with cost-based decisions
  • CTEs are optimization barriers in older versions (< 12)

MySQL:

  • Derived table materialization can be forced or avoided
  • Index hints available when optimizer makes poor choices

Verification Strategy

Correctness Verification

  1. Full result comparison: Compare all rows and columns against the original query output
  2. Edge case testing: Test with NULL values, empty results, ties in sorting/ranking
  3. Sample verification is insufficient: If the full result set is too large, use checksums or row counts with spot checks

Performance Verification

  1. Multiple runs: Execute at least 3-5 times and use median time
  2. Cold vs warm cache: Test both scenarios if relevant
  3. Compare against optimal: If a reference solution exists, compare against it, not just the original slow query
  4. Incremental profiling: Measure each CTE or subquery independently to identify bottlenecks

Common Pitfalls

Satisficing vs Optimizing

  • Problem: Stopping optimization when query is "faster than before" rather than "as fast as possible"
  • Prevention: Always establish what optimal performance looks like before starting. Compare against known-good implementations when available.

Skipping Query Plan Analysis

  • Problem: Making changes without understanding why the query is slow
  • Prevention: Always run EXPLAIN before and after changes. Understand the query plan before proposing solutions.

Premature CTE Usage

  • Problem: Assuming CTEs always improve performance. Some databases materialize CTEs, adding overhead.
  • Prevention: Test both CTE and non-CTE versions. Profile each CTE independently.

Over-reliance on Window Functions

  • Problem: Using ROW_NUMBER() or similar when simpler approaches work
  • Prevention: Consider if a GROUP BY with MIN/MAX or a simple correlated subquery might be more efficient.

Incomplete Testing

  • Problem: Verifying only a sample of rows due to timeouts
  • Prevention: Use checksums, row counts, or hash comparisons for full validation. Test with smaller data subsets first.

Single-Approach Optimization

  • Problem: Implementing one optimization approach without exploring alternatives
  • Prevention: Always test at least 2-3 different approaches before selecting the best one.

Iterative Refinement Process

  1. Analyze the original query and its plan
  2. Identify the primary bottleneck
  3. Propose 2-3 alternative approaches
  4. Implement and benchmark each approach
  5. Select the best performing approach
  6. Verify correctness with full result comparison
  7. Document the optimization rationale

Checklist Before Declaring Success

  • Query plan analyzed and understood
  • Multiple optimization approaches considered
  • Performance compared against optimal/reference (not just original)
  • Full result correctness verified (not just samples)
  • Edge cases tested (NULLs, ties, empty results)
  • Performance measured across multiple runs
  • Database-specific optimizations considered

平台分布

Claude Code

28.89%
按下载量换算80

Gemini CLI

21.83%
按下载量换算60

Codex

16.27%
按下载量换算45

Antigravity

12.34%
按下载量换算34

OpenCode

7.72%
按下载量换算21

windsurf

3.37%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills