backend-developer

Enforce Next.js server actions, Drizzle ORM, and many-first patterns for backend features.

2|1|Updated Nov 18, 2025
One-click install
npx skills add https://github.com/ncrmro/tetrastack --skill backend-developer-ncrmro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-developer
Source: https://github.com/ncrmro/tetrastack/tree/main/.claude/skills/backend-developer
Command: npx skills add https://github.com/ncrmro/tetrastack --skill backend-developer-ncrmro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill accelerates backend development by standardizing CRUD operations, server actions, and TypeScript safety with Drizzle ORM.

Core Features & Use Cases

  • Many-First Design Pattern: Always operate on arrays; bulk mutations and safe batch processing.
  • Server Actions Over API Routes: Prefer server-side mutations for reliability and simplicity.
  • Drizzle ORM & TypeScript: Strong typing and ergonomic data access patterns.
  • Model Factory Pattern: Centralize data access logic and simplify tests.

Quick Start

Create a server action in src/actions/ using the 'use server' directive, define model operations with createModelFactory from src/lib/models/, and run migrations with the Makefile. Then write unit/integration tests to validate behavior.

Frequently Asked Questions about backend-developer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure backend CRUD operations with Drizzle ORM in Next.js?

Backend CRUD with Drizzle ORM in Next.js uses server actions and a many-first design pattern: always operate on arrays for bulk mutations. Create server actions in `src/actions/` with the 'use server' directive, define model operations via `createModelFactory` from `src/lib/models/`, and use Drizzle's typed queries for type-safe database access. This enforces reliable, transaction-safe batch processing.

Should I use server actions or API routes for backend mutations in Next.js?

Server actions are preferred over API routes for backend mutations in Next.js because they simplify data access, improve reliability, and integrate directly with TypeScript. They eliminate the need for client-server serialization overhead and provide built-in Zod-based validation alongside Drizzle ORM integration for safer, more maintainable backend logic.

How do I handle batch inserts, updates, and deletes with Drizzle ORM?

The many-first design pattern enforces batch operations on arrays rather than single records. Use Drizzle's bulk insert, update, and delete methods within server actions to process multiple rows atomically. Wrap operations in transactions to ensure data consistency, and validate array inputs with Zod before executing mutations.

What is the model factory pattern and why use it in Next.js backend development?

The model factory pattern centralizes all data access logic for a domain model into a single factory function. It simplifies tests by providing a mockable interface, reduces code duplication across server actions, and enforces consistent Drizzle ORM query patterns. Export factories from `src/lib/models/` for use across your application.

How do I set up database migrations and schemas with Drizzle in a Next.js project?

Define your database schema using Drizzle's TypeScript API in `src/lib/models/`, then run migrations via the Makefile target. Drizzle generates migration files automatically, and you execute them to keep your database in sync. This typed approach catches schema mismatches at development time and ensures consistency across environments.

Can I use Drizzle ORM with server actions without dynamic imports?

Yes. Drizzle ORM works seamlessly with server actions while avoiding dynamic imports—a tested, typed pattern in this Skill. Define model factories as static exports, import them directly in server actions, and leverage TypeScript's static analysis. This maintains LSP tooling support and ensures your backend logic is fully type-checked at build time.