← Back to Skills Marketplace
ink5725

Index Usage Analyzer

by InkLin · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
39
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install index-usage-analyzer
Description
Analyzes database indexes and suggests redundant ones to remove for schema optimization
README (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

Usage Guidance
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install index-usage-analyzer
  3. After installation, invoke the skill by name or use /index-usage-analyzer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug index-usage-analyzer
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Index Usage Analyzer?

Analyzes database indexes and suggests redundant ones to remove for schema optimization. It is an AI Agent Skill for Claude Code / OpenClaw, with 39 downloads so far.

How do I install Index Usage Analyzer?

Run "/install index-usage-analyzer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Index Usage Analyzer free?

Yes, Index Usage Analyzer is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Index Usage Analyzer support?

Index Usage Analyzer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Index Usage Analyzer?

It is built and maintained by InkLin (@ink5725); the current version is v1.0.0.

💬 Comments