golemcloud/golem/golem-add-postgres-go
- community
Checking that the SKILL.md file is still in the repository.
Using PostgreSQL from a Go Golem agent via the golem/rdbms/postgres wrapper. Use when the user asks to connect to PostgreSQL, run SQL, scan rows, or execute a Postgres transaction in a Go Golem project.
Install
npx vskill@latest install golemcloud/golem/golem-add-postgres-goSKILL.md
Using PostgreSQL from a Go Agent
Overview
The Go SDK ships a durable Postgres client at github.com/golemcloud/golem/sdks/go/golem/rdbms/postgres. It wraps Golem's golem:rdbms host in a database/sql-flavoured API: open a connection with a URL, then run parametrised statements and scan the rows back positionally. Every query, execute, and commit is journaled and replayed, so the connection is durable across restarts.
There is no native driver and no raw socket — all traffic goes through the golem:rdbms host, so nothing needs wiring beyond importing the subpackage.
Steps
- Import
.../golem/rdbms/postgresin your agent'simplpackage. - Open a connection with
postgres.Open(addr)anddefer db.Close(). - Exec / Query with
$1, $2, …placeholders; pass plain Go values or typed constructors. - Scan rows with
row.Scan(&dst…)or the typed getters. - Transactions via
db.Transaction(func(tx *postgres.Tx) error { … }).
Prefer a config value or env var for the connection string over hardcoding it (see golem-add-config-go).
Definition (agents/notes/notes.go)
Implementation (agents/notes/impl/impl.go)
golem.Must unwraps (value, error) and panics on error, failing the invocation without retry; golem.Must0 does the same for an error-only return like Scan.
Parameters and Row Getters
Parameters are ordinary Go values — nil, bool, the sized int/float widths, string, []byte, golem.UUID, and time.Time map to their natural Postgres types:
When the exact column type matters (numeric, jsonb, a specific integer width, arrays, enums, composites), build the parameter with a constructor from the package — each returns a postgres.DbValue you pass like any other argument:
Read columns back positionally with the typed getters on postgres.Row — Int64, Float64, String, Bool, Bytes, UUID, Time, the recursive Array / Enum / Composite / Int4Range, the generic Get, or Scan. Each returns (value, error):
rs.Columns() returns the []postgres.Column metadata (Ordinal, Name, DbTypeName).
Transactions
db.Transaction runs a closure inside a transaction, committing if it returns nil and rolling back otherwise. The error is the closure's, joined with the rollback's when that fails too:
For manual control use db.Begin() then tx.Exec / tx.Query and tx.Commit() or tx.Rollback().
Returning Host Errors to the Caller
golem.Must* turns a returned host error into a panic, which traps the component and fails the invocation without retry. To let the caller observe a failure as a value instead, keep the fallible call's error and model the method output as golem.Result[Ok, Err]:
Key Constraints
- Target is WASM only: no native
pgx/lib/pqdriver, no raw sockets. All SQL goes through thegolem:rdbmshost — just import.../rdbms/postgres. - The connection is durable: every query/execute/commit is journaled and replayed. Because these are remote side effects, using the client inside a read-only method traps (see
golem-mark-read-only-go). - Placeholders are
$1, $2, …(Postgres style). MySQL uses?— seegolem-add-mysql-go. - Bare
intmaps toint8(bigint); usepostgres.Int4(...)when you need a 32-bit integer column. All getters and fallible calls return(value, error)— pair them withgolem.Must/golem.Must0. - An unsupported plain parameter type errors at encode time with a message telling you to wrap it in a
postgres.*constructor.
Related Skills
| Skill | When to Load | |
|---|---|---|
golem-add-agent-go | Create the agent that owns this Postgres client | |
golem-add-mysql-go | Use MySQL instead of (or alongside) Postgres | |
golem-add-config-go | Read the connection string from typed config | |
golem-add-transactions-go | Coordinate a saga across agents (distinct from a single DB transaction) | |
golem-mark-read-only-go | Understand why DB calls trap in read-only methods |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggolem-skills/skills/go/golem-add-postgres-go/SKILL.md
Popularity
- Repository stars
- 1,514
- Repository forks
- 210
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/golemcloud/golem/golem-add-postgres-go)