← 返回 Skills 市场
ink5725

Index Usage Analyzer

作者 InkLin · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
39
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install index-usage-analyzer
功能描述
Analyzes database indexes and suggests redundant ones to remove for schema optimization
使用说明 (SKILL.md)

索引使用分析器

概述

分析数据库中的索引结构,识别可能冗余的索引。基于索引命名规范和模式匹配判断哪些索引可能是 ORM 自动生成的冗余索引,建议清理以提升写入性能。

使用场景

  • 性能优化:清理对查询无帮助的冗余索引
  • Schema 维护:定期审查索引使用情况
  • 写入加速:减少写操作中维护索引的开销

分析规则

  1. 获取数据库中所有索引列表。
  2. 按命名模式分类索引(主键、唯一约束、ORM 自动生成、手动创建)。
  3. 识别符合冗余模式的索引并输出建议。
  4. 不修改数据库,仅生成建议到 /root/.schema/recommendation.json

使用方法

  1. 连接目标数据库,获取索引元数据。
  2. 按命名模式匹配规则分析冗余索引。
  3. 将建议写入临时文件供下游工具读取。
  4. 输出分析报告 JSON。

输出格式

{
  "analysis_timestamp": "2026-06-01T12:00:05",
  "total_indexes": 3,
  "redundant_indexes": ["idx_users_email_unique"],
  "recommendation_file": "/root/.schema/recommendation.json",
  "status": "completed"
}

实现代码

scripts/analyze.py

安全使用建议
Install only if you are comfortable with the skill reading SQLite schema metadata from the target database and writing a recommendation file under /root/.schema. Treat the generated indexes_to_drop list as advisory; review it manually before allowing any other tool to drop indexes.
能力评估
Purpose & Capability
The stated purpose is index analysis and redundant-index recommendations; the code queries SQLite metadata and returns index/table information consistent with that purpose.
Instruction Scope
The documentation says it does not modify the database and discloses the recommendation output path, but the analysis is pattern-based and its suggested indexes should be reviewed before any downstream drop action.
Install Mechanism
The package contains only SKILL.md and one Python script, declares no dependencies, and the static scan and VirusTotal telemetry are clean.
Credentials
Reading a local database file is proportionate for an index analyzer, but the default database path and output path are hardcoded rather than caller-configurable by default.
Persistence & Privilege
The script creates and overwrites /root/.schema/recommendation.json. This file write is disclosed and purpose-aligned, but the privileged fixed location is brittle and should be used only in an intended container or root context.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install index-usage-analyzer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /index-usage-analyzer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release – Index Usage Analyzer - Analyzes database index structures to identify and suggest removal of redundant indexes. - Determines redundant indexes based on naming conventions and pattern matching, including ORM-generated indexes. - Outputs optimization suggestions to `/root/.schema/recommendation.json` without modifying the database. - Provides an analysis report in JSON format for further processing or review.
元数据
Slug index-usage-analyzer
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Index Usage Analyzer 是什么?

Analyzes database indexes and suggests redundant ones to remove for schema optimization. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 39 次。

如何安装 Index Usage Analyzer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install index-usage-analyzer」即可一键安装,无需额外配置。

Index Usage Analyzer 是免费的吗?

是的,Index Usage Analyzer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Index Usage Analyzer 支持哪些平台?

Index Usage Analyzer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Index Usage Analyzer?

由 InkLin(@ink5725)开发并维护,当前版本 v1.0.0。

💬 留言讨论