/omniskill:sql-queriesfrom omniskill
Writes correct, safe SQL queries for audits, discovery, and reporting, with join and aggregation traps called out.
Ships in omniskill. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Pull records with SQL · OmniSkill Legal crew
Getting the right records out of a database — for an audit, a discovery request, a compliance report, or an operational question.
Never write a query against an assumed schema. Inspect first:
-- Postgres
\d table_name
SELECT column_name, data_type, is_nullable
FROM information_schema.columns WHERE table_name = 'orders';
Establish: primary and foreign keys, which columns are nullable, whether deletes are soft (deleted_at) or hard, and the timezone convention on timestamps. Each of these silently changes results.
Soft deletes. If the schema has deleted_at, every query needs WHERE deleted_at IS NULL unless deleted rows are wanted. Forgetting this inflates every count.
Fan-out on joins. Joining a one-to-many relationship multiplies rows. SUM(orders.total) after joining line items sums each order once per line item. Aggregate in a subquery or CTE first, then join.
NULL semantics. NULL = NULL is not true. NOT IN (subquery) returns no rows if the subquery yields a single NULL — use NOT EXISTS. Aggregates skip NULLs, so AVG over a column with NULLs divides by a smaller count than expected.
COUNT(*) vs COUNT(col). The first counts rows; the second counts non-NULL values.
Timezones. created_at in UTC bucketed by local day shifts records across boundaries. Convert explicitly: created_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/New_York'.
Inclusive ranges. BETWEEN '2026-01-01' AND '2026-01-31' on a timestamp excludes almost all of January 31. Use >= start AND < next_day.
Implicit type coercion. Comparing a string column to a number can silently cast and full-scan, or error, depending on engine.
Read-only by default. For audit and discovery work, connect with a read-only role. If a mutation is genuinely required, that is a separate, explicitly confirmed action.
Never build SQL by string concatenation with untrusted input. Use parameterised queries — this is injection prevention, not style.
Test the shape before the full run. Run with LIMIT 10 first and check the columns and row shape are what was intended. Then remove the limit.
Check the plan on anything large. EXPLAIN ANALYZE before running a query over millions of rows on a production replica. A sequential scan on a large table can lock up a shared database.
Prefer a read replica for analytical work. Long analytical queries on a primary compete with the application.
Legal and audit output gets scrutinised, so the query must be readable:
WITH active_customers AS (
SELECT id, email, created_at
FROM customers
WHERE deleted_at IS NULL
AND created_at >= '2026-01-01'
),
order_totals AS (
SELECT customer_id, SUM(total) AS lifetime_value, COUNT(*) AS order_count
FROM orders
WHERE status = 'completed' AND deleted_at IS NULL
GROUP BY customer_id -- aggregate BEFORE joining, to avoid fan-out
)
SELECT c.id, c.email, COALESCE(o.lifetime_value, 0) AS lifetime_value
FROM active_customers c
LEFT JOIN order_totals o ON o.customer_id = c.id
ORDER BY lifetime_value DESC;
CTEs over nested subqueries. Comment the non-obvious filter, not the obvious one.
For a legal or compliance pull, select only the columns actually needed. Exporting a full table when three fields were requested creates a new personal-data problem while solving a records problem. Route handling questions to /omniskill:compliance.
Verify the row count is plausible before sending. State the exact query, the database and environment, and the timestamp it ran — a result set without its query cannot be reproduced or checked.
Export tabular results via /omniskill:xlsx.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ipedrax/omniskill --plugin omniskill70 skills in this plugin
/3-statementsFull 3-statement financial model. OmniSkill Finance crew — links income statement, balance sheet, and cash flow so the balance sheet ties to zero./ad-creativeScale ad creative variations. OmniSkill Marketing crew — builds a structured variation matrix across angles, hooks, and formats so tests isolate what actually drives performance./airshipVisual editor for the running app. OmniSkill Design crew — drives the airship CLI, which puts an infinite canvas in front of the dev server you already have: click an element, describe the change, and a coding agent edits the source file it came from.Other plugins' skills for the same job