cornucopia-rs-usage

Generate type-safe PostgreSQL query interfaces in Rust with Cornucopia.

Updated Jan 6, 2026
One-click install
npx skills add https://github.com/eboody/eran.codes --skill cornucopia-rs-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cornucopia-rs-usage
Source: https://github.com/eboody/eran.codes/tree/main/.codex/skills/cornucopia-rs-usage
Command: npx skills add https://github.com/eboody/eran.codes --skill cornucopia-rs-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the complexity of writing and maintaining type-safe database queries in Rust applications interacting with PostgreSQL, ensuring code generation aligns with SQL schema and reducing runtime errors.

Core Features & Use Cases

  • SQL Query Annotation: Define queries with named parameters and type annotations directly in .sql files.
  • Code Generation: Automatically generate Rust modules for type-safe query execution.
  • Workflow Management: Supports schema (ephemeral DB), live (existing DB), and build.rs integration for generation.
  • Use Case: When developing a Rust web service that heavily relies on PostgreSQL, use this Skill to generate Rust code from your SQL queries, ensuring that parameter binding and result mapping are type-checked at compile time.

Quick Start

Use the cornucopia-rs-usage skill to set up Cornucopia for a new Rust project by following the installation and dependency setup guide.

Frequently Asked Questions about cornucopia-rs-usage

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

FAQPage Schema
How do I generate type-safe PostgreSQL queries in Rust?

To generate type-safe PostgreSQL queries in Rust, you write SQL queries with named parameters and type annotations in .sql files, then use Cornucopia to automatically generate Rust modules for compile-time checked query execution.

What is the best way to set up Rust PostgreSQL code generation workflows?

The best way to set up Rust PostgreSQL code generation is choosing between schema workflows using an ephemeral database, live workflows querying an existing database, or build.rs integration for automated generation during compilation.

Can I use Cornucopia for both sync and async database operations in Rust?

Yes, you can use Cornucopia for sync and async database operations in Rust by managing specific dependencies for each mode, ensuring runtime query execution patterns align with your chosen concurrency model.

Why does my Rust PostgreSQL code generation fail with connection errors?

Rust PostgreSQL code generation connection errors often stem from database connection compatibility issues or incorrect workflow setup; this Skill addresses common codegen errors and guides resolving connection compatibility.

Do I need an existing PostgreSQL database to generate Rust query interfaces?

You do not need an existing PostgreSQL database to generate Rust query interfaces because the schema workflow supports generating code using an ephemeral database, alongside the live workflow for existing databases.