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…
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across SQL databases (PostgreSQL, SQL Server, Oracle).
$ npx skills add totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install totvs/engpro-advpl-tlpp-skills sql-optimization --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/totvs/engpro-advpl-tlpp-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/advpl-tlpp/sql-optimization .claude/skills/sql-optimization && 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 "sql-optimization" agent skill from https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/sql-optimization into .claude/skills/sql-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-optimization", 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/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/sql-optimizationType 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 totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install totvs/engpro-advpl-tlpp-skills sql-optimization --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/totvs/engpro-advpl-tlpp-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/advpl-tlpp/sql-optimization .agents/skills/sql-optimization && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "sql-optimization" agent skill from https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/sql-optimization into .agents/skills/sql-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-optimization", 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 totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install totvs/engpro-advpl-tlpp-skills sql-optimization --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/totvs/engpro-advpl-tlpp-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/advpl-tlpp/sql-optimization .cursor/skills/sql-optimization && 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 "sql-optimization" agent skill from https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/sql-optimization into .cursor/skills/sql-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-optimization", 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/totvs/engpro-advpl-tlpp-skills.git --path skills/advpl-tlpp/sql-optimization--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 totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install totvs/engpro-advpl-tlpp-skills sql-optimization --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/totvs/engpro-advpl-tlpp-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/advpl-tlpp/sql-optimization .gemini/skills/sql-optimization && 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 "sql-optimization" agent skill from https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/sql-optimization into .gemini/skills/sql-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-optimization", 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 totvs/engpro-advpl-tlpp-skills sql-optimizationInstalls 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 totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/totvs/engpro-advpl-tlpp-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/advpl-tlpp/sql-optimization .github/skills/sql-optimization && 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 "sql-optimization" agent skill from https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/sql-optimization into .github/skills/sql-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-optimization", 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 totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install totvs/engpro-advpl-tlpp-skills sql-optimization --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/totvs/engpro-advpl-tlpp-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/advpl-tlpp/sql-optimization .opencode/skills/sql-optimization && 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 "sql-optimization" agent skill from https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/sql-optimization into .opencode/skills/sql-optimization/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-optimization", 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.
sql-optimizationUniversal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across SQL databases (PostgreSQL, SQL Server, Oracle).
SQL Optimization is an agent skill from totvs/engpro-advpl-tlpp-skills. Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across SQL databases (PostgreSQL, SQL Server, Oracle). Provides execution plan analysis, pagination optimization, batch operations, and performance monitoring guidance. Use when user says "optimize SQL", "slow query", "index strategy", "execution plan analysis".
Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/sql-optimization-patterns.md` and `references/sql-optimization.md`).
It sits in Databases, covering SQL, Query optimization and Performance optimization. It works with SQL, Microsoft SQL Server and PostgreSQL. The repository describes itself as: Repositório contendo skills para orientar desenvolvimento ADVPL/TLPP com agentes de IA. The licence is MIT.
6 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 3908e4e. 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.
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.
No URLs in SKILL.md.
From 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.
SQL Optimization loads about 1.2k tokens when it runs, and up to ~4.5k if it reads all its reference files. Until then it costs about 104 tokens; SKILL.md has 487 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 totvs/engpro-advpl-tlpp-skills at commit 3908e4e, republished under its MIT licence (© totvs). 487 words, ~1,219 tokens.
.claude/skills/sql-optimization/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.Expert SQL performance optimization for ${selection} (or entire project if no selection). Focus on universal SQL optimization techniques that work across PostgreSQL, SQL Server, Oracle, and other SQL databases.
This skill covers query performance analysis, index strategy, subquery optimization, JOIN optimization, pagination, aggregation, query anti-patterns, batch operations, temporary tables, index management, and performance monitoring.
For all universal SQL optimization patterns with BAD/GOOD code examples, see sql-optimization-patterns.md.
Focus on measurable performance improvements and always test optimizations with realistic data volumes and query patterns.
The TOTVS Protheus ERP has specific database access patterns and constraints that require targeted optimization strategies. This covers cross-database compatibility, high-volume table optimization, SIX index alignment, NOLOCK hints, FWExecStatement/TCSqlExec performance (preferred over legacy TCQuery), and Workarea vs. Embedded SQL decision guidance.
For complete Protheus-specific optimization patterns, code examples, and the high-volume table reference, see sql-optimization.md.
SELECT * is not used — only necessary columns are selectedD_E_L_E_T_ = ' ' is present on every Protheus table query%nolock% hint (cross-DB safe — translates on MSSQL, ignored on PostgreSQL/Oracle)FWExecStatement, TCQuery or TCSqlExec calls inside loops — batch with :SetIn() or a single statementFWExecStatement:OpenAlias() (or legacy TCQuery ... New Alias) are closed after use and :Destroy() is calledRetSqlName() is used instead of hardcoded table names (e.g., SA1010)FWExecStatement is used when user input is part of the queryIIF() in SQL construction — use CASE WHEN or If/Else/EndIf in AdvPL logicRefer to references/sonarqube-rules-reference.md for the complete SonarQube rules reference.
© totvs, MIT. 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 (references) in skills/advpl-tlpp/sql-optimization of totvs/engpro-advpl-tlpp-skills.
Open the folder on GitHubat commit 3908e4e
SQL Optimization 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 |
|---|---|---|---|---|---|---|
| SQL Optimization this skilltotvs/engpro-advpl-tlpp-skills | 143 | — | ~1.2k | Automated safety check: Pass | MIT | |
| SQL Optimizationgithub/awesome-copilot | 40k | 2 repos | ~2.3k | Automated safety check: Pass | MIT | |
| SQL ProJeffallan/claude-skills | 12k | — | ~1.3k | Automated safety check: Pass | MIT | |
| Optimizing SQLancoleman/ai-design-components | 526 | — | ~3k | Automated safety check: Pass | MIT | |
| Agent SQL Proxiaoyuge886/aigc | 198 | — | ~315 | Automated safety check: Pass | MIT | |
| SQL Expertaiskillstore/marketplace | 430 | — | ~3.4k | Automated safety check: Pass | None |
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…
Jeffallan/claude-skills
Optimizes SQL queries and designs schemas using CTEs, window functions, covering indexes and EXPLAIN ANALYZE, with notes on dialect differences between major databases.
ancoleman/ai-design-components
Optimize SQL query performance through EXPLAIN analysis, indexing strategies, and query rewriting for PostgreSQL, MySQL, and SQL Server.
xiaoyuge886/aigc
Expert SQL developer specializing in complex query optimization, database design, and performance tuning across PostgreSQL, MySQL, SQL Server, and Oracle.
aiskillstore/marketplace
Expert SQL query writing, optimization, and database schema design with support for PostgreSQL, MySQL, SQLite, and SQL Server.
2025Emma/vibe-coding-cn
PostgreSQL database documentation - SQL queries, database design, administration, performance tuning, and advanced features. Use when working with PostgreSQL…
totvs/engpro-advpl-tlpp-skills
Converts AdvPL and TLPP source files from UTF-8 to Windows-1252 in place after code generation, because the Protheus compiler accepts only CP1252 files.
totvs/engpro-advpl-tlpp-skills
Compiles AdvPL and TLPP sources from VS Code with the TOTVS Developer Studio extension, handling server setup, connection and compile result reporting.
totvs/engpro-advpl-tlpp-skills
Plans and builds Protheus AdvPL/TLPP features through Specify, Design, Tasks and Execute phases whose depth scales with the size of the change.
totvs/engpro-advpl-tlpp-skills
Reviews AdvPL and TLPP source against SonarQube rules, ProtheusDOC requirements, security, performance and Protheus conventions, and reports findings by severity.
totvs/engpro-advpl-tlpp-skills
Queries the TOTVS Protheus ERP data dictionary for tables, fields, indexes, parameters, triggers and lookups, including impact checks during refactoring.
totvs/engpro-advpl-tlpp-skills
Generates Protheus MVC screens in ADVPL/TLPP, with ModelDef, ViewDef, MenuDef and Browse functions for single-entity and master-detail layouts.
Works with
Categories
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across SQL databases (PostgreSQL, SQL Server, Oracle). SQL Optimization is an agent skill from totvs/engpro-advpl-tlpp-skills. Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across SQL databases (PostgreSQL, SQL Server, Oracle).
SQL Optimization fits situations like: user says optimize SQL; execution plan analysis.
Run `npx skills add totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a claude-code`. Or copy the skill folder (skills/advpl-tlpp/sql-optimization in totvs/engpro-advpl-tlpp-skills) into .claude/skills/sql-optimization in your project. Claude Code loads it when a task matches its description.
Run `npx skills add totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a codex`. Or copy the skill folder (skills/advpl-tlpp/sql-optimization in totvs/engpro-advpl-tlpp-skills) into .agents/skills/sql-optimization 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 totvs/engpro-advpl-tlpp-skills --skill sql-optimization -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sql-optimization, .gemini/skills/sql-optimization, .github/skills/sql-optimization and .opencode/skills/sql-optimization in your project.
SKILL.md names no scripts, command-line tools or credentials: SQL Optimization is instructions for the agent only.
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.
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.
SQL Optimization is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.2k tokens (SKILL.md is roughly 4.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.3k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with SQL Optimization: SQL Optimization (github/awesome-copilot, 40k stars), SQL Pro (Jeffallan/claude-skills, 12k stars), Optimizing SQL (ancoleman/ai-design-components, 526 stars) and Agent SQL Pro (xiaoyuge886/aigc, 198 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
totvs (a GitHub organization) maintains it in totvs/engpro-advpl-tlpp-skills, which has 143 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 5, 2026.
Source: totvs/engpro-advpl-tlpp-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.