neo4j-driver-go-skill

Implements Go applications using the Neo4j Go Driver v6 with transactions, error handling, and type mapping.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/eklyukin/my-ai-config --skill neo4j-driver-go-skill-eklyukin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: neo4j-driver-go-skill
Source: https://github.com/eklyukin/my-ai-config/tree/main/skills/neo4j-driver-go-skill
Command: npx skills add https://github.com/eklyukin/my-ai-config --skill neo4j-driver-go-skill-eklyukin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/neo4j/neo4j-go-driver/v6, and includes references (resource) components.

What problem does it solve? Writing correct Go code against Neo4j requires choosing between ExecuteQuery, managed transactions, and explicit transactions, handling driver lifecycle, and avoiding common pitfalls like unsafe type assertions, missing database names, and leaked sessions. This Skill provides v6-accurate patterns and checklists so generated code follows driver best practices. ## Core Features & Use Cases - API Selection Guidance: Decision table for choosing between neo4j.ExecuteQuery, session.ExecuteRead/Write, session.BeginTransaction, and session.Run based on retry, streaming, and coordination needs. - Production Patterns: Driver lifecycle with VerifyConnectivity, context timeouts, UNWIND batch writes, causal consistency with bookmarks, and typed record extraction via GetRecordValue[T] generics. - Error Handling & Troubleshooting: Neo4jError/ConnectivityError inspection with errors.As, plus a table of common failures (pool exhaustion, panics on type assertion, CALL IN TRANSACTIONS inside managed transactions) and their fixes. - Use Case: You are building a Go service that reads and writes a Neo4j Aura instance. Use this Skill to generate the driver setup, a repository wrapper with parameterized queries, and batched MERGE writes that survive transient cluster errors. ## Quick Start Ask the AI to write a Go function that connects to Neo4j using the v6 driver, runs a parameterized read query with ExecuteQuery, and handles errors with proper type-safe record extraction.

Frequently Asked Questions about neo4j-driver-go-skill

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

FAQPage Schema
How do I connect to Neo4j from Go using the official driver?▼

Install github.com/neo4j/neo4j-go-driver/v6, create one driver at startup with neo4j.NewDriver and neo4j.BasicAuth, then call driver.VerifyConnectivity. Share the single driver across goroutines and defer driver.Close at shutdown.

When should I use ExecuteQuery vs managed transactions in the Neo4j Go driver?▼

Use neo4j.ExecuteQuery as the default for most queries since it handles sessions, retries, and bookmarks automatically. Use session.ExecuteRead/ExecuteWrite when you need lazy streaming of large result sets, and explicit BeginTransaction only when work spans multiple functions.

Does the Neo4j Go driver v6 still support v5 function names?▼

Yes, v5 aliases like neo4j.NewDriverWithContext and neo4j.DriverWithContext still compile in v6 but are deprecated. Migrate to neo4j.NewDriver and neo4j.Driver before upgrading to v7, where the aliases will be removed.

Why does my Go code panic when reading Neo4j query results?▼

Panics happen when type-asserting a value from record.Get without checking the ok boolean, or when a key is missing. Use the generic neo4j.GetRecordValue[T](record, key) helper, which returns an error for absent keys or wrong types instead of panicking.

Why does CALL IN TRANSACTIONS fail inside a Neo4j managed transaction?▼

CALL { ... } IN TRANSACTIONS and USING PERIODIC COMMIT manage their own transactions, so they cannot run inside a managed transaction callback. Execute them with session.Run, which uses auto-commit mode.

How do I batch insert records into Neo4j from Go efficiently?▼

Avoid one transaction per record. Pass the full slice as a parameter and use a single UNWIND $items query inside one ExecuteQuery call, which performs the batch write in a single transaction.