sql-helper
Skill0 starsChanged 6 days agoMITView on GitHub
Write, fix, explain or speed up SQL queries and schema changes against the project's real database schema. Use when the user asks for "a query that...", "a report from the database", "why is this query slow", "add an index", "update/delete these rows", or pastes SQL that returns wrong numbers.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- GSG-Devs/claude-vfp-skillstheir own version, first seen Oct 17, 2026
- aidankaokao/claude-skillstheir own version, first seen Oct 9, 2026
- bestdeejay-design/agent-skillstheir own version, first seen Aug 9, 2026
- kevinaimonster/skill-hubtheir own version, first seen Mar 18, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- bestdeejay-design/agent-skills★ 6same name
- GSG-Devs/claude-vfp-skills★ 4same name
- kevinaimonster/skill-hub★ 4same name
- aidankaokao/claude-skills★ 0same 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 repository24 other files it gives its agents.
- api-docsSkill
- changelogSkill
- ci-failure-fixSkill
- code-reviewSkill
- commit-messageSkill
- competitor-analysisSkill
- data-analystSkill
- debug-detectiveSkill
- dependency-upgradeSkill
- dockerizeSkill
- email-replierSkill
- eval-promptSkill
- incident-postmortemSkill
- meeting-notesSkill
- migration-safetySkill
- pr-descriptionSkill
- product-specSkill
- readme-writerSkill
- refactor-safelySkill
- research-briefSkill
- security-checkSkill
- seo-articleSkill
- support-replySkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Ask about row counts for big tables when performance matters.
- Distinctive: line 22
Before handing over, check each one that applies:
- Very specific: line 25
Grouping: every non-aggregated selected column is in GROUP BY.
- Distinctive: line 35
Do not run writes against production yourself unless the user explicitly asks.
- Very specific: line 40
Look for: full scans on large tables, functions or casts on indexed columns (WHERE lower(email) = ...), leading-wildcard LIKE '%x', sorts …
≈ “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 helper
1. Know the database and schema
- Dialect: from the connection string, driver or ORM config (
DATABASE_URL,prisma/schema.prismaprovider,settings.py,knexfile,docker-compose.ymlimage). Postgres, MySQL/MariaDB, SQLite and SQL Server differ in upserts, date functions, string concat,LIMIT/TOPand identifier quoting. - Schema: migrations or ORM models in the repo; otherwise ask the user to run
\d table(psql),SHOW CREATE TABLE t(MySQL) or.schema t(SQLite). Never guess column names, types or which columns are nullable. - Ask about row counts for big tables when performance matters.
2. Write the query
- Explicit column list, readable aliases, one join per line with its condition.
- In application code, use the driver's parameter placeholders. Never build SQL by concatenating user input.
- State any assumption about the data ("assumes one active subscription per user").
3. Check correctness traps
Before handing over, check each one that applies:
- Join fan-out: joining a one-to-many table before
SUM/COUNTmultiplies rows. Aggregate in a subquery or CTE first, then join. - NULLs:
col = NULLis never true;NOT IN (subquery)returns nothing if the subquery has a NULL (useNOT EXISTS);COUNT(col)skips NULLs,COUNT(*)does not;LEFT JOIN+ aWHEREon the right table turns it into an inner join (move the filter intoON). - Grouping: every non-aggregated selected column is in
GROUP BY. - Ordering:
LIMIT/pagination without a uniqueORDER BYgives unstable results. - Dates: time zones of stored timestamps, inclusive vs exclusive ranges (prefer
>= start AND < next_day), integer division in ratios. - Duplicates: does the user want distinct entities or all rows?
4. Writes (UPDATE, DELETE, INSERT ... SELECT)
- First give a
SELECT COUNT(*)and a sampleSELECTwith the exact sameWHERE, and ask the user to confirm the count. - Wrap in a transaction; check the affected row count before
COMMIT. - Large tables: batch by primary key ranges to avoid long locks and replication lag.
- Do not run writes against production yourself unless the user explicitly asks; hand them the SQL.
5. Slow queries
- Get the plan:
EXPLAIN(safe) orEXPLAIN ANALYZE(Postgres/MySQL 8).EXPLAIN ANALYZEexecutes the query: never use it on a write outside a transaction you roll back. - Look for: full scans on large tables, functions or casts on indexed columns (
WHERE lower(email) = ...), leading-wildcardLIKE '%x', sorts or hashes spilling to disk, N+1 queries coming from the app. - Index suggestions must name the exact columns and order (equality filters first, then range, then sort), and note the write cost. On Postgres production tables use
CREATE INDEX CONCURRENTLY; on MySQL check the online DDL behavior for the version. - Re-run the plan after the change and compare.
Output
The SQL in a code block, then 2-4 lines: what it returns (what one row means), assumptions, and any trap you guarded against. For schema changes, also give the rollback statement.
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.

