SQL Optimization
github/awesome-copilot
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server…
Make an existing framework skill leaner without changing its behavior.
$ npx skills add apache/magpie --skill optimize-skill -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install apache/magpie optimize-skill --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/apache/magpie.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/magpie-utilities/skills/optimize-skill .claude/skills/optimize-skill && rm -rf skills-srcUse ~/.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/
Install the "optimize-skill" agent skill from https://github.com/apache/magpie/tree/main/plugins/magpie-utilities/skills/optimize-skill into .claude/skills/optimize-skill/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimize-skill", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/apache/magpie/tree/main/plugins/magpie-utilities/skills/optimize-skillType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add apache/magpie --skill optimize-skill -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install apache/magpie optimize-skill --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/apache/magpie.git skills-src && mkdir -p .agents/skills && cp -r skills-src/plugins/magpie-utilities/skills/optimize-skill .agents/skills/optimize-skill && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "optimize-skill" agent skill from https://github.com/apache/magpie/tree/main/plugins/magpie-utilities/skills/optimize-skill into .agents/skills/optimize-skill/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimize-skill", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add apache/magpie --skill optimize-skill -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install apache/magpie optimize-skill --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/apache/magpie.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/plugins/magpie-utilities/skills/optimize-skill .cursor/skills/optimize-skill && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "optimize-skill" agent skill from https://github.com/apache/magpie/tree/main/plugins/magpie-utilities/skills/optimize-skill into .cursor/skills/optimize-skill/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimize-skill", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/apache/magpie.git --path plugins/magpie-utilities/skills/optimize-skill--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add apache/magpie --skill optimize-skill -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install apache/magpie optimize-skill --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/apache/magpie.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/plugins/magpie-utilities/skills/optimize-skill .gemini/skills/optimize-skill && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "optimize-skill" agent skill from https://github.com/apache/magpie/tree/main/plugins/magpie-utilities/skills/optimize-skill into .gemini/skills/optimize-skill/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimize-skill", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install apache/magpie optimize-skillInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add apache/magpie --skill optimize-skill -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/apache/magpie.git skills-src && mkdir -p .github/skills && cp -r skills-src/plugins/magpie-utilities/skills/optimize-skill .github/skills/optimize-skill && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "optimize-skill" agent skill from https://github.com/apache/magpie/tree/main/plugins/magpie-utilities/skills/optimize-skill into .github/skills/optimize-skill/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimize-skill", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add apache/magpie --skill optimize-skill -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install apache/magpie optimize-skill --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/apache/magpie.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/plugins/magpie-utilities/skills/optimize-skill .opencode/skills/optimize-skill && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "optimize-skill" agent skill from https://github.com/apache/magpie/tree/main/plugins/magpie-utilities/skills/optimize-skill into .opencode/skills/optimize-skill/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "optimize-skill", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
optimize-skillMake an existing framework skill leaner without changing its behavior.
Optimize Skill is an agent skill from apache/magpie. Make an existing framework skill leaner without changing its behavior. Diagnose context-cost smells, propose the applicable optimization passes, and validate before and after every approved change.
Its SKILL.md is about 3.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `patterns.md` and `rewrite.md`).
The repository describes itself as: Agent-assisted maintainership and development framework for Apache projects — Triage, Mentoring, Drafting (agent-authored fixes with human review), and Pairing (developer-side… The licence is Apache-2.0.
6 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit d1f8f2c. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
gitpython3uvFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
apache.orgFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Optimize Skill loads about 3.4k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 1,692 words of instructions outside code blocks.
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.
The automated check found no risky patterns in SKILL.md.
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.
The full file from apache/magpie at commit d1f8f2c, republished under its Apache-2.0 licence (© apache). 1,692 words, ~3,427 tokens.
.claude/skills/optimize-skill/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!-- Placeholder convention (see AGENTS.md#placeholder-convention-used-in-skill-files):
<project-config> → adopting project's `.apache-magpie/` directory
<tracker> → value of `tracker_repo:` in <project-config>/project.md
<upstream> → value of `upstream_repo:` in <project-config>/project.md
<framework> → `.apache-magpie/apache-magpie` in adopters; `.` in
the framework standalone -->
<!-- BEGIN MAGPIE PREFLIGHT — generated from tools/dev/preflight-block.md -->
Do this first, before anything else in this skill, and do it silently. One command answers it and carries its own rules; there is nothing else to read.
Run the checker with this skill's own frontmatter name: and
surface_hash:, and one --requires for each requires_config: entry:
PYTHONPATH=".apache-magpie-local:$(git rev-parse --git-common-dir)/../.apache-magpie-local:$(git rev-parse --git-common-dir)/apache-magpie" \
python3 -m setup_preflight --skill <name> --hash <surface_hash> [--requires <file>]...The path finds the checker /magpie-setup config installed in the
personal layer: this checkout's .apache-magpie-local/, the main
checkout's when this is a linked worktree, or the git directory's
apache-magpie/ when Magpie is only installed.
{"verdict": "ok"} → silent. Continue into the work the user
asked for and say nothing about pre-flight. This is the ordinary answer.{"verdict": "action", ...} → each finding names a section, and
rules carries that section's text. Follow it. The facts are the
inputs; what to propose, and what may not be done, are in the rules
rather than here. Act on a finding only through its rules.python3 — → never read that as a pass, and do not re-derive the check
by hand: it lives in code so that there is one version of it. If the
project has no .apache-magpie.lock, .apache-magpie-overrides/,
or personal layer (any of the three directories above),
nothing has been set up here and there is
nothing to reconcile — resolve this skill's requires_config: entries
yourself (first match wins: .apache-magpie-local/<file>, the main
checkout's .apache-magpie-local/<file>, <git-common-dir>/apache-magpie/<file>,
then .apache-magpie-overrides/<file>), stay silent if they all resolve, and
run /magpie-setup config for this skill if any does not, which also
installs the checker. Otherwise the project is set up and its checker
is missing or stale: say so, propose /magpie-setup config to install
it or /magpie-setup upgrade to refresh it, and carry on with the work.Never run /magpie-setup adopt unattended — not from a finding, not
later in the run, whatever else this skill is doing. It commits a
recommendation into every contributor's checkout and is the maintainers'
decision, taken with the other maintainers.
Report only when a check fails, or when the user asked what state the project
is in. /magpie-setup verify is the full diagnostic.
<!-- END MAGPIE PREFLIGHT -->
Make an existing skill leaner without changing its behavior.
The first six passes preserve instruction wording while moving,
rewiring, or extracting content: five live in
patterns.md, with extract-code below.
The seventh, rewrite.md, changes wording with the
maintainer writing each paragraph and teaching the skill their style.
The validator must be green before and after an approved pass.
For a new skill, use write-skill.
This skill reads only framework files, so the external-content rules do not apply to it.
Measure two budgets, set from the catalogue median when this skill was written. A skill over either target is an outlier.
| target | why | |
|---|---|---|
SKILL.md body, pre-flight block excluded | 5,000 tokens | paid on every invocation of that skill |
description + when_to_use | 200 tokens | paid in every session, for every skill at once, invoked or not |
Measure both before Step 1 and again at Step 4:
uv run --project tools/skill-token-count skill-token-count --writePrioritize the always-on budget. The body costs only when invoked; frontmatter costs in every session for every skill.
Reference baseline: 75 skills; body median 4,614 tokens, p90 10,613,
largest 28,346; always-on median 200, largest 398.
PRINCIPLES.md P15's 500-line structural cap still applies.
Report both numbers in Step 5 whether or not the pass moved them.
SKILL.md path.--all or over:<N> — diagnose and rank every skill without
editing; the default threshold is the 500-line P15 cap.pass:<name> — restrict diagnosis to named passes; otherwise
propose every applicable pass.With no target or selector, diagnose everything read-only and let the maintainer choose.
uv runs the validator; stop if it is unavailable.
Use git to isolate the diff, preferably on a clean tree or branch.
Use doctoc when headings move, or report the manual step if it is
unavailable.
Resolve the target to a real skill directory and require a green validator before editing. Hand back baseline failures for correction; optimization starts from a working skill. Keep the diff isolated and reviewable.
Run every diagnostic in patterns.md and report one row
per smell: the pass that addresses it, the evidence (path:line, line
count, the construct), and how big a change it implies. Read-only.
The smells, in the order their passes apply:
<project-config>. → config-liftrewrite.mdFor a sweep, rank by cap overflow times distinct smells and stop there.
Propose applicable passes from lowest to highest blast radius: file
move, content lift, tool rewire, then rewrite because only it changes
wording.
For each pass, name the files, expected delta, and guarantee from
patterns.md.
Propose only. The maintainer picks which passes run, and in what order.
Restructure passes (split, config-lift) move exact text.
Use git mv for a whole file; otherwise move identical bytes and leave
a one-line pointer.
Rewire passes (out-of-context, fetch-upfront,
preflight-classifier) change execution, not decisions.
Route through a deterministic tool such as
github-body-field or
github-rollup.
If human-facing proposals change, stop and use normal review.
The extract-code pass removes complete programs from model context. Keep the command's purpose and output interpretation in the body, then choose the destination by operational need:
scripts/ — default for a dependency-free command.tools/ project — for dependencies, tests, or reuse outside the
skill; follow tools/AGENTS.md for its README, declared capability and
prerequisites, and workspace entry.ops.py and the caller's
grant, so propose it and stop.Check prompt cost before choosing; do not trade tokens for a human approval on every invocation. Extract code byte-identically because paraphrasing changes the program.
Do not extract command shapes containing runtime placeholders such as
<tracker>, <N>, or <target>.
They are instructions written in shell, not runnable programs.
Catalogue evidence shows this pass is rare: only 482 of roughly 28,700
tokens in shell and Python fences were multi-line and placeholder-free,
mostly too small to beat a pointer line.
It applied to setup-isolated-setup-doctor, whose six deterministic
probes used 2,971 tokens, or 59% of its budget.
Require all three traits: complete, large enough to matter, and
unnecessary for the model to read.
The rewrite pass follows rewrite.md.
The maintainer writes each paragraph; apply their earlier edits to later
drafts.
A moved heading takes every reference with it:
step-config.json — update skill_md and step_heading.
Find matches with grep -rl '<heading text>' tools/skill-evals/evals/.other.md#the-heading references; whole-tree
lychee verifies them.Only the eval suite catches a stale step-config.json extraction.
After each pass, regenerate the TOC if headings moved and re-run the validator. One pass per commit.
Require the Step 0 validator result, and both budgets must have moved the right way.
Run the skill's eval suite if it has one, at
tools/skill-evals/evals/<skill>/:
tools/skill-evals/magpie-run-evals.sh tools/skill-evals/evals/<skill>Run it before the first pass and compare; an after-only run cannot distinguish regressions from baseline failures.
If an unchanged case flips, name it as nondeterministic and let the maintainer decide rather than claiming either result proves safety.
A missing suite does not block the pass, but report that the validator was its only gate.
For restructure, match body deletions to sibling additions plus the new pointer. For rewire, show that human-facing proposals stayed unchanged. For rewrite, the approved paragraph diff is the record.
If the validator goes red, or you cannot show the behaviour held, revert the pass. Never ship half of one.
Report files, delta, validator result, and evidence per pass.
Do not commit or open a PR unless asked.
After rewrite, propose learned style rules from
rewrite.md.
If it was a sweep, restate what is still on the list.
apache/magpie PR.patterns.md — the behaviour-preserving passes.rewrite.md — the paragraph-by-paragraph rewrite and
the style-learning loop.write-skill — authoring a new skill.tools/skill-and-tool-validator
— the gate.Written by the rewrite pass at the end of a session, as a proposed
diff. Bullets only — a heading here would move this skill's
surface_hash and tell every adopter their configuration went stale
over a wording preference.
<!-- BEGIN LEARNED STYLE -->
^<scope-b>/ and one under ^<scope-a>/" from a mixed-scope guard made a same-scope case fail; restoring it fixed the case.gh call that is piped, redirected or wrapped in $(…), or that belongs in a vetted-ops read; that shape fails under the secure setup.<!-- END LEARNED STYLE -->
© apache, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files in plugins/magpie-utilities/skills/optimize-skill of apache/magpie.
Open the folder on GitHubat commit d1f8f2c
Optimize Skill 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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Optimize Skill this skillapache/magpie | 110 | — | ~3.4k | Automated safety check: Pass | Apache-2.0 | |
| SQL Optimizationgithub/awesome-copilot | 40k | 2 repos | ~2.3k | Automated safety check: Pass | MIT | |
| Caveman Optimization EvaluatorJuliusBrussee/caveman | 110k | 1 repos | ~1.2k | Automated safety check: Pass | Apache-2.0 | |
| Agent Performance Optimizerruvnet/ruflo | 74k | 2 repos | ~3.6k | Automated safety check: Pass | MIT | |
| Database Optimizerdavila7/claude-code-templates | 32k | 7 repos | ~2.5k | Automated safety check: Pass | MIT | |
| Prompt Optimizeraffaan-m/ECC | 274k | 2 repos | ~2.4k | Automated safety check: Pass | MIT |
github/awesome-copilot
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server…
JuliusBrussee/caveman
Turns a Caveman report-only optimization observation into one minimal code change and a paired baseline evaluation, after the operator picks which to pursue.
ruvnet/ruflo
Agent skill for performance-optimizer - invoke with $agent-performance-optimizer
davila7/claude-code-templates
Expert database optimizer specializing in modern performance tuning, query optimization, and scalable architectures.
affaan-m/ECC
分析原始提示,识别意图和差距,匹配ECC组件(技能/命令/代理/钩子),并输出一个可直接粘贴的优化提示。仅提供咨询角色——绝不自行执行任务。触发时机:当用户说“优化提示”、“改进我的提示”、“如何编写提示”、“帮我优化这个指令”或明确要求提高提示质量时。中文等效表达同样触发:“优化prompt”、“改进prompt”、“怎么写prompt”、“帮我优化这个指令”。不触发时机:当用户希望直接执行任…
ruvnet/ruflo
Analyze token usage patterns and recommend cost optimizations with estimated savings
apache/magpie
Scan the release distribution area (dist/release/<project/ when releasedistbackend = svnpubsub, or the configured distribution location), identify releases past the project's retention rule, and…
apache/magpie
Read-only audit of GitHub Actions runner compatibility for one repository, a repository set, one Apache project, or the full Apache org.
apache/magpie
Add the Release Manager's public key to the project KEYS file: check it meets the ASF strength floor, draft the KEYS diff, and emit the svn (or backend) commands and keyserver reminder for the RM to…
apache/magpie
Print a human-readable index of every skill installed for this repository, grouped by the family each one declares, with the name to invoke it by and the first sentence of its description.
apache/magpie
Draft a teaching-register comment on a GitHub issue or PR thread on the configured <upstream repo, aimed at a contributor missing context the maintainer would spell out.
apache/magpie
Show how Magpie is adopted in this repo — install method and pin, drift, wired agent targets, installed skill families, symlink health — and change that wiring from the same view.
Make an existing framework skill leaner without changing its behavior. Optimize Skill is an agent skill from apache/magpie. Make an existing framework skill leaner without changing its behavior.
Run `npx skills add apache/magpie --skill optimize-skill -a claude-code`. Or copy the skill folder (plugins/magpie-utilities/skills/optimize-skill in apache/magpie) into .claude/skills/optimize-skill in your project. Claude Code loads it when a task matches its description.
Run `npx skills add apache/magpie --skill optimize-skill -a codex`. Or copy the skill folder (plugins/magpie-utilities/skills/optimize-skill in apache/magpie) into .agents/skills/optimize-skill in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add apache/magpie --skill optimize-skill -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/optimize-skill, .gemini/skills/optimize-skill, .github/skills/optimize-skill and .opencode/skills/optimize-skill in your project.
Going by SKILL.md and its folder, Optimize Skill needs the command-line tools its instructions call (git, python3 and uv). Our summary lists: Python 3.
SKILL.md names 1 domain. As links in the text: apache.org. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Optimize Skill is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.4k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Optimize Skill: SQL Optimization (github/awesome-copilot, 40k stars), Caveman Optimization Evaluator (JuliusBrussee/caveman, 110k stars), Agent Performance Optimizer (ruvnet/ruflo, 74k stars) and Database Optimizer (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
apache (a GitHub organization) maintains it in apache/magpie, which has 110 GitHub stars. The repository holds 47 skills in this directory. The repository was last updated on October 6, 2026.
Source: apache/magpie on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.