Database Patterns

Database Patterns is a skill for Claude Code, Codex from AmariahAK/atlarix-skills. It costs 2 tokens per session (841 once invoked), scanned A, original, Apache-2.0.

A guide to designing databases, writing queries, and shipping schema migrations, which change a database’s structure over time. It emphasizes parameterized queries, intentional indexes, transactions, and backward-compatible changes.

In plain words
What is it for?
Use it when designing tables, adding indexes, writing multi-step updates, or planning safe database migrations.
Why use it?
It helps prevent SQL injection, slow queries, broken deployments, data inconsistencies, and long database locks.

Skill for Claude CodeCodex

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

Good fit Use it when designing tables, adding indexes, writing multi-step updates, or planning safe database migrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/amariahak/atlarix-skills/database
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 AmariahAK/atlarix-skills --skill database
Clone the repo
git clone --depth 1 https://github.com/AmariahAK/atlarix-skills

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 Database Patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/amariahak/atlarix-skills/database.svg)](https://agentmods.dev/skills/amariahak/atlarix-skills/database)
Your own site
<a href="https://agentmods.dev/skills/amariahak/atlarix-skills/database"><img src="https://agentmods.dev/badge/skills/amariahak/atlarix-skills/database.svg" alt="Measured on agentmods" height="20"></a>
Per session 2 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 841 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.00002 $0.00841
Opus 5 $0.00001 $0.00420
Sonnet 5 $0.00000 $0.00168
Haiku 4.5 $0.00000 $0.00084

Measured 4d ago against content hash 81d3f2aa1cb5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

Database Patterns 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 4d 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.

skills/database/SKILL.md · 136 lines

How it starts

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

Database Patterns

When to use this skill

Use this skill when designing schemas, writing queries, or shipping migrations—especially when correctness and safety matter more than clever SQL.

Core patterns

Always parameterize queries (never string concat)

Bad:

  • "... WHERE id = " + userId

Good:

  • placeholders / prepared statements
  • ORM query builders

Index strategy (minimal and intentional)

Add indexes for:

  • foreign keys used in joins
  • columns used in frequent filters (WHERE)
  • columns used in sorting (ORDER BY) on large tables

Avoid:

  • indexing everything (writes get slower)
  • redundant composite indexes

Migration safety (backward compatible)

Rules:

  • additive first: add column nullable → backfill → enforce NOT NULL later
  • don’t drop columns in the same migration as adding replacements
  • avoid long locks on hot tables (use online patterns where possible)

Transactions

Use transactions for:

  • multi-step writes that must succeed/fail together
  • invariants across rows/tables

Avoid:

  • long-running transactions that hold locks during network calls

Example (pseudo-SQL):

BEGIN;
  UPDATE accounts SET balance = balance - 100 WHERE id = :from_id;
  UPDATE accounts SET balance = balance + 100 WHERE id = :to_id;
COMMIT;

N+1 detection

Symptoms:

  • a loop that queries per item
  • slow endpoints that scale with list size

Fix patterns:

  • join + aggregate
  • IN (...) query
  • preloading/relations in ORM

SQLite-specific quirks

  • Consider WAL mode for concurrency
  • Be careful with “type affinity” (validate types at boundaries)
  • Prefer STRICT tables if available in your SQLite version

Connection pooling

  • Use pooling for server apps
  • Use one-off connections for scripts (but close them)

Schema design: constraints are your friend

Prefer database-enforced invariants:

  • NOT NULL for required fields
  • UNIQUE for natural keys where appropriate
  • CHECK constraints for bounded enums / ranges

Why:

  • catches bugs earlier than application code
  • prevents “invalid state” from ever being stored

Read the full file on GitHub · 136 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. 4d ago First seen · 136 lines · 2 tokens per session scan A 81d3f2aa1cb5

Subscribe to this mod's changes

Database Patterns is a skill published in the GitHub repository AmariahAK/atlarix-skills (2 stars, last pushed 7d ago), licensed Apache-2.0. It adds 2 tokens to every session and 841 once invoked, about $0.0000 per session on Opus 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.

Related

Other skills, from other repositories