name: database-engineer
description: Design, model, and optimize relational databases using Neon Serverless PostgreSQL and SQLModel. Use for production-grade backend systems.
Database Engineering
Instructions
Schema Design
Identify core entities and responsibilities
Normalize tables (3NF by default)
Define primary keys, foreign keys, and constraints
Choose appropriate data types for PostgreSQL
Database Platform
Use Neon Serverless PostgreSQL
Design for stateless, serverless-friendly connections
Account for branching (dev/staging/prod)
Modeling with SQLModel
Define models using Python type hints
Separate domain models from persistence logic
Use explicit relationships and back_populates
Prepare models for migrations
Relationships & Integrity
One-to-One, One-to-Many, Many-to-Many
Enforce referential integrity with foreign keys
Use cascading rules intentionally (CASCADE / RESTRICT)
Query Optimization
Analyze query patterns early
Add indexes for:
Foreign keys
Frequently filtered columns
Sorting and lookup fields
Avoid N+1 query problems
Connections & Pooling
Use async-compatible drivers when needed
Configure connection pooling for serverless usage
Handle cold starts and connection reuse safely
Migrations
Generate migration scripts from model changes
Ensure migrations are:
Idempotent
Reversible
Environment-safe
Never edit production data manually
Best Practices
Treat schema changes as breaking API changes
Prefer explicit constraints over application-only validation
Always index foreign keys
Keep migrations small and incremental
Test migrations on a Neon branch before production
Use transactions for all write operations
Document schema decisions clearly
Example Structure
SQLModel Models
from typing import Optional, List
from sqlmodel import SQLModel, Field, Relationship
class User(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
email: str = Field(index=True, unique=True)
posts: List["Post"] = Relationship(back_populates="author")
class Post(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
title: str
content: str
author_id: int = Field(foreign_key="user.id", index=True)
author: Optional[User] = Relationship(back_populates="posts")
---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/muhammadyasir678) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-14 -->
1---2name: muhammadyasir678-the-evolution-of-todo-app-database-engineer3description: ---4---5---6name: database-engineer7description: Design, model, and optimize relational databases using Neon Serverless PostgreSQL and SQLModel. Use for production-grade backend systems.8---910# Database Engineering1112## Instructions13141. **Schema Design**15 - Identify core entities and responsibilities16 - Normalize tables (3NF by default)17 - Define primary keys, foreign keys, and constraints18 - Choose appropriate data types for PostgreSQL19202. **Database Platform**21 - Use **Neon Serverless PostgreSQL**22 - Design for stateless, serverless-friendly connections23 - Account for branching (dev/staging/prod)24253. **Modeling with SQLModel**26 - Define models using Python type hints27 - Separate domain models from persistence logic28 - Use explicit relationships and back_populates29 - Prepare models for migrations30314. **Relationships & Integrity**32 - One-to-One, One-to-Many, Many-to-Many33 - Enforce referential integrity with foreign keys34 - Use cascading rules intentionally (CASCADE / RESTRICT)35365. **Query Optimization**37 - Analyze query patterns early38 - Add indexes for:39 - Foreign keys40 - Frequently filtered columns41 - Sorting and lookup fields42 - Avoid N+1 query problems43446. **Connections & Pooling**45 - Use async-compatible drivers when needed46 - Configure connection pooling for serverless usage47 - Handle cold starts and connection reuse safely48497. **Migrations**50 - Generate migration scripts from model changes51 - Ensure migrations are:52 - Idempotent53 - Reversible54 - Environment-safe55 - Never edit production data manually5657---5859## Best Practices6061- Treat schema changes as breaking API changes62- Prefer explicit constraints over application-only validation63- Always index foreign keys64- Keep migrations small and incremental65- Test migrations on a Neon branch before production66- Use transactions for all write operations67- Document schema decisions clearly6869---7071## Example Structure7273### SQLModel Models74```python75from typing import Optional, List76from sqlmodel import SQLModel, Field, Relationship777879class User(SQLModel, table=True):80 id: Optional[int] = Field(default=None, primary_key=True)81 email: str = Field(index=True, unique=True)8283 posts: List["Post"] = Relationship(back_populates="author")848586class Post(SQLModel, table=True):87 id: Optional[int] = Field(default=None, primary_key=True)88 title: str89 content: str9091 author_id: int = Field(foreign_key="user.id", index=True)92 author: Optional[User] = Relationship(back_populates="posts")9394---95> Converted and distributed by [TomeVault](https://tomevault.io/claim/muhammadyasir678) — claim your Tome and manage your conversions.96<!-- tomevault:4.0:skill_md:2026-04-14 -->
Run npx skillmds@latest add tomevault-io/muhammadyasir678-the-evolution-of-todo-app-database-engineer in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
--- It is listed under Productivity on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.