dev-database-patterns

dev-database-patterns is a skill for Claude Code from joaoguirunas/team-os. It costs 35 tokens per session (1,721 once invoked), scanned A, original, MIT.

A set of database design patterns for complex software, covering safe schema changes, indexes, repeated-query detection, soft deletion, and connection pooling.

In plain words
What is it for?
Use it when designing or reviewing database changes, improving query performance, or checking how an application manages deleted records and database connections.
Why use it?
It helps avoid slow queries, unsafe migrations, and database connection problems as an application grows.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

Good fit Use it when designing or reviewing database changes, improving query performance, or checking how an application manages deleted records and database connections.

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

Made for: Claude Code.

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 dev-database-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/joaoguirunas/team-os/dev-database-patterns/github.svg)](https://agentmods.dev/skills/joaoguirunas/team-os/dev-database-patterns)
Your own site
<a href="https://agentmods.dev/skills/joaoguirunas/team-os/dev-database-patterns"><img src="https://agentmods.dev/badge/skills/joaoguirunas/team-os/dev-database-patterns/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 dev-database-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/joaoguirunas/team-os/dev-database-patterns"><img src="https://agentmods.dev/badge/skills/joaoguirunas/team-os/dev-database-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,721 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.00035 $0.01721
Opus 5.5 $0.00014 $0.00688
Sonnet 5.5 $0.00007 $0.00344
Haiku 4.5 $0.00003 $0.00172

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

Security

Grade A, and why

dev-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 27d 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.

.claude/skills/dev-database-patterns/SKILL.md · 243 lines

How it starts

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

Database Patterns — Software Complexo

Migration Safety Protocol

Nunca aplicar migration sem este protocolo:

# 1. Snapshot — estado antes
pg_dump $DATABASE_URL --schema-only > backups/schema-$(date +%Y%m%d-%H%M%S).sql

# 2. Dry-run — verificar sem commitar (BEGIN + ROLLBACK)
psql $DATABASE_URL <<'EOF'
BEGIN;
\i migrations/001_add_users_table.sql
-- Verificar resultado sem commitar
SELECT COUNT(*) FROM users;
\d users
ROLLBACK;  -- Desfaz tudo — apenas verificação
EOF

# 3. Apply — executar de verdade
psql $DATABASE_URL -f migrations/001_add_users_table.sql

# 4. Smoke test — verificar integridade após apply real
psql $DATABASE_URL -c "SELECT COUNT(*) FROM users;"
psql $DATABASE_URL -c "\d users"

# 5. Rollback disponível (executar se smoke test falhar)
psql $DATABASE_URL -f migrations/001_add_users_table.rollback.sql

Nota: PostgreSQL não tem flag --dry-run nativo. O dry-run correto é sempre via BEGIN/ROLLBACK — executa a migration em transação e faz rollback sem commitar.

Migration Structure

Cada migration tem arquivo de rollback correspondente:

migrations/
├── 001_create_users.sql
├── 001_create_users.rollback.sql
├── 002_add_user_roles.sql
└── 002_add_user_roles.rollback.sql

Template de migration

-- migrations/001_create_users.sql
-- Migration: create users table
-- Author: dev-data-engineer
-- Date: 2026-04-21

BEGIN;

CREATE TABLE users (
  id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email       VARCHAR(255) NOT NULL UNIQUE,
  name        VARCHAR(100) NOT NULL,
  role        VARCHAR(50) NOT NULL DEFAULT 'member',
  created_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),
  updated_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),
  deleted_at  TIMESTAMPTZ  -- soft delete
);

CREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_users_role ON users(role) WHERE deleted_at IS NULL;

COMMENT ON TABLE users IS 'Core user accounts';

COMMIT;
-- migrations/001_create_users.rollback.sql
BEGIN;
DROP TABLE IF EXISTS users;
COMMIT;

Read the full file on GitHub · 243 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. 27d ago Changed 1a31d052f0ca
  2. 1mo ago First seen · 243 lines · 35 tokens per session scan A dacd3c66174c

Subscribe to this mod's changes

dev-database-patterns is a skill published in the GitHub repository joaoguirunas/team-os (5 stars, last pushed 3d ago), licensed MIT. It adds 35 tokens to every session and 1,721 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-08-31.