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.
npx skills add wendylabsinc/claude-skills --skill postgres-nio -a claude-codeWhat 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
PostgresClientand a connection pool - Rewrite this query as a
PostgresPreparedStatementin Swift - How do I load an array of rows into the
userstable withcopyFrom?
How to install postgres-nio
1Skills CLI (Vercel)
npx skills add wendylabsinc/claude-skills --skill postgres-nio -a claude-code2Manually: put the files in place
~/.claude/skills/postgres-nio/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/postgres-nio/
1Skills CLI (Vercel)
npx skills add wendylabsinc/claude-skills --skill postgres-nio -a codex2Manually: put the files in place
.agents/skills/postgres-nio/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wendylabsinc/claude-skills --skill postgres-nio -a cursor2Manually: put the files in place
.cursor/skills/postgres-nio/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wendylabsinc/claude-skills postgres-nio2Manually: put the files in place
.github/skills/postgres-nio/SKILL.md1Skills CLI (Vercel)
npx skills add wendylabsinc/claude-skills --skill postgres-nio -a gemini-cli2Platform CLI
gemini skills install https://github.com/wendylabsinc/claude-skills --path postgres-nioManually: put the files in place
.devin/skills/postgres-nio/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wendylabsinc/claude-skills --skill postgres-nio -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.