sql-executor
Skill1 starsChanged 4 days agoMITView on GitHub
Practitioner guidance for querying, tuning, validating, and troubleshooting enterprise databases (SQL Server, Oracle, PostgreSQL, SQLite, MongoDB, MS Access, MySQL) via the sql-connector MCP server. Covers multi-engine joins, GIN/GiST/BRIN indexing, stored procedures, TVFs, Oracle cursors, CTEs, #temp tables, OLAP cubing, window functions, and cohort analytics. Use when asked to "write a sql join", "optimize sql query", "tune database index", "sql cube", "grouping sets", "sql cohort analysis", "postgres gin index", "oracle cursor", "sql stored procedure", "sql cte", or "run database queries".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- zeroclaw-labs/zeroclaw-skillstheir own version, first seen Sep 24, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- zeroclaw-labs/zeroclaw-skills★ 65same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-orchestratorSkill
- algorithmic-complexity-analyzerSkill
- api-securitySkill
- architectural-planningSkill
- caching-queues-reviewerSkill
- code-reviewerSkill
- csharp-developerSkill
- design-pattern-detectorSkill
- detect-overengineeringSkill
- github-security-scanner-hookSkill
- java-developerSkill
- legacy-code-modernizationSkill
- llm-as-judgeSkill
- load-memorySkill
- nodejs-executorSkill
- playwright-bdd-testerSkill
- powershell-writerSkill
- python-api-writerSkill
- python-developerSkill
- python-linterSkill
- react-developerSkill
- remote-pod-log-analyzerSkill
- save-memorySkill
- scan-halucinated-testsSkill
- scan-repo-readmeSkill
- skill-creatorSkill
- sql-connectorSkill
- sync-github-forksSkill
- trace-code-contextSkill
- troubleshoot-and-fixSkill
- typescript-developerSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Before generating queries, stored procedures, or table schemas, consult detect-overengineering:
- Distinctive: line 30
Avoid Speculative Indexes: Do not index every column proactively.
- Distinctive: line 31
Avoid Query Ceremony: Prefer simple ANSI joins over multi-level nested CTEs unless intermediate materialization is required.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SQL Executor
Architectural heuristics and execution guidance for querying, indexing, and optimizing enterprise relational and document databases via the sql-connector MCP server.
Architectural Heuristics & Decision Matrix
| Task Category | Recommended Strategy | When NOT to Use | Trade-Offs & Rationale |
| Multi-Table Joins | ANSI-92 joins; CROSS/OUTER APPLY (SQL Server); LATERAL (Postgres) | Legacy Oracle (+); unparenthesized MS Access 3+ joins | ANSI provides portable semantics; APPLY/LATERAL correlate rows without Cartesian bloat. |
| CTEs vs #TempTables | Chained/Recursive CTEs for trees; #TempTable for $> 1,000$ rows | Re-evaluating expensive CTEs multiple times in SQL Server | CTEs inline cleanly; #TempTable provides full column histograms, indexes, and TempDB caching. |
| OLAP & Cubing | GROUP BY GROUPING SETS / ROLLUP | Unbounded CUBE on $> 4$ dimensions ($2^N$ blowup) | GROUPING SETS avoids combinatorial explosion of unnecessary sub-aggregations. |
| Specialized Indexing | GIN for JSONB/trigrams; GiST for ranges; BRIN for append-only logs | B-Trees on high-cardinality JSONB/text or terabyte append-only logs | GIN enables containment/trigram search; BRIN gives 99% space savings on sequential data. |
| Stored Procedures & TVFs | Inline TVFs (iTVFs); parameterized sp_executesql / CALL | Multi-statement TVFs (mTVFs); string concatenation SQL | iTVFs inline into optimizer plans; dynamic SQL with parameters blocks SQL injection. |
| Oracle Cursors | SYS_REFCURSOR for drivers; BULK COLLECT + LIMIT 1000 | Row-by-row (RBAR) loops; BULK COLLECT without LIMIT | Bulk operations eliminate PL/SQL context switches; LIMIT prevents PGA memory exhaustion. |
| Window Functions | ROWS BETWEEN ... framing; DENSE_RANK() for top $N$ per group | Unbounded RANGE BETWEEN when physical rows suffice | ROWS operates on physical offsets avoiding temporary disk spooling. |
🛡️ Over-Engineering Self-Check (Anti-Bloat Guardrail)
Before generating queries, stored procedures, or table schemas, consult detect-overengineering:
- Avoid Speculative Indexes: Do not index every column proactively. Only index proven predicates.
- Avoid Query Ceremony: Prefer simple ANSI joins over multi-level nested CTEs unless intermediate materialization is required.
- Avoid
SELECT *: Explicitly specify required columns to enable Index-Only Scans.
📚 Modular Deep Topics
- MCP Workflow & Schema Discovery — Discovery workflow, tool payloads, and connection handling.
- Multi-Engine Joins Architecture — Dialect-specific join syntax,
APPLY,LATERAL, and MS Access parentheses rules. - Temporary Structures, CTEs & #TempTables — Chained/Recursive CTEs, CTE materialization,
#TempTablevs@TableVariable, and GTTs. - OLAP Cubing & Advanced Analytics — CUBE, ROLLUP, GROUPING SETS, percentiles, sessionization, and cohort retention.
- Window Functions, TVFs & Pivoting — Analytic window functions (
ROWSvsRANGE), cross-engine TVFs, and matrix pivoting. - Indexing & Performance Tuning — B-trees, composite ordering, sargability anti-patterns, and execution plans.
- PostgreSQL Specialized Indexing — GIN (
jsonb_ops,jsonb_path_ops,pg_trgm), GiST, and BRIN time-series indexes. - Stored Procedures, TVFs & Dynamic SQL — iTVFs vs mTVFs, output parameters, and
sp_executesql. - Oracle Cursors & PL/SQL Optimization —
SYS_REFCURSOR,BULK COLLECT+FORALLbatching, and cursor locking. - Data Extraction & Validation — Uniqueness, orphan checks, nullability audits, and checksums.
- Troubleshooting & Firewall Resolution — Resolving firewall blocks, deadlocks, and driver setup.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

