backend-engineering

Implements backend patterns for Drizzle ORM, Postgres, and Hono on Next.js API routes.

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/masakinihirota/2026src-ni --skill backend-engineering-masakinihirota
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: backend-engineering
Source: https://github.com/masakinihirota/2026src-ni/tree/main/.agents/skills/backend-engineering
Command: npx skills add https://github.com/masakinihirota/2026src-ni --skill backend-engineering-masakinihirota

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Backend development with Postgres, Drizzle ORM, and Hono on Next.js involves many subtle pitfalls: N+1 query problems, missing row-level security, type inference build errors, and unsafe API designs for AI agents. This Skill provides concrete implementation patterns and best practices so you write correct, secure backend code the first time. ## Core Features & Use Cases - Drizzle ORM & Postgres Best Practices: Type-safe schema definitions, relation-aware queries that avoid N+1 problems, partial column selects, and a safe migration workflow with manual SQL review. - Hono x Next.js Patterns: Standard route handler setup using hono/vercel with Edge Runtime, plus guidance on type inference pitfalls and how to handle build-time type errors. - Agent-Facing API Design: Idempotency-Key handling for mutating requests, async job patterns returning 202 Accepted, and observability logging with traceId, toolName, and agentId metadata. - Use Case: When adding a new API endpoint to a Next.js app backed by Postgres, apply this Skill to define the Drizzle schema with RLS enabled, wire up a Hono route handler, and make the endpoint idempotent for agent-driven clients. ## Quick Start Apply the backend-engineering skill to review my Drizzle schema and Hono API route for best practices and security issues.

Frequently Asked Questions about backend-engineering

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

FAQPage Schema
How do I set up Hono with Next.js App Router API routes?▼

Create a catch-all route file at src/app/api/[[...route]]/route.ts, instantiate Hono with basePath("/api"), and export handlers using handle(app) from hono/vercel. Setting runtime to "edge" is recommended for Edge Runtime deployment.

How do I avoid N+1 queries with Drizzle ORM?▼

Use Drizzle's relational query API with the with option, such as db.query.users.findMany({ with: { posts: true } }), to fetch related records in a single query. Also select only the columns you need to reduce bandwidth.

Does Drizzle ORM support Postgres row level security?▼

Drizzle migrations can include ALTER TABLE ... ENABLE ROW LEVEL SECURITY statements, or you can apply them via a SQL editor. Every table should have RLS enabled, with direct client access used for operations Drizzle cannot cover.

Why does Hono Context type cause build errors in Next.js?▼

Explicitly importing the Context type often triggers build errors in this setup. Rely on implicit type inference instead, and if errors persist, use a localized any with a TODO comment to track the technical debt.

How do I make API endpoints safe for AI agent retries?▼

Require an Idempotency-Key header on POST, PUT, and DELETE requests, record processing state per key, and return the stored response for duplicate submissions. For long-running work, return 202 Accepted with a job ID and a polling endpoint.