sql

sql is a skill for Claude Code, Codex from saajunaid/caddis-plugin. It costs 19 tokens per session (2,177 once invoked), scanned A, original, MIT.

Guidance for writing SQL, the language used to read and change data in relational databases.

In plain words
What is it for?
Use it to write and improve database queries with general patterns and notes for specific database systems.
Why use it?
SQL that ignores performance, missing values, security, or readability can produce slow queries and incorrect results.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write and improve database queries with general patterns and notes for specific database systems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saajunaid/caddis-plugin/sql
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add saajunaid/caddis-plugin --skill sql
Clone the repo
git clone --depth 1 https://github.com/saajunaid/caddis-plugin

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql

README.md
[![agentmods](https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/sql/github.svg)](https://agentmods.dev/skills/saajunaid/caddis-plugin/sql)
Your own site
<a href="https://agentmods.dev/skills/saajunaid/caddis-plugin/sql"><img src="https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/sql/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql

Your own site · 80×15
<a href="https://agentmods.dev/skills/saajunaid/caddis-plugin/sql"><img src="https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/sql.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,177 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.02177
Opus 5.5 $0.00008 $0.00871
Sonnet 5.5 $0.00004 $0.00435
Haiku 4.5 $0.00002 $0.00218

Measured 19d ago against content hash 449150a0a942, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

sql scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 19d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/coding/sql/SKILL.md · 322 lines

How it starts

The opening of the file, as written. The whole thing — 322 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SQL Expert Skill

Write high-quality, optimized SQL for enterprise environments. Covers performance, edge cases, and real-world gotchas.

When to Use

  • Writing new SQL queries
  • Optimizing existing queries
  • Handling large datasets (100K+ rows)
  • Creating stored procedures or views
  • Debugging slow queries

SQL Quality Standards

1. Always Include Comments

-- Get open orders with SLA breach risk
-- Filters: Last 7 days, excludes test data
-- Expected rows: ~500-2000
SELECT
    OrderID,
    CustomerName,
    DATEDIFF(HOUR, CreatedAt, GETDATE()) AS hours_open
FROM Orders
WHERE CreatedAt >= DATEADD(DAY, -7, GETDATE())
    AND Status = 'Open'
ORDER BY hours_open DESC;

2. Readable Formatting

SELECT
    o.OrderID,
    o.CustomerName,
    o.Status,
    COUNT(i.ItemID) AS item_count
FROM Orders o
LEFT JOIN OrderItems i ON o.OrderID = i.OrderID
WHERE o.Status = 'Open'
GROUP BY o.OrderID, o.CustomerName, o.Status
HAVING COUNT(i.ItemID) > 0
ORDER BY item_count DESC;

Large Dataset Patterns

Pagination

-- OFFSET-FETCH (SQL Server 2012+ / PostgreSQL)
SELECT OrderID, CustomerName, Status
FROM Orders
WHERE Status = 'Open'
ORDER BY CreatedAt DESC
OFFSET 50 ROWS FETCH NEXT 25 ROWS ONLY;

-- Keyset pagination (faster for deep pages)
SELECT TOP 25 OrderID, CustomerName, CreatedAt
FROM Orders
WHERE CreatedAt < @lastSeenDate AND Status = 'Open'
ORDER BY CreatedAt DESC;

Batching Large Operations

DECLARE @BatchSize INT = 5000;
DECLARE @RowsAffected INT = 1;

WHILE @RowsAffected > 0
BEGIN
    UPDATE TOP (@BatchSize) Orders
    SET ProcessedFlag = 1
    WHERE Status = 'Closed' AND ProcessedFlag = 0;
    SET @RowsAffected = @@ROWCOUNT;
    WAITFOR DELAY '00:00:00.100';
END

NULL Handling

-- Use IS NULL (not = NULL)
SELECT * FROM Orders WHERE Category IS NULL;

-- ISNULL (SQL Server) vs COALESCE (ANSI standard)
SELECT ISNULL(Category, 'Unknown') FROM Orders;
SELECT COALESCE(Category, SubCategory, 'Unknown') FROM Orders;

-- NULL in aggregations: COUNT(*) counts all, COUNT(col) excludes NULLs
SELECT COUNT(*) AS total, COUNT(Category) AS non_null FROM Orders;
SELECT ISNULL(SUM(Amount), 0) AS total FROM Orders;

Read the full file on GitHub · 322 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 19d ago Changed · -13 tokens per session 449150a0a942
  2. 1mo ago First seen · 322 lines · 32 tokens per session scan A 6a03ad404d2e

Subscribe to this mod's changes

sql is a skill published in the GitHub repository saajunaid/caddis-plugin (0 stars, last pushed 2d ago), licensed MIT. It adds 19 tokens to every session and 2,177 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.