Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Freebies — Index Creation Helper

    1

    Generate optimal PostgreSQL/SQL index strategies and DDL for slow queries and high-volume workloads.

    Free

    Security scanned
    Freebies — Index Creation Helper

    Freebies — Index Creation Helper

    Example session with this skill installed

    **Analyze this query:** SELECT email FROM users WHERE organization_id = 500 AND status = 'active' ORDER BY created_at DESC; Table has 5M rows. Organization_id is an integer.

    • Read your context and instructions
    • Compiled the freebies

    I have analyzed the query patterns and data volume for your `users` table. To optimize the filtering on `organization_id` and `status` while satisfying the `ORDER BY` clause, a composite B-Tree index is recommended. ## Database Indexing Strategy | Property | Recommendation | Justification | | :--- | :--- | :--- | | **Index Type** | B-Tree (Composite) | Optimal for equality filters and range-based sorting. | | **Column Order** | `organization_id`, `status`, `created_at` | Follows Leftmost Prefix rule: Equality columns first, sort column last. | | **Strategy** | Partial Index | `status = 'active'` covers the specific query filter to reduce storage footprint. | ### Recommended DDL Statement ```sql CREATE INDEX idx_users_org_active_created ON users (organization_id, created_at DESC) WHERE status = 'active'; ``` ### Technical Justification 1. **Leftmost Prefixing**: By placing `organization_id` first, the database can immediately narrow the scan to the specific organization before sorting. 2. **Partial Optimization**: Since the query specifically filters for 'active' users, creating a partial index excludes the millions of inactive or archived users, keeping the index small and fast to update. 3. **Sort Satisfaction**: Including `created_at` in the index allows the database to retrieve rows in the correct order without an expensive in-memory sort operation. **Next steps** 1. Run `EXPLAIN ANALYZE` with the existing query to establish a performance baseline. 2. Apply the `CREATE INDEX` statement in a test or staging environment. 3. Verify the query plan changes from a `Sequential Scan` to an `Index Scan`.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Slow database queries drag down application performance and increase infrastructure costs. This skill analyzes your SQL workloads to determine the exact indexing strategy required to lower latency. ## What it does - **Analyze clauses** scans WHERE, JOIN, and ORDER BY patterns to identify bottleneck columns. - **Select index types** chooses between B-Tree, GIN, and GiST based on data types like JSONB, arrays, or geometric data. - **Structure composite indexes** applies the Leftmost Prefix rule to optimize multi-column lookups. - **Design partial indexes** creates targeted indexes for specific data subsets to minimize storage overhead and write amplification. ## How it works 1. Provide the SQL query and the table schema to the agent. 2. The agent identifies which columns are used for filtering, joining, and sorting. 3. It selects the most efficient index structure for the specific database engine. 4. You receive a precise CREATE INDEX DDL statement along with a technical justification. ## Frameworks & tools This skill works with any SQL-based environment, with specialized support for B-Tree, GIN, and GiST indexes commonly found in PostgreSQL, MySQL, and similar relational databases. ## Why this beats prompting it yourself Generic prompts often miss the nuances of the Leftmost Prefix rule or fail to recommend GIN indexes for JSONB fields. This skill follows a deterministic workflow to ensure composite index column order and partial filter logic are architecturally sound. ## Use cases - **Fix slow endpoints** by indexing columns used in complex JOIN and WHERE clauses. - **Optimize JSONB performance** with GIN index recommendations for document-style data. - **Reduce index size** by implementing partial indexes on high-cardinality status columns. - **Improve sort performance** by aligning composite index structures with ORDER BY requirements. ## Known limitations Does not perform live database execution or automated migration application. All analysis is restricted to the local workspace.

    Restricted to static analysis within the local project workspace. Does not execute DDL directly on live databases or install global system packages.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    • Free with an Agensi account

    Requires

    File System Read/Write (strictly scoped to current project workspace `./`).
    Zero global installation or elevated privileges required.

    Permissions

    Read Files

    Target Use Cases: - Recommend the best index for this SQL query. - Design a composite index following leftmost prefix rule. - Create a partial index in PostgreSQL for active users.

    Listed2 days ago

    What's inside

    Frequently Asked Questions

    This skill specializes in advanced SQL optimization, identifying exactly where B-Tree, GIN, or GiST indexes are needed to resolve latency issues and high infrastructure costs. It goes beyond basic recommendations by applying architectural rules like the Leftmost Prefix and partial indexing to ensure your database stays performant as it scales.

    The helper is optimized for PostgreSQL but provides excellent strategies for any SQL-based environment, including MySQL and MariaDB. It is compatible with all major AI agents that support text-based skill integration and can be used directly within your development workflow.

    You receive the full Index Creation Helper skill package, including the optimized workflow for analyzing complex queries and generating production-ready DDL. This purchase entitles you to all future updates and refinements to the indexing logic at no additional cost.

    To get the most accurate DDL, you should provide the specific SQL query that is running slowly along with the relevant table schemas. The agent uses these to determine column cardinality, data types (like JSONB or arrays), and the optimal order for composite indexes.

    For security and safety, the skill does not connect directly to your database or execute migrations. It functions as a specialized architect that provides the precise 'CREATE INDEX' code and technical justification, which you can then review and apply to your environment.

    New in Data & Databases