neo4j-driver-javascript-skill

Implements Neo4j connectivity in JavaScript and TypeScript using the official driver v6 API.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires neo4j-driver, and includes references (resource) components.

What problem does it solve? Writing correct Neo4j client code in JavaScript or TypeScript involves many subtle pitfalls: Integer serialization breaking JSON responses, sessions leaking when not closed in finally blocks, records accessed with dot notation returning undefined, and transaction callbacks returning unconsumed streams. This Skill provides verified patterns for the official neo4j-driver v6 so generated code avoids these common production bugs. ## Core Features & Use Cases - Driver Lifecycle & API Selection: Covers singleton driver setup, URI schemes (neo4j+s://, bolt://), auth methods, and choosing between executeQuery, executeRead/executeWrite managed transactions, and session.run. - Type & Serialization Handling: Explains Integer handling modes (neo4j.int, disableLosslessIntegers, useBigInt), temporal and spatial types, record access via .get(), and JSON serialization pitfalls with a toNative() conversion helper. - Error Handling & TypeScript: Documents Neo4jError codes, retriable errors, session close patterns, and typed annotations (Driver, Session, ManagedTransaction, Node<Integer>). - Use Case: You are building a Node.js Express API backed by Neo4j Aura. Use this Skill to generate a singleton driver module, parameterized queries with batch UNWIND writes, and JSON-safe result serialization. ## Quick Start Use the neo4j-driver-javascript-skill to write a TypeScript module that connects to Neo4j Aura, runs a parameterized read query with executeRead, and returns JSON-safe results.

Frequently Asked Questions about neo4j-driver-javascript-skill

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

FAQPage Schema
How do I connect to Neo4j from Node.js with the JavaScript driver?▼

Install neo4j-driver, then create one driver instance at startup with neo4j.driver(URI, neo4j.auth.basic(user, password)) and call await driver.verifyConnectivity(). Share that single instance across the app and close it with await driver.close() on shutdown.

What is the difference between executeQuery, executeRead, and session.run in neo4j-driver?▼

executeQuery is the default API returning eager results with auto-retry. executeRead and executeWrite are managed transactions with auto-retry that stream results lazily. session.run creates implicit transactions without retry, suited for LOAD CSV or CALL IN TRANSACTIONS scripts.

Why does JSON.stringify return {"low":42,"high":0} for Neo4j integers?▼

Neo4j integers are 64-bit and the driver returns a custom Integer class by default, which serializes as its internal low/high structure. Call .toNumber() or .toString() before serializing, or set disableLosslessIntegers: true when values stay within Number.MAX_SAFE_INTEGER.

Does the Neo4j JavaScript driver work in the browser?▼

Yes, neo4j-driver works in browsers bundled with webpack, Vite, or Rollup, but it connects over WebSockets. Use neo4j+s:// (WSS) or neo4j:// (WS) URIs instead of bolt://, and never embed production credentials in client-side code.

Why does my Neo4j transaction callback return empty records?▼

await tx.run() returns a stream handle, not records, and the stream is consumed when the callback returns. Collect results inside the callback with await result.collect() or iterate with for-await, then return plain mapped data.

When should I not use this Neo4j driver skill?▼

This skill does not cover Cypher query authoring, which belongs to the neo4j-cypher skill, nor driver version migration, which belongs to neo4j-migration-skill. It targets neo4j-driver v6 on Node.js 18 or newer.