effect-sql

Provide type-safe SQL database access in Effect TypeScript.

22|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-sql-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-sql
Source: https://github.com/mpsuesser/pi-effect-harness/tree/main/harnesses/effect/skills/effect-sql
Command: npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-sql-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

effect-sql eliminates error-prone, weakly typed database access by providing schema-validated, type-safe SQL interactions in Effect TypeScript.

Core Features & Use Cases

  • SqlClient tagged-template queries: Build parameterized, dialect-aware statements safely using SqlClient.
  • SqlSchema request/result validation: Decode results and validate inputs and outputs using Schema for predictable runtime types.
  • SqlModel CRUD repositories and resolvers: Generate type-safe CRUD operations from Model schemas, including batched data loading to avoid N+1 queries.
  • Migrator for structured migrations: Run sequential, transactional schema migrations with a migrations tracking table.

Quick Start

Use the effect-sql skill to help you implement migrations and then create a SqlModel-based repository with SqlSchema-validated queries for a Postgres-backed app.

Frequently Asked Questions about effect-sql

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

FAQPage Schema
How do I build type-safe SQL queries in Effect TypeScript?

You build type-safe SQL queries by using tagged-template SqlClient statements paired with SqlSchema validation to ensure runtime correctness of encoded and decoded request and result types.

How do I prevent N+1 queries when using SQL repositories in Effect?

You prevent N+1 queries in Effect by using SqlResolver to enable batched request resolution, allowing multiple database requests to be executed and validated efficiently in batches.

How do I run sequential and transactional database migrations with Effect?

Database migrations in Effect are run using the Migrator module, which executes ordered, transactional schema migrations while maintaining a dedicated tracking table for applied migrations.

Can I generate CRUD operations automatically from schema definitions in Effect?

Yes, you can generate type-safe CRUD operations from Model schemas using SqlModel, which produces repositories that automatically validate inputs and outputs using SqlSchema definitions.

What do I need to set up before implementing schema-validated SQL access in Effect?

Before implementing schema-validated SQL access in Effect, you need a local cache of Effect v4 unstable SQL modules including SqlClient, SqlSchema, SqlModel, SqlResolver, and Migrator available.

Does Effect SQL validate both request inputs and result outputs?

Yes, Effect SQL validates both request inputs and result outputs using SqlSchema, ensuring that encoded data sent to the database and decoded data returned from queries match expected runtime types.