> Prisma Advanced Patterns
Prisma transactions, raw queries, middleware, and performance optimization.
fetch
$
curl "https://skillshub.wtf/skillshub-team/catalog-batch5/prisma-advanced?format=md"SKILL.md•Prisma Advanced Patterns
Prisma Advanced
Transactions
const [user, post] = await prisma.$transaction([
prisma.user.create({ data: { email } }),
prisma.post.create({ data: { title, authorId: userId } }),
]);
// Interactive transaction
await prisma.$transaction(async (tx) => {
const user = await tx.user.findUnique({ where: { id } });
if (user.balance < amount) throw new Error('Insufficient balance');
await tx.user.update({ where: { id }, data: { balance: { decrement: amount } } });
});
Raw SQL
const result = await prisma.$queryRaw`SELECT * FROM users WHERE age > ${minAge}`;
Middleware
prisma.$use(async (params, next) => {
if (params.action === 'delete') { params.action = 'update'; params.args.data = { deleted: true }; }
return next(params);
});
Performance: select only needed fields, use cursor-based pagination, connection pooling
> related_skills --same-repo
> Nix Dev Shells with direnv
Auto-activate reproducible dev environments with Nix flakes and direnv.
> Dagger with GitHub Actions
Run Dagger CI/CD pipelines in GitHub Actions for portable, testable builds.
> Bun + Hono API
Build fast APIs with Bun runtime and Hono framework.
> Deno Fresh Framework
Build full-stack web apps with Fresh on Deno. Islands, routes, and zero runtime overhead.
┌ stats
installs/wk0
░░░░░░░░░░first seenMar 18, 2026
└────────────