database-postgres-prisma

Design database schemas, migrations, and indexes for PostgreSQL, MySQL, and Prisma.

5|15|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill database-postgres-prisma-clfigueiredo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database-postgres-prisma
Source: https://github.com/clfigueiredo/hermes-infra-skills/tree/main/.hermes/skills/curso-hermes/database-postgres-prisma
Command: npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill database-postgres-prisma-clfigueiredo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It guides developers through modeling databases, writing safe migrations, and fixing slow queries when working with PostgreSQL, MySQL, or Prisma, preventing common mistakes like missing indexes, N+1 queries, and destructive schema changes. ## Core Features & Use Cases - Schema Modeling: Define tables, stable primary keys, relationships, and constraints based on real use cases. - Safe Migrations: Follow an additive-first migration workflow with backup, backfill, and rollback planning. - Query Optimization: Diagnose slow queries, avoid N+1 patterns, and add indexes for frequent filters and joins. - Use Case: When a Prisma query on a paginated endpoint becomes slow, use this Skill to review the schema, add the right index, and rewrite the query to avoid N+1 loading. ## Quick Start Ask the assistant to review your Prisma schema and propose a safe migration with indexes for your slow query.

Frequently Asked Questions about database-postgres-prisma

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

FAQPage Schema
How do I write a safe database migration in PostgreSQL?▼

Write additive migrations first: validate a backup and restore, add new columns or tables, backfill data if needed, deploy compatible application code, and only remove old columns afterward. Always keep a rollback or recovery plan for destructive changes.

How do I fix N+1 queries in Prisma?▼

Fix N+1 queries by loading related records in a single query using Prisma's include or select clauses instead of querying per row. Identify the pattern by inspecting query logs, then batch the relationship fetch.

When should I add indexes to my database tables?▼

Add indexes for columns used in frequent filters, joins, and sorting. Verify the index helps by explaining and measuring the critical query before and after, since unnecessary indexes slow down writes.

Does this guidance work with MySQL as well as PostgreSQL?▼

Yes, the modeling rules, indexing guidance, transactions, and safe migration workflow apply to both PostgreSQL and MySQL, as well as to Prisma as the ORM layer on top of either database.

Why should I avoid concatenating user input into SQL queries?▼

Concatenating user input into SQL enables SQL injection attacks that can read or destroy data. Always use parameterized queries or the ORM's query builder so values are safely escaped by the driver.