AiderTypeScriptDatabase
Prisma ORM Rules for Aider
Rules for using Prisma ORM effectively in TypeScript projects.
CONVENTIONS.md
# Prisma ORM Rules for Aider
# Prisma ORM Rules
## Schema Conventions
```prisma
model User {
id String @id @default(cuid())
email String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Relations
posts Post[]
profile Profile? // Optional one-to-one
@@index([email]) // Index on frequently queried fields
@@map("users") // Explicit table name — snake_case
}
```
## Client Singleton Pattern
```typescript
// lib/prisma.ts — prevents connection pool exhaustion in dev
declare global { var prisma: PrismaClient | undefined }
export const prisma = global.prisma ?? new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['query', 'error'] : ['error'],
});
if (process.env.NODE_ENV !== 'production') global.prisma = prisma;
```
## Query Patterns
```typescript
// Select only needed fields — never select * implicitly
const user = await prisma.user.findUnique({
where: { id },
select: { id: true, email: true, name: true }, // Not the whole object
});
// Avoid N+1 — use include or separate queries with inHow to use with Aider
Create a `CONVENTIONS.md` file in your project root. Aider reads this and respects your conventions when generating changes.
#aider#typescript#prisma#ai-coding-rules
Related Rules
TypeScript Cursor Rules
CursorTypeScript
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
Code Style
typescript · strictCopy Ready
TypeScript Windsurf Rules
WindsurfTypeScript
Windsurf rules for TypeScript: strict type safety, functional patterns, and modern TypeScript conventions.
Code Style
typescript · windsurfCopy Ready
TypeScript GitHub Copilot Instructions
GitHub CopilotTypeScript
GitHub Copilot custom instructions for TypeScript: strict types, modern patterns, and team conventions.
Code Style
typescript · copilotCopy Ready
Python Aider Conventions
AiderPython
Aider AI coding conventions for Python: CONVENTIONS.md patterns for automated refactoring and clean Python code.
Code Style
python · aiderCopy Ready