database

database is a skill for Claude Code, Codex from CaseMark/casedotdev-starter-app. It costs 0 tokens per session (2,587 once invoked), scanned A, original, Apache-2.0.

A guide for connecting an application to a Neon PostgreSQL database using Drizzle ORM. PostgreSQL is a relational database, while an ORM is a library that lets application code work with database tables through typed program objects.

In plain words
What is it for?
Use it to configure the database connection, define tables, create migrations, and write typed database queries in the create-legal-app starter kit.
Why use it?
It gives the project a defined place for database configuration, schema files, and version-controlled migrations. Type-safe queries can help catch mismatches between application code and the database earlier.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/casemark/casedotdev-starter-app/database
Any agent
npx skills add CaseMark/casedotdev-starter-app --skill database
Clone the repo
git clone --depth 1 https://github.com/CaseMark/casedotdev-starter-app

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/casemark/casedotdev-starter-app/database.svg)](https://agentmods.dev/skills/casemark/casedotdev-starter-app/database)
Your own site
<a href="https://agentmods.dev/skills/casemark/casedotdev-starter-app/database"><img src="https://agentmods.dev/badge/skills/casemark/casedotdev-starter-app/database.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,587 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.02587
Opus 5 $0.00000 $0.01293
Sonnet 5 $0.00000 $0.00517
Haiku 4.5 $0.00000 $0.00259

Measured 4d ago against content hash d3f8af9a67c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

database 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 · 481 lines

How it starts

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

Database Skill

Purpose

This skill covers database integration using Neon PostgreSQL and Drizzle ORM in the create-legal-app starter kit.

Key Concepts

  • Neon: Serverless PostgreSQL database
  • Drizzle ORM: TypeScript-first ORM
  • Migrations: Version-controlled schema changes
  • Type Safety: Fully typed database queries

Setup

Installation

bun add drizzle-orm @neondatabase/serverless
bun add -D drizzle-kit

Environment Variables

# .env.local
DATABASE_URL=postgresql://user:password@host/database?sslmode=require

Project Structure

/
├── lib/
│   ├── db/
│   │   ├── index.ts          # Database client
│   │   ├── schema.ts         # Database schema
│   │   └── migrations/       # Migration files
│   └── ...
├── drizzle.config.ts         # Drizzle configuration
└── package.json

Configuration

Drizzle Config

// drizzle.config.ts
import type { Config } from 'drizzle-kit';

export default {
  schema: './lib/db/schema.ts',
  out: './lib/db/migrations',
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
} satisfies Config;

Database Client

// lib/db/index.ts
import { drizzle } from 'drizzle-orm/neon-http';
import { neon } from '@neondatabase/serverless';
import * as schema from './schema';

const sql = neon(process.env.DATABASE_URL!);

export const db = drizzle(sql, { schema });

Schema Definition

Naming convention: use camelCase property names mapped to snake_case DB columns. Example: createdAt: timestamp("created_at"). For Better Auth tables specifically, always copy the templates from lib/auth/templates/ and keep the property names camelCase.

Basic Table

// lib/db/schema.ts
import { pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';

export const cases = pgTable('cases', {
  id: uuid('id').defaultRandom().primaryKey(),
  title: text('title').notNull(),
  description: text('description'),
  status: text('status').notNull().default('pending'),
  createdAt: timestamp('created_at').defaultNow().notNull(),
  updatedAt: timestamp('updated_at').defaultNow().notNull(),
});

Read the full file on GitHub · 481 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 · 481 lines · 0 tokens per session scan A d3f8af9a67c2

Subscribe to this mod's changes

database is a skill published in the GitHub repository CaseMark/casedotdev-starter-app (2 stars, last pushed 2mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,587 tokens. 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.

Related

Other skills, from other repositories

safe-sql-execution

Use whenever code will build, return, fetch, or execute SQL that runs against a user's real Postgres database — even when the request reads like an ordinary feature or bug fix and never says "security," "injection," or "SafeSqlFragment." This covers: writing or editing any pg-meta function, query builder, or endpoint…

supabase/supabase · 221 tokens

studio-e2e-tests

Write and run Playwright E2E tests for Supabase Studio (e2e/studio). Use when asked to run e2e tests, write new E2E tests, or debug flaky or failing Playwright tests. Covers running commands, avoiding race conditions, waiting strategies, selectors, helper functions, and CI vs local differences.

supabase/supabase · 74 tokens

studio-queries

React Query conventions for data fetching in Supabase Studio. Use when writing or reviewing query hooks, mutation hooks, or query keys in apps/studio/data/ — including adding the first fetch or mutation for a new API endpoint or resource. Covers queryOptions pattern, keys.ts structure, mutation hook template, and…

supabase/supabase · 68 tokens

upgrading-chart

Upgrades Helm chart dependencies (PostgreSQL, Vault) in the Chainloop project, including vendorized charts, container images, and CI/CD workflows. Use when the user mentions upgrading Helm charts, Bitnami dependencies, PostgreSQL chart, or Vault chart. CRITICAL - Major version upgrades are FORBIDDEN and must be…

chainloop-dev/chainloop · 73 tokens

payload-cms

Install and wire Payload CMS into this Next.js 16 app, backed by Supabase Postgres and Supabase Storage — packages, payload.config.ts, the (payload) route group, collections derived from the actual page views, type generation, migrations, and proving the read loop end-to-end. Use when the user asks to "add a CMS"…

textura-agency/next16-claude-starter · 101 tokens

dump-schema

Dump clean Postgres schema to a file and copy path to clipboard.

macro-inc/macro · 17 tokens