From Claude DB
Audits database index bloat by detecting exact-duplicate indexes, redundant prefix indexes, and unused indexes with zero scans. Feeds a Performance & Scale score.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-db:db-index-hygieneThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
The inverse of M11: M11 adds missing indexes, M12 removes the ones that only cost. Every index slows
The inverse of M11: M11 adds missing indexes, M12 removes the ones that only cost. Every index slows
writes and consumes storage and cache; duplicates and never-read indexes are pure overhead. Feeds the
Performance & Scale score (axis performance, relational Higiene de índices w16).
(a) is fully covered by an existing index on (a, b); the
shorter one can usually be dropped (B-tree leftmost-prefix rule).idx_scan = 0). This is
runtime truth: never declared unused from static analysis alone.Feeds performance only (relational Higiene de índices w16; folds into Indexación in NoSQL profiles).
Parse declared indexes and detect exact duplicates and leftmost-prefix redundancy from the DDL alone
(established for duplicates — purely structural). Unused-index detection is runtime-only and
emits status: needs_api at Tier-0 (never a silent pass) with a nudge to Tier-2.
Duplicate/redundant (Tier-1 catalog):
SELECT indrelid::regclass AS tbl, array_agg(indexrelid::regclass) AS dupes
FROM pg_index GROUP BY indrelid, indkey, indclass, indpred
HAVING count(*) > 1;
Unused (Tier-2, requires sustained stats):
SELECT relname AS tbl, indexrelname AS idx, idx_scan, pg_size_pretty(pg_relation_size(indexrelid)) AS sz
FROM pg_stat_user_indexes WHERE idx_scan = 0 ORDER BY pg_relation_size(indexrelid) DESC;
Method index_check / query_stat. The Tier-2 result confirms M12.*.unused as established;
without a representative window it stays directional, and if stats are needed to decide → needs_api.
Emit findings per schema/finding.schema.json. Examples:
M12.users.duplicate_email_index — two indexes on the same key (severity:2, warn, axis
performance, confidence established from DDL, fixable: proposed — DROP INDEX).M12.orders.redundant_prefix_index — (status) covered by (status, created_at) (severity:1,
warn, established/directional, fixable: proposed).M12.events.unused_index — zero scans over the window (severity:2, warn, established Tier-2 /
needs_api at Tier-0, fixable: proposed).Each finding: evidence.observed quotes the index DDL or the catalog/stats row verbatim;
verification.reproduce is the query above referencing $DATABASE_URL; expected_impact is banded +
confidence-tagged (no naked %).
directional, not established.proposed (never auto): removal is not trivially reversible at scale and intent may be
deliberate. Suggest DROP INDEX CONCURRENTLY in the fix preview.Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
npx claudepluginhub hainrixz/claude-db --plugin claude-db