Skip to main content
skill CX Codex

postgres-nio — Claude Code skill for PostgreSQL in Swift

A skill that gives the agent a working reference for talking to PostgreSQL from Swift with postgres-nio: connections, pooling, prepared statements and COPY FROM.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add wendylabsinc/claude-skills --skill postgres-nio -a claude-code
Open on GitHub

What postgres-nio does

The skill loads the agent with guidance on the postgres-nio library and how it is used in Swift. It covers creating a PostgresClient, running queries with async/await and turning result rows into tuples or your own types. Prepared statements through PostgresPreparedStatement get their own section, as do transactions inside withConnection and bulk inserts with copyFrom.

Connection setup is spelled out too: TLS modes .disable, .prefer and .require, pool limits, idle timeouts and Unix socket connections. On injection safety the skill shows that interpolated values become $1, $2, … bindings, while table and column names go through unescaped. That escape hatch is meant for trusted identifiers only — never for anything a user typed. A type mapping table between Swift and PostgreSQL is included, along with PSQLError handling by code such as .uniqueViolation.

A companion file, references/postgres-patterns.md, holds the deeper material the agent reaches for: wire protocol details and backpressure-aware row streaming. Installing the skill does not add anything to your project. For the sample code to compile, Package.swift still needs the postgres-nio package at version 1.21.0 or later.

What it helps with

  • turn a PostgreSQL query into parameter bindings instead of string concatenation
  • set up a connection pool with idle timeouts
  • define a prepared statement with a typed result row
  • bulk-load a large set of rows with COPY FROM
  • tell a unique violation apart from a foreign key error

Example prompts for the agent

  • Show me how to connect to PostgreSQL with PostgresClient and a connection pool
  • Rewrite this query as a PostgresPreparedStatement in Swift
  • How do I load an array of rows into the users table with copyFrom?

How to install postgres-nio

1Skills CLI (Vercel)

npx skills add wendylabsinc/claude-skills --skill postgres-nio -a claude-code

2Manually: put the files in place

~/.claude/skills/postgres-nio/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/postgres-nio/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about postgres-nio

How do I install postgres-nio in Claude Code?

Run npx skills add wendylabsinc/claude-skills --skill postgres-nio -a claude-code. The skill file lands at ~/.claude/skills/postgres-nio/SKILL.md.

What does postgres-nio do?

It supplies the agent with Swift examples for PostgreSQL via the postgres-nio library: connections, pooling, prepared statements, transactions and bulk loading.

Does my project still need the postgres-nio library?

Yes. The examples rely on the postgres-nio package at version 1.21.0 or later, which you add to Package.swift.

Similar skills

All skills for Data and databases →

From the same set7

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor