Optimize slow database queries — analyze execution plans, add indexes, rewrite queries.

MITAuto-check: notesDatabases

Install Flux Query

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill flux-query -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace flux-query --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/ai-agency/tonone/skills/flux-query .claude/skills/flux-query && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
flux-query
GitHub stars
2.8k
Token cost
~810 tokens
SKILL.md length
355 words
Files
2
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Optimize slow database queries — analyze execution plans, add indexes, rewrite queries.

  • Works in 5 steps: Detect Environment → Read the Query → Analyze the Query → …
  • Asked about slow query
  • SKILL.md covers Steps and Delivery
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Flux Query is an agent skill from jeremylongshore/tons-of-skills-marketplace. Optimize slow database queries — analyze execution plans, add indexes, rewrite queries. Use when asked about "slow query", "optimize SQL", "query performance", or "explain this query".

Its SKILL.md is about 810 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `.claude-plugin/plugin.json`).

It sits in Databases, covering Query optimization, SQL and ORMs and data access. It works with SQL. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Asked about slow query
  • Query performance
  • Explain this query

Example prompts

  • “slow query”
  • “optimize SQL”
  • “query performance”
  • “/flux-query”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch, Task, TodoWrite, AskUserQuestion

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Detect Environment
  2. Read the Query
  3. Analyze the Query
  4. Suggest Fixes
  5. Explain the Execution Plan

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash
    • Glob
    • Grep
    • WebFetch
    • WebSearch
    • Task
    • TodoWrite

    …and 1 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Flux Query loads about 810 tokens when it runs. Until then it costs about 49 tokens; SKILL.md has 355 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~49
When it runs · the whole SKILL.md, loaded when a task matches
~810

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch, Task, TodoWrite, AskUserQuestion

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 355 words, ~810 tokens.

Download SKILL.mdSave it as .claude/skills/flux-query/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
flux-query
description
Optimize slow database queries — analyze execution plans, add indexes, rewrite queries. Use when asked about "slow query", "optimize SQL", "query performance", or "explain this query".
allowed-tools
Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch, Task, TodoWrite, AskUserQuestion
version
0.6.4
author
tonone-ai <hello@tonone.ai>
license
MIT

Optimize Slow Queries

You are Flux — the data engineer on the Engineering Team.

Follow the output format defined in docs/output-kit.md — 40-line CLI max, box-drawing skeleton, unified severity indicators, compressed prose.

Steps

Step 0: Detect Environment

Identify the database:

  • Check for ORM configs: prisma/schema.prisma, alembic.ini, drizzle.config.ts, ormconfig.ts
  • Check for connection strings to identify the engine (PostgreSQL, MySQL, SQLite, etc.)
  • Check for query code: ORM queries, raw SQL files, repository/DAO layers
  • Identify if there is a query logging or APM tool in use

If the stack is ambiguous, ask the user.

Step 1: Read the Query

Get the full query — either from the user directly or by finding it in the codebase:

  • Search for the slow query in ORM code, raw SQL, or query builder calls
  • If the user provides EXPLAIN output, read it carefully
  • Understand the intent: what data is this query trying to retrieve?
Step 2: Analyze the Query

Check for these common performance problems:

  • Missing indexes — columns in WHERE, JOIN ON, ORDER BY without indexes
  • Full table scans — no filtering or filtering on unindexed columns
  • SELECT * — pulling columns that aren't needed
  • Missing LIMIT — unbounded result sets
  • Unnecessary JOINs — joining tables whose data isn't used in output
  • Correlated subqueries — subqueries that execute per-row instead of once
  • Subquery vs JOIN — subqueries in WHERE that could be JOINs
  • N+1 patterns — ORM code that triggers a query per row
  • Implicit type casting — comparing mismatched types that prevent index use
  • Functions on indexed columns — WHERE LOWER(email) = ... can't use an index on email
Show full SKILL.md (107 more words)Show less
Step 3: Suggest Fixes

For each issue found:

  1. Suggest specific indexes — with exact CREATE INDEX statements
  2. Rewrite the query if the structure is the problem
  3. Add LIMIT/pagination if results are unbounded
  4. Replace SELECT * with specific columns
  5. Convert subqueries to JOINs where beneficial
Step 4: Explain the Execution Plan

Present findings in plain English:

## Query Analysis

### Problems Found
- [problem] — [impact on performance]

### Recommended Indexes
- `CREATE INDEX idx_name ON table(column)` — supports [query pattern]

### Rewritten Query
[new query if applicable]

### Before vs After
- Before: [estimated behavior — full scan, nested loop, etc.]
- After: [expected improvement — index scan, hash join, etc.]

Keep explanations accessible. Not everyone reads EXPLAIN output fluently.

Delivery

If output exceeds the 40-line CLI budget, invoke /atlas-report with the full findings. The HTML report is the output. CLI is the receipt — box header, one-line verdict, top 3 findings, and the report path. Never dump analysis to CLI.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in plugins/ai-agency/tonone/skills/flux-query of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • .claude-plugin/plugin.json

Open the folder on GitHubat commit cfae287

Compare with similar skills

Flux Query next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Flux Query compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Flux Query this skilljeremylongshore/tons-of-skills-marketplace2.8k—~810Automated safety check: NotesMIT
Query Optimizationseb1n/awesome-ai-agent-skills206—~2.6kAutomated safety check: PassMIT
Dsqlawslabs/agent-plugins916—~7.1kAutomated safety check: PassApache-2.0
Postgresdbericrisco/rsc-harness180—~4.4kAutomated safety check: PassMIT
SQL ToolkitLeoYeAI/openclaw-master-skills2.2k—~3kAutomated safety check: PassMIT
Django Query Plan Readinghashgraph-online/awesome-codex-plugins1.3k—~660Automated safety check: PassMIT

Similar skills

  • Query Optimization

    seb1n/awesome-ai-agent-skills

    Diagnose and optimize existing slow SQL queries using execution plans, indexing strategies, query rewriting, and ORM tuning.

    206 GitHub stars~2.6k tokensUpdated 2 mo ago
    DatabasesAuto-check passed
  • Dsql

    awslabs/agent-plugins

    Official

    Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed…

    916 GitHub stars~7.1k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Postgresdb

    ericrisco/rsc-harness

    A skill your agent uses when PostgreSQL engine behaviour decides the answer — schema and type design, index choice, reading EXPLAIN on a slow query, zero-downtime DDL and backfills, or ops (roles…

    180 GitHub stars~4.4k tokensUpdated yesterday
    DatabasesAuto-check passed
  • SQL Toolkit

    LeoYeAI/openclaw-master-skills

    Query, design, migrate, and optimize SQL databases. An agent skill from LeoYeAI/openclaw-master-skills.

    2.2k GitHub stars~3k tokensUpdated 2 mo ago
    DatabasesAuto-check passed
  • Django Query Plan Reading

    hashgraph-online/awesome-codex-plugins

    Read and compare Django/PostgreSQL query execution plans using QuerySet.explain(), EXPLAIN, EXPLAIN ANALYZE, scan types, joins, estimates, actual timing, buffers, and row counts.

    1.3k GitHub stars~660 tokensUpdated yesterday
    DatabasesAuto-check passed
  • SQL Optimization Patterns

    ynulihao/AgentSkillOS

    Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries.

    618 GitHub starsUsed in 11 repos~3.3k tokens
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Flux Query

What does Flux Query do?

Optimize slow database queries — analyze execution plans, add indexes, rewrite queries. Flux Query is an agent skill from jeremylongshore/tons-of-skills-marketplace. Optimize slow database queries — analyze execution plans, add indexes, rewrite queries.

When should I use Flux Query?

Flux Query fits situations like: asked about slow query; query performance; explain this query.

How do I install Flux Query in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill flux-query -a claude-code`. Or copy the skill folder (plugins/ai-agency/tonone/skills/flux-query in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/flux-query in your project. Claude Code loads it when a task matches its description.

How do I install Flux Query in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill flux-query -a codex`. Or copy the skill folder (plugins/ai-agency/tonone/skills/flux-query in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/flux-query in your project. Codex loads it when a task matches its description.

Can I use Flux Query in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill flux-query -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/flux-query, .gemini/skills/flux-query, .github/skills/flux-query and .opencode/skills/flux-query in your project.

What does Flux Query need to run?

SKILL.md names no scripts, command-line tools or credentials: Flux Query is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch, Task, TodoWrite, AskUserQuestion.

Does Flux Query access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Flux Query safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Flux Query use?

Flux Query is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Flux Query use?

About 810 tokens (SKILL.md is roughly 3.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Flux Query?

Skills that share tags, products or a category with Flux Query: Query Optimization (seb1n/awesome-ai-agent-skills, 206 stars), Dsql (awslabs/agent-plugins, 916 stars), Postgresdb (ericrisco/rsc-harness, 180 stars) and SQL Toolkit (LeoYeAI/openclaw-master-skills, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Flux Query?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.