Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Sql Patterns

ASecurity

SQL discipline — lowercase keywords (modern convention; consistent project-wide), explicit column names (no SELECT * in production), UTC timestamps (TIMESTAMPTZ in Postgres), singular vs plural table names consistent, explicit JOIN (no implicit comma-joins), CTEs over deeply nested subqueries, named indexes, NULL-aware semantics (NULL = NULL is UNKNOWN; use IS NULL), parameterised queries always (no string interpolation), DELETE/UPDATE always with WHERE, migrations idempotent + reversible (ex...

12 stars
0 votes
0 copies
0 views
Added 9/28/2026
ai-agentsgojavasqlnodetestinggitdatabasesecurityperformance

Works with

cursor

Security Analysis

A100/100

Scanned 9/28/2026

Install to Claude Code

$npx -y skills add Nmor/the-claude-council --skill sql-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sql Patterns?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Sql Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nmor-sql-patterns/badge)](https://www.skillsdirectory.com/skills/nmor-sql-patterns)

More formats (shields.io, HTML) on the badges page.

Files
SKILL.md
---
name: sql-patterns
description: SQL discipline — lowercase keywords (modern convention; consistent project-wide), explicit column names (no SELECT * in production), UTC timestamps (TIMESTAMPTZ in Postgres), singular vs plural table names consistent, explicit JOIN (no implicit comma-joins), CTEs over deeply nested subqueries, named indexes, NULL-aware semantics (NULL = NULL is UNKNOWN; use IS NULL), parameterised queries always (no string interpolation), DELETE/UPDATE always with WHERE, migrations idempotent + reversible (expand-contract pattern), sqlfluff strict + squawk Postgres migration safety. Auto-fires on SQL sources.
paths:
  - "**/*.sql"
  - "**/migrations/**/*.sql"
  - "**/db/**/*.sql"
  - "**/schema.sql"
  - "**/seeds/**/*.sql"
---

# sql-patterns

> **Size budget: 25 KB.** Check: wc -c. Gate: node ~/.claude/scripts/token-budget.mjs --check
>
> Migrated 2026-06-02 from `~/.claude/rules-library/sql/` as part of the lazy-rules-loading plan.
> Phase H will delete the source files.

## Purpose

SQL discipline for every `*.sql`, `migrations/**`, `db/**`, `schema.sql` and
`seeds/**` file: how the SQL is written, what is banned, how schemas and indexes
are shaped, how the database is secured, how it is tested, and the gates that
enforce all of it.

This file is a ROUTING TABLE only. Each row's detail lives in one reference file
under `references/` — open the row you need, not the whole skill.

## Routing table

| Row | Read | What it holds |
| --- | --- | --- |
| **Coding style** | [`references/coding-style.md`](references/coding-style.md) | Core principle · Formatting · Naming · Hard rules 1-10 (no `SELECT *`, explicit JOIN, JOIN type, CTEs over nested subqueries, UTC timestamps, NOT NULL by default, FK `ON DELETE`/`ON UPDATE`, check constraints, index every FK, EXPLAIN every non-trivial query) · Migration style · Required tooling (`sqlfluff` + `.sqlfluff`) · Cross-references |
| **Hooks + CI** | [`references/hooks.md`](references/hooks.md) | Pre-commit gates (`.githooks/pre-commit`, `.githooks/pre-push`) · full `.sqlfluff` config · `.squawk.toml` (Postgres migration safety) · the `SQL CI` GitHub Actions workflow (lint / test / cve-scan) · Cross-references |
| **No-discards** | [`references/no-discards.md`](references/no-discards.md) | Core principle · 15 banned patterns (string interpolation, `DELETE`/`UPDATE` without `WHERE`, `SELECT *`, missing transaction boundary, implicit type coercion, `= NULL`, `count(*)` on huge tables, unbounded `IN`, ORM N+1, hardcoded credentials, destructive migrations, unbounded `statement_timeout`, unpaired `SET ROLE`, `CREATE INDEX` without `CONCURRENTLY`, `NOT IN (… NULL …)`) · Required tooling · Verification block · Cross-references |
| **Schema, index + query patterns** | [`references/patterns.md`](references/patterns.md) | Core principle · Schema patterns (identity columns, soft vs hard delete, created/updated timestamps) · Indexing patterns (B-tree, partial, covering `INCLUDE`, GIN/GIST) · Query patterns (cursor vs offset pagination, upsert, `RETURNING`, window functions, recursive CTE, materialised views) · Partitioning · Anti-patterns 1-4 (EAV, index-everything, generic key-value column, one giant base table) · Cross-references |
| **Security** | [`references/security.md`](references/security.md) | Core principle · OWASP SQL specifics (A01 broken access control / RLS, A02 cryptographic failures / pgcrypto, A03 injection, A07 authentication / roles, A09 logging / pgaudit) · Multi-tenant isolation patterns table · Backup + recovery encryption · Privilege-escalation defence (`SECURITY DEFINER` + `search_path`) · Required tooling · Cross-references |
| **Testing** | [`references/testing.md`](references/testing.md) | Core principle · Migration testing · pgTAP for Postgres · Test fixtures · Testcontainers (Java + Go) · Query testing patterns table · Hard rules 1-7 (real engine not a substitute, migration idempotency, rollback, multi-tenant isolation, EXPLAIN-plan regression, performance budget, data-integrity invariants) · CI integration · Cross-references |

## Standards cited across the references

SQL:2023 (ISO/IEC 9075) · PostgreSQL Style Guide · Mode Analytics SQL Style Guide ·
GitLab Data Team SQL Style Guide · sqlfluff · squawk · Flyway · OWASP SQL Injection
Cheat Sheet · OWASP Database Security Cheat Sheet · CIS PostgreSQL / MySQL Benchmarks ·
PostgreSQL Row-Level Security · PCI-DSS · HIPAA · GDPR · pgTAP · utPLSQL · tSQLt ·
Testcontainers · Designing Data-Intensive Applications (Kleppmann) · The Art of
PostgreSQL (Tagliaferri) · High Performance MySQL (Schwartz et al.) · dbt best practices

Attribution

NmorNmor
View sourceMore from Nmor →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1074701 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

695601 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

691 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →