sql-conventions
Skill7 starsChanged 2 days agoMITView on GitHub
SQL linting and formatting with sqlfluff. TRIGGER when: creating or editing a `.sql` file (queries, migrations, seeds); adding SQL to a repo; setting up pre-commit for a project with SQL; user asks about SQL linting or sqlfluff. SKIP when: no SQL is involved.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leroyguillaume/claudeword for word, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 1
- leroyguillaume/claude★ 7100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
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 repository54 other files it gives its agents.
- adr-conventionsSkill
- api-conventionsSkill
- architecture-conventionsSkill
- argocd-conventionsSkill
- ci-conventionsSkill
- config-conventionsSkill
- contributing-conventionsSkill
- councilSkill
- cryptography-conventionsSkill
- dependency-update-conventionsSkill
- diagram-conventionsSkill
- docker-conventionsSkill
- documentation-conventionsSkill
- frontend-conventionsSkill
- github-actions-conventionsSkill
- github-issue-conventionsSkill
- github-pr-conventionsSkill
- github-repo-settingsSkill
- gitlab-ci-conventionsSkill
- helm-conventionsSkill
- herdr-core-delegationSkill
- herdr-delegationSkill
- herdr-tui-delegationSkill
- kopf-conventionsSkill
- kubernetes-operator-conventionsSkill
- logging-conventionsSkill
- logo-conventionsSkill
- mise-conventionsSkill
- ollama-conventionsSkill
- openssf-conventionsSkill
- pr-conventionsSkill
- pre-commit-conventionsSkill
- project-metadata-conventionsSkill
- python-async-conventionsSkill
- python-conventionsSkill
- readme-conventionsSkill
- release-script-conventionsSkill
- release-supply-chain-conventionsSkill
- renovate-ci-conventionsSkill
- rest-conventionsSkill
- rust-build-conventionsSkill
- rust-conventionsSkill
- rust-http-conventionsSkill
- security-policy-conventionsSkill
- signal-handling-conventionsSkill
- starlight-conventionsSkill
- systemd-conventionsSkill
- system-user-conventionsSkill
- task-conventionsSkill
- terraform-conventionsSkill
- topic-splittingSkill
- ui-copy-conventionsSkill
- web-layout-conventionsSkill
- yaml-conventionsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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 61
Keep non-trivial SQL in .sql files rather than inline string literals, so the linter sees it and the code stays readable.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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 conventions
Always lint SQL with sqlfluff. Any repo that
contains .sql files must have the sqlfluff pre-commit hook. Add it to
.pre-commit-config.yaml, pinned to an explicit rev:
- repo: https://github.com/sqlfluff/sqlfluff
rev: <latest tag SHA> # frozen: <latest tag>
hooks:
- id: sqlfluff-lint- Lint every
.sqlfile, not just some — query files and migrations (and seeds, fixtures, …). The hook matches\.sql$, so this is automatic. Add a
.sqlfluffat the repo root with at least the dialect and a raw templater (plain SQL, no Jinja/dbt):[sqlfluff] dialect = postgres templater = raw max_line_length = 100Set
dialectto the project's actual database.- Follow sqlfluff's style, don't fight it. Reformat the SQL to satisfy the
rules rather than disabling them. In practice that means: single spaces (no
column alignment in
CREATE TABLE— sqlfluff's layout defaults to single spacing, and its opt-inspacing_before = alignstays off), oneSELECTtarget per line when there is more than one, and consistent keyword casing. Only
exclude_rulesfor deliberate, justified cases, with a comment saying why. The common one: using reserved-ish words as identifiers — e.g. ausertable or arolecolumn — tripsRF04(keywords as identifiers) andRF06(unnecessary quoting, a false positive when the quotes are required). Exclude those, never silence spacing/layout rules to avoid reformatting:# We deliberately use the reserved words `user`/`role` as identifiers, # quoting `"user"` where Postgres requires it. exclude_rules = RF04, RF06- Prefer
sqlfluff fixto reformat in bulk when adopting it on an existing codebase, then commit the result; keepsqlfluff-lintas the gate.
Externalising queries (when the language allows it)
Keep non-trivial SQL in .sql files rather than inline string literals, so the
linter sees it and the code stays readable. In Rust with sqlx, load them with
include_str!("../queries/<entity>/<op>.sql") — it stays a &'static str (so
sqlx 0.9's anti-injection guard is satisfied) and the compiler tracks each file
for rebuilds. See rust-build-conventions for the sqlx specifics.
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.

