Skill v1.0.0
currentAutomated scan100/100name: pgsql-lint-setup description: This skill should be used when the user runs /pgsql-lint-setup or asks to "set up squawk", "add SQL linting", "lint our Postgres migrations", "add a migration linter to CI", "fail the build on unsafe migrations" or "scaffold .squawk.toml", or asks how to set squawk's pg_version or assume_in_transaction, how to exclude or ignore a squawk rule, how to run squawk in GitHub Actions, or how to check PL/pgSQL functions with plpgsql_check. It writes the reference .squawk.toml (PostgreSQL 18, migration files assumed to run in a transaction) without overwriting an existing one, and reports the commands for local runs and CI. Not for what a squawk rule means or how to fix the migration (pgsql-migrations). argument-hint: optional target directory (defaults to the repository root) allowed-tools:
- Read
- Write
- Glob
- Grep
- Bash(squawk *)
metadata: version: "1.0.0"
pgsql-lint-setup: the reference squawk config
Write the block below. It is the same text asreferences/squawk.tomlat the plugin root (besideskills/). To compare with the shipped file, read../../references/squawk.tomlfrom this skill's directory. On Claude Code that file is also${CLAUDE_PLUGIN_ROOT}/references/squawk.toml. Do not Glob the user's repository for it.
Scope: write squawk's config into a repository and report how to run it, in one interaction. squawk lints migration files for statements that block reads or writes or break running clients (squawk rules).
Deterministic backstop: squawk itself; this skill only configures it.
$ARGUMENTS is an optional directory on Claude Code. On Cursor, argument-hint, allowed-tools and $ARGUMENTS are not applied: take an optional directory from the user's message. Default on both hosts is the repository root. Call that directory $ROOT below.
Steps
- Do not overwrite an existing config. squawk walks up from the current directory to find
.squawk.toml(squawk CLI), so check$ROOTand its parents. If one exists, show how it differs from the block below and ask before changing anything. - Find the migration files and the runner. Glob
**/*.sqlunder folders such asmigrations/ordb/migrations/. A-- +goose Upline marks goose (goose annotations);{version}_{title}.up.sqland.down.sqlpairs mark golang-migrate (golang-migrate MIGRATIONS.md). Both wrap a file in a transaction, so keepassume_in_transaction = true(the block's comment says when not to). - Write `$ROOT/.squawk.toml` from the block below. Set
pg_versionas its comment says. - List goose files marked `-- +goose NO TRANSACTION` that lack `-- squawk-disable-assume-in-transaction`. Report them; do not edit migration files in this command.
- Run it once when `squawk` is on PATH:
squawk 'migrations/*.sql', with the glob quoted. Report the count of findings; fixing them ispgsql-migrations. - Report the commands under Running squawk and the plpgsql_check line.
Config to write
# .squawk.toml: reference config from the pgsql-coding plugin (/pgsql-lint-setup).# Rules: https://squawkhq.com/docs/rules Keys: https://squawkhq.com/docs/cli# Lint as PostgreSQL 18, the plugin's floor; set the major version the# migrations run on. Version-gated rules follow it: prefer-repack fires from 19.pg_version = "18"# goose runs each migration file in one transaction, and golang-migrate sends a# file as one Exec, which PostgreSQL runs as one implicit transaction. Set false# when the runner sends each statement on its own. A file that runs outside a# transaction (goose "-- +goose NO TRANSACTION") carries the comment# "-- squawk-disable-assume-in-transaction".assume_in_transaction = true# No rule is excluded: each default rule backs a pgsql-migrations or pgsql-schema# rule. Ignore one finding in place with "-- squawk-ignore <rule-id>" instead.excluded_rules = []
Running squawk
- Install with
npm install -g squawk-cli,pip install squawk-cli, or a binary from the releases page (squawk quick start). Pin an exact version in CI and bump it on purpose, so a new squawk rule cannot fail an unrelated pull request. - Run locally:
squawk 'migrations/*.sql'; for golang-migrate,squawk 'migrations/*.up.sql', since the down files drop what the up files add. squawk exits non-zero when it reports any violation (reporter source). - Ignore a finding where it occurs:
-- squawk-ignore <rule-id>on the line before the statement, or-- squawk-ignore-file <rule-id>for a whole file (squawk CLI). A goose file'sDownpart is linted too; mark an intended drop there. Opt-in rules are switched on withincluded_rules. - GitHub Actions: the action installs
squawk-clifrom npm atversion(defaultlatest) and only comments on the pull request unlessfail-on-violationsis"true"(squawk-action):
- uses: sbdchd/squawk-action@v2with:pattern: "migrations/*.sql"version: "<exact squawk-cli version>"fail-on-violations: "true"
PL/pgSQL functions
squawk does not check function bodies. plpgsql_check is a server extension that checks PL/pgSQL bodies against the catalog: unknown columns, wrong types, unused variables, a missing RETURN, and, with security_warnings => true, EXECUTE open to SQL injection (plpgsql_check). Install it in the development or CI database, then:
CREATE EXTENSION plpgsql_check;SELECT * FROM plpgsql_check_function('public.refresh_totals()', security_warnings => true);
The README has queries that check every function and trigger function at once. The Postgres Language Server also lints migrations, with rules inspired by squawk; its CLI is postgres-language-server check <file> and its config postgres-language-server.jsonc (getting started). Keep squawk as the CI gate so the advice in pgsql-migrations matches the tool.
Sources
- squawk CLI and
.squawk.tomlkeys (pg_version,assume_in_transaction,excluded_rules,included_rules,excluded_paths): <https://squawkhq.com/docs/cli> (checked 2026-10-27; squawk v2.70.0, released 2026-10-15) - squawk quick start and rules: <https://squawkhq.com/docs/>, <https://squawkhq.com/docs/rules> (checked 2026-10-27)
- squawk source at v2.70.0, opt-in rules, default
pg_version, theprefer-repackversion gate, exit code: <https://github.com/sbdchd/squawk/tree/v2.70.0/crates> (checked 2026-10-27) - squawk-action inputs: <https://github.com/sbdchd/squawk-action/blob/main/action.yml> (checked 2026-10-27; action v2.2.0)
- goose annotations: <https://pressly.github.io/goose/documentation/annotations/> (checked 2026-10-27)
- golang-migrate file naming and PostgreSQL driver: <https://github.com/golang-migrate/migrate/blob/master/MIGRATIONS.md>, <https://github.com/golang-migrate/migrate/blob/master/database/postgres/README.md> (checked 2026-10-27)
- plpgsql_check README, PostgreSQL 14 to 20 supported: <https://github.com/okbob/plpgsql_check> (checked 2026-10-27; v2.10.16)
- Postgres Language Server getting started: <https://pg-language-server.com/latest/getting_started/> (checked 2026-10-27; v0.28.2)