MCPInstall

index-strategies

This skill should be used when the user asks to design, review, add, drop, consolidate, or tune SQL Server indexes. PROACTIVELY activate for clustered vs nonclustered design, covering indexes and INCLUDE columns, filtered indexes, columnstore indexes, missing-index DMV interpretation, duplicate or unused indexes, index maintenance, fragmentation, fill factor, compression, partition-aligned indexes, partition elimination proof, huge-table index constraints, online/resumable rebuilds, and index changes for slow T-SQL queries. Provides: index-design decision tree, workload-aware tradeoff checklist, DMV interpretation guidance, and maintenance/rebuild patterns.

Installs
169
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill index-strategies
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads index-strategies automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Index Strategies

Comprehensive guide to SQL Server index design and optimization. Index advice must be workload-aware and constraint-aware: the best index for one query can be harmful for writes, storage, maintenance, partition switching, or other critical queries.

Mandatory Intake

Before recommending index DDL, collect or mark unknown:

  • SQL Server version, edition, compatibility level, and Azure SQL tier.
  • Query text, representative parameters, actual plan, row counts, and predicate selectivity.
  • Existing clustered, nonclustered, filtered, columnstore, unique, disabled, duplicate, and overlapping indexes.
  • Table DDL, constraints, data types, computed columns, compression, partitioning, and statistics.
  • Write workload: insert/update/delete frequency, bulk loads, maintenance window, storage budget.
  • Change constraints: can new indexes be added, can huge-table indexes be changed, is online/resumable index creation allowed, is partition switching required, are staging tables allowed, and who approves write overhead.

Use ../_shared/optimization-intake.md and ../_shared/assumption-tracker.md. Do not present missing-index DMV output as final design without existing-index and workload review.

Quick Reference

TypeBest forCautions
ClusteredPrimary table order, range access, narrow stable keyExpensive to change; clustering key is included in nonclustered indexes.
NonclusteredQuery-specific seeks, joins, orderingAdds write and storage overhead.
CoveringAvoiding repeated key lookupsINCLUDE bloat can hurt cache and writes.
FilteredStable, selective subsetsQuery predicate must imply filter; parameters can block use.
ColumnstoreAnalytics, scans, aggregations, compressionSmall updates and singleton lookups can suffer.
UniqueEnforcing business rules and optimizer proofMust match real semantics.

Index Design Workflow

1. Start from Query Shape

Map query columns by role:

RoleIndex design implication
Equality predicatesUsually first key columns, ordered by selectivity and workload reuse.
Join keysUseful as seek keys and join order support.
Range predicatesUsually after equality keys; only one range can be deeply seekable.
ORDER BY / GROUP BYConsider key order to avoid sorts or stream aggregates.
Selected columnsINCLUDE only when lookup cost justifies storage/write cost.

Example:

CREATE NONCLUSTERED INDEX IX_Orders_CustomerDate
ON dbo.Orders(CustomerID, OrderDate)
INCLUDE (Status, TotalAmount);

2. Validate Data Types and SARGability

An index cannot fully help if predicates are non-SARGable or types mismatch. Confirm parameter, temp-table, and source column types before adding indexes. Fix CONVERT_IMPLICIT on join/filter columns first when possible.

3. Compare Existing Indexes

Before adding a new index:

  • Check whether an existing index can be extended safely.
  • Merge overlapping missing-index requests.
  • Identify duplicates with same leading keys.
  • Evaluate lookup count and selected columns before adding INCLUDE columns.
  • Consider whether filtered or narrower indexes solve the hot path with less write cost.

4. Account for Change Constraints

Classify the recommendation:

ConstraintSafer response
Cannot add indexesQuery rewrite, stats, hints, temp staging, or Query Store hints.
Cannot change huge-table indexesAdd narrow filtered index, indexed staging table, or reduce rows before touching table.
Online index not allowedPlan maintenance window and blocking risk; consider resumable where supported.
Partition switching requiredPrefer aligned indexes; avoid nonaligned indexes unless explicitly accepted.
Heavy write workloadMinimize key width and INCLUDE list; prove read benefit.
Storage constrainedConsolidate duplicates and avoid speculative covering indexes.

Clustered Index Guidelines

Ideal clustered keys are narrow, unique, static, and usually ever-increasing for OLTP insert patterns.

CREATE CLUSTERED INDEX CIX_Orders ON dbo.Orders(OrderID);

Avoid wide composite clustered keys unless they match a deliberate access pattern and write trade-off. Random GUID clustering can cause page splits; consider NEWSEQUENTIALID(), a surrogate key, or fill-factor strategy when appropriate.

Covering Indexes

Covering indexes avoid lookups when the lookup cost is significant.

CREATE NONCLUSTERED INDEX IX_Orders_CustomerID_Cover
ON dbo.Orders(CustomerID)
INCLUDE (OrderDate, TotalAmount, Status);

Use INCLUDE columns for output-only columns, not for filtering or ordering. Keep INCLUDE lists minimal; wide includes can be worse than occasional lookups.

Filtered Indexes

Filtered indexes are strong for stable subsets:

CREATE NONCLUSTERED INDEX IX_Orders_Open_ByCustomer
ON dbo.Orders(CustomerID, OrderDate)
WHERE Status = 'Open';

Requirements:

  • Query predicate must imply the filter.
  • Parameterized queries may need recompilation or literal-specific dynamic SQL to match reliably.
  • Filter column may need to be included when it is not obvious to the optimizer.
  • Validate parameter sniffing risk and plan cache behavior.

Columnstore Indexes

Use columnstore for analytic scans, aggregations, and compression.

CREATE CLUSTERED COLUMNSTORE INDEX CCI_FactSales
ON dbo.FactSales;

CREATE NONCLUSTERED COLUMNSTORE INDEX NCCI_Orders_Analysis
ON dbo.Orders(OrderDate, ProductID, Quantity, Amount)
WHERE Status = 'Completed';

Best practices:

  1. Load batches of at least 102,400 rows where possible.
  2. Order data by common elimination columns for better segment elimination.
  3. Use REORGANIZE to compress delta rowgroups and merge rowgroups.
  4. Avoid high-frequency singleton updates on pure columnstore designs.
  5. Pair with partitioning for manageability when large fact tables require sliding windows.

Partition Alignment Checks

For partitioned tables, index design must account for elimination and maintenance.

Verify:

  • Partition function/scheme, boundary type, and RANGE LEFT vs RANGE RIGHT.
  • Base partitioning column vs query predicate column.
  • Whether each important nonclustered index is aligned or intentionally nonaligned.
  • Whether unique indexes include the partitioning column when required.
  • Actual partition elimination from the execution plan.
  • Unsafe predicates: functions on partition column, mismatched types, filtering a related non-partition date, OR catch-all predicates, or remote sources.

Do not claim partition elimination from a date filter unless it targets the partitioning column in a compatible, SARGable form or a trusted constraint proves equivalence. See references/partition-alignment-analysis.md.

Maintenance and Operations

Fragmentation rules are workload-dependent, but a common starting point is:

FragmentationTypical action
Less than 5%No action.
5-30%Reorganize if page count and workload justify it.
More than 30%Rebuild if maintenance window, edition, and blocking allow it.
ALTER INDEX IX_Orders_CustomerID ON dbo.Orders REORGANIZE;

ALTER INDEX IX_Orders_CustomerID ON dbo.Orders
REBUILD WITH (ONLINE = ON, RESUMABLE = ON, MAX_DURATION = 60);

Update statistics after meaningful index changes when auto-created stats or sampled stats are insufficient:

UPDATE STATISTICS dbo.Orders IX_Orders_CustomerID WITH FULLSCAN;

Useful Diagnostics

Index usage since last restart or database attach:

SELECT
    OBJECT_SCHEMA_NAME(i.object_id) AS SchemaName,
    OBJECT_NAME(i.object_id) AS TableName,
    i.name AS IndexName,
    ius.user_seeks,
    ius.user_scans,
    ius.user_lookups,
    ius.user_updates
FROM sys.indexes AS i
LEFT JOIN sys.dm_db_index_usage_stats AS ius
  ON i.object_id = ius.object_id
 AND i.index_id = ius.index_id
 AND ius.database_id = DB_ID()
WHERE OBJECTPROPERTY(i.object_id, 'IsUserTable') = 1
ORDER BY COALESCE(ius.user_seeks, 0) + COALESCE(ius.user_scans, 0) DESC;

Missing-index candidates:

SELECT
    migs.avg_user_impact AS ImpactPercent,
    mid.statement AS TableName,
    mid.equality_columns,
    mid.inequality_columns,
    mid.included_columns
FROM sys.dm_db_missing_index_groups AS mig
JOIN sys.dm_db_missing_index_group_stats AS migs
  ON mig.index_group_handle = migs.group_handle
JOIN sys.dm_db_missing_index_details AS mid
  ON mig.index_handle = mid.index_handle
WHERE mid.database_id = DB_ID()
ORDER BY migs.avg_user_impact DESC;

Recommendation Format

Provide:

  1. Evidence: plan operator, reads, lookups, estimates, missing-index request, or workload metric.
  2. DDL: proposed index with schema-qualified name and minimal keys/includes.
  3. Why: access path, ordering, coverage, or elimination benefit.
  4. Cost: storage, writes, blocking, maintenance, partition implications.
  5. Validation: before/after plan, logical reads, CPU, elapsed time, write impact.
  6. Rollback or alternative: especially for huge tables.

References

  • ../_shared/optimization-intake.md - pre-optimization intake.
  • ../_shared/assumption-tracker.md - assumption status tracking.
  • references/partition-alignment-analysis.md - partition scheme and elimination analysis.

FAQ

What does the index-strategies skill do?

This skill should be used when the user asks to design, review, add, drop, consolidate, or tune SQL Server indexes. PROACTIVELY activate for clustered vs nonclustered design, covering indexes and INCLUDE columns, filtered indexes, columnstore indexes, missing-index DMV interpretation, duplicate or unused indexes, index maintenance, fragmentation, fill factor, compression, partition-aligned indexes, partition elimination proof, huge-table index constraints, online/resumable rebuilds, and index changes for slow T-SQL queries. Provides: index-design decision tree, workload-aware tradeoff checklist, DMV interpretation guidance, and maintenance/rebuild patterns.

How do I install index-strategies?

Run npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill index-strategies in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/index-strategies/ (personal) or .claude/skills/index-strategies/ (project).

Which AI agents can use index-strategies?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is index-strategies safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains index-strategies?

It is published by josiahsiegel in josiahsiegel/claude-plugin-marketplace. It has 169 recorded installs.

More from josiahsiegel/claude-plugin-marketplace

View all →

tailwindcss-advanced-layouts

josiahsiegel/claude-plugin-marketplace

Tailwind CSS advanced layout techniques including CSS Grid and Flexbox patterns. PROACTIVELY activate for: (1) building complex layouts with CSS Grid, (2) grid-template-areas via Tailwind v4 arbitrary values, (3) responsive grid (grid-cols-, auto-fit, minmax), (4) Flexbox patterns (flex-1, flex-grow, gap), (5) sticky headers and footers, (6) holy grail layout, (7) masonry-style layouts, (8) container queries (@container) with Tailwind, (9) subgrid usage, (10) aspect-ratio utilities, (11) magazine-style multi-column layouts. Provides: Grid template recipes, container-query patterns, holy-grail templates, masonry alternatives, and aspect-ratio examples.

Frontend & Design8.1K installs

tailwindcss-animations

josiahsiegel/claude-plugin-marketplace

Tailwind CSS animations and transitions including built-in utilities and custom keyframes. PROACTIVELY activate for: (1) animate- utilities (spin, ping, pulse, bounce), (2) custom @keyframes via @theme animate, (3) transition utilities (transition, duration, ease), (4) transforms (scale, rotate, translate) with transition, (5) prefers-reduced-motion: reduce, (6) Framer Motion / Motion One integration with Tailwind, (7) CSS scroll-driven animations (animation-timeline), (8) view transitions API with Tailwind, (9) hover, focus, group-hover transitions, (10) staggered list animations. Provides: animation utility reference, custom keyframe examples, reduced-motion pattern, Framer Motion integration, and scroll-driven animation recipes.

Frontend & Design2.4K installs

tailwindcss-mobile-first

josiahsiegel/claude-plugin-marketplace

Mobile-first responsive design patterns with Tailwind CSS v4 (2025-2026). PROACTIVELY activate for: (1) mobile-first design with Tailwind breakpoints (sm:, md:, lg:, xl:, 2xl:), (2) responsive utility ordering (default = mobile, then breakpoints), (3) responsive typography (text-base sm:text-lg lg:text-xl), (4) responsive grids and flexbox, (5) hide/show across breakpoints (hidden md:block), (6) max- breakpoints for desktop-down overrides, (7) container queries (@container) for component-level responsiveness, (8) safe-area insets and notch handling, (9) landscape vs portrait orientation, (10) touch vs hover (hover: with @media). Provides: breakpoint reference, mobile-first patterns, container-query examples, safe-area recipes, and touch/hover handling.

Mobile2.1K installs

powershell-master

josiahsiegel/claude-plugin-marketplace

Complete PowerShell expertise system across ALL platforms (Windows/Linux/macOS). PROACTIVELY activate for: (1) ANY PowerShell task (scripts/modules/cmdlets), (2) CI/CD automation (GitHub Actions/Azure DevOps/Bitbucket), (3) Cross-platform scripting, (4) Module discovery and management (PSGallery), (5) Azure/AWS/Microsoft 365 automation, (6) Script debugging and optimization, (7) Best practices and security. Provides: PowerShell 7+ features, popular module expertise (Az, Microsoft.Graph, PnP, AWS Tools), PSGallery integration, platform-specific guidance, CI/CD pipeline patterns, cmdlet syntax mastery, and production-ready scripting patterns. Ensures professional-grade, cross-platform PowerShell automation following industry standards.

DevOps & Cloud1.1K installs

docker-best-practices

josiahsiegel/claude-plugin-marketplace

Comprehensive Docker best practices for images, containers, and production deployments. PROACTIVELY activate for: (1) writing production-ready Dockerfiles, (2) multi-stage builds for lean images, (3) base image selection (distroless, alpine, scratch, slim), (4) layer caching and ordering, (5) .dockerignore hygiene, (6) HEALTHCHECK and graceful shutdown, (7) non-root user and least-privilege patterns, (8) ENV vs ARG and secret handling, (9) tag/digest pinning and reproducibility, (10) Compose for local development. Provides: Dockerfile templates by language, image-size optimization checklist, .dockerignore template, HEALTHCHECK patterns, and Compose dev-stack examples.

DevOps & Cloud938 installs

git-master

josiahsiegel/claude-plugin-marketplace

Complete Git expertise system for ALL git operations. PROACTIVELY activate for: (1) ANY Git task (basic/advanced/dangerous), (2) Repository management, (3) Branch strategies and workflows, (4) Conflict resolution, (5) History rewriting/recovery, (6) Platform-specific operations (GitHub/Azure DevOps/Bitbucket), (7) Advanced commands (rebase/cherry-pick/filter-repo). Provides: complete Git command reference, safety guardrails for destructive operations, platform best practices, workflow strategies, reflog recovery techniques, and expert guidance for even the most risky operations. Always asks user preference for automatic commits vs manual control.

Popular data & databases skills

View category →

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

OfficialData & Databases462.2K installs

prisma-client-api

prisma/skills

Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".

OfficialData & Databases393.5K installs

Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.

OfficialData & Databases392.3K installs

prisma-cli

prisma/skills

Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.

OfficialData & Databases390.8K installs

prisma-postgres

prisma/skills

Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.

OfficialData & Databases384.4K installs

Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.

OfficialData & Databases378.9K installs