lang-sql
Skill5 starsChanged 46 days agoMITView on GitHub
use this when writing, reviewing, or migrating SQL — *.sql, schema files, embedded queries in host code. postgres-shaped defaults; name the dialect if it is not postgres. load with the host language skill when the query lives in application code.
- Deletes or force-pushes
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- maintainers/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- buying-researcherSkill
- cursor-cloud-agents-whenSkill
- debug-anthropicSkill
- debug-pocockSkill
- debugSkill
- discover-the-ideaSkill
- docs-google-styleSkill
- golang-safetySkill
- golang-securitySkill
- golang-testingSkill
- grok-acpSkill
- host-config-pyinfraSkill
- lang-cppSkill
- lang-csharpSkill
- lang-cSkill
- lang-dartSkill
- lang-dockerSkill
- lang-goSkill
- lang-javaSkill
- lang-js-tsSkill
- lang-kotlinSkill
- lang-luaSkill
- lang-makefileSkill
- lang-phpSkill
- lang-powershellSkill
- lang-protobufSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-shellSkill
- lang-swiftSkill
- lang-terraformSkill
- language-routerSkill
- lang-web-markupSkill
- modern-pythonSkill
- pr-reviewSkill
- sdlc-artifactsSkill
- sdlc-onboardingSkill
- security-hardeningSkill
- shell-safetySkill
- tddSkill
- tracker-sdlcSkill
- ui-craftSkill
- ux-designSkill
- verify-before-doneSkill
- yagniSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
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
- Distinctive: line 20
Run the migration against a disposable database when one exists.
- Very specific: line 38
Check rowcount when a write must touch exactly N rows.
- Distinctive: line 45
Avoid long transactions that hold row locks across user think-time.
- Distinctive: line 57
Every user-influenced value is a bind parameter.
- Distinctive: line 60
Do not edit a migration that has already run.
≈ “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
Parameterize or do not ship. No scripts/.
Process skills that may load with this one: load-with list. SQL beside its host language: Algorithm.
Iron law
Parameters, never string concatenation. Migrations are forward-only and reversible, or explicitly one-way.
Tooling / verify
- Host-language tests cover the bind path (this is the real test).
EXPLAINthe new query before adding an index "for speed."- Run the migration against a disposable database when one exists.
Name the dialect in the PR if it is not Postgres.
Idioms a linter misses
- Bound parameters (
$1,?, named) from the host. Always. - Name columns. No
SELECT *in application queries. - Transactions around multi-statement writes.
timestamptzfor instants (Postgres). Money: integer cents ornumeric, not float.- Indexes for predicates you actually use, not every column.
NOT NULLwhen absence has no meaning.
Errors
- Constraint failures are data errors, not "retry until it works" unless the operation is documented idempotent.
- Check
rowcountwhen a write must touch exactly N rows.
Concurrency
- Know the isolation level the app already uses.
SELECT … FOR UPDATEonly with a transaction and a short critical section.- Avoid long transactions that hold row locks across user think-time.
Testing
- Fixture data in the test DB or transaction-per-test as the project already does.
- Assert on the rows, not only "no exception."
- Migration tests: apply on empty and on a snapshot of prod-shaped data when the project has that harness.
PR review
- Every user-influenced value is a bind parameter.
- Destructive DDL has an expand-contract plan.
- New index:
EXPLAINevidence, or do not add it. - Do not edit a migration that has already run.
Security
- Least-privilege role for the app (no owner role at runtime).
- No
SECURITY DEFINERfunctions unless the project already uses them and the body is reviewed. - Views / RLS: do not assume the app layer is the only client.
Always
- Binds. Named columns. Transactions on multi-writes.
Ask first
- DROP COLUMN / DROP TABLE / type change of a shipped column.
- Dialect switch (MySQL / SQLite / SQL Server).
- New extension or
SECURITY DEFINER.
Never
- String-built SQL with user input (including "it's an int").
- Interpolating identifiers (table/column names) from user input.
LIKEpatterns from user text without escaping%and_.- Float for money.
- Re-editing applied migrations.
SELECT *in app code.
Red flags
- "I'll just interpolate, it's an int"
- "SELECT * is fine"
- "We'll add the index if it's slow"
- "The ORM will escape it" without checking the generated SQL
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.

