sk-db
OfficialShip consistent DB patterns with guardrails
AuthorTimeKast
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill solves the inconsistency and fragility of database code by standardizing audit fields, soft-deletes, dual human/technical IDs, pagination, deletion eligibility, and the migration workflow so your Next.js/Drizzle projects behave predictably in production.
Core Features & Use Cases
- Enforces mandatory audit fields: Adds
createdAt/createdBy/modifiedAt/modifiedByviaauditFieldsand documents how to populate them using the kit’s injecteduserIdfrom server action wrappers. - Implements soft delete conventions: Adds
deletedAt/deletedBywithsoftDeleteFieldsand guarantees reads filter out deleted rows vianotDeleted(). - Standardizes dual-ID human identifiers: Provides
generateHumanId, atomic sequence-basedgetNextHumanId, gap-resilientgetNextHumanIdSeq, and race-safewithHumanIdRetry()including the required SAVEPOINT behavior when called inside a parent transaction. - Provides safe pagination primitives: Uses
parsePaginationParams,buildPaginationSQL, andcreateCachedCountwith revalidation tagging to prevent stale totals. - Adds hard-delete eligibility checks: Uses
canHardDeleteUserto prevent permanent deletion when downstream references exist. - Gives repeatable migration and DB inspection workflow: Establishes
db:generate→ review SQL →db:migrate, and read-only inspection viapnpm db:query.
Quick Start
Use the sk-db helpers when creating new Drizzle schema files and mutations to ensure every table includes auditFields, applies softDeleteFields where appropriate, and uses the kit’s pagination, human-id, and migration conventions.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: sk-db Download link: https://github.com/TimeKast/AgendaInteligente/archive/main.zip#sk-db Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.