neo4j-driver-javascript-skill

Integrate the Neo4j JavaScript driver for Cypher execution and type handling.

101|35|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/neo4j-contrib/neo4j-skills --skill neo4j-driver-javascript-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: neo4j-driver-javascript-skill
Source: https://github.com/neo4j-contrib/neo4j-skills/tree/main/neo4j-driver-javascript-skill
Command: npx skills add https://github.com/neo4j-contrib/neo4j-skills --skill neo4j-driver-javascript-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the challenge of reliably wiring the official Neo4j JavaScript/TypeScript driver into a Node.js or browser app, including correct query execution patterns, safe transaction handling, and the tricky conversion of Neo4j types like Integer for JSON and APIs.

Core Features & Use Cases

  • Driver lifecycle and connection setup: Create a single shared driver, choose the right URI scheme (including Aura vs local), and verify connectivity on startup.
  • Safe query execution APIs: Use executeQuery for most cases, executeRead/executeWrite for managed transactions with auto-retry, and session.run for implicit transaction scenarios like LOAD CSV.
  • Correct result consumption and data handling: Access records via record.get, consume streams inside transaction callbacks, and avoid common pitfalls with JSON serialization of Integer and temporal types.
  • TypeScript support and errors: Apply key TypeScript types (Driver, Session, ManagedTransaction, Node<Integer>) and handle Neo4jError codes like SERVICE_UNAVAILABLE and constraint validation failures.
  • Batch operations: Perform efficient batch writes using UNWIND with proper parameter handling for integers.

Quick Start

Use the neo4j-driver-javascript-skill to write a minimal JS/TS example that connects to Neo4j with executeQuery, retrieves record values with record.get, and safely converts Neo4j Integers for JSON output.

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 use the Neo4j JavaScript driver to execute queries and handle records safely?

Use the Neo4j JavaScript driver's executeQuery API for standard query execution, retrieve values with record.get, and consume streams inside transaction callbacks to ensure safe result handling. For retry logic, use managed transactions like executeRead and executeWrite.

What's the best way to handle Neo4j Integer serialization in JavaScript and TypeScript?

To handle Neo4j Integer serialization correctly, convert Integer and temporal types before passing them to JSON.stringify or APIs, as native JavaScript numbers lose precision with large Neo4j integers. Use proper TypeScript types like Node<Integer> to enforce safe conversions.

Does the Neo4j JavaScript driver support both Node.js and browser environments?

Yes, the Neo4j JavaScript driver supports both Node.js and browser environments. You must select the correct URI scheme for your target, such as Neo4j Aura versus local deployment, and verify connectivity on startup using a single shared driver instance.

How do I perform batch write operations with UNWIND in Neo4j using JavaScript?

Perform efficient batch writes in Neo4j by passing an array of parameters to a Cypher UNWIND statement via the JavaScript driver. Ensure proper parameter handling, especially for integers, and execute the batch within executeWrite or session.run for implicit transactions.

Why does my Neo4j async/await session throw SERVICE_UNAVAILABLE in TypeScript?

A Neo4j session throws SERVICE_UNAVAILABLE or similar Neo4jError codes when connections fail or constraints are violated. Ensure you use safe async/await patterns, maintain a single driver instance, and reliably close sessions to prevent connection pool exhaustion.

When should I use executeRead versus session.run for Neo4j managed transactions?

Use executeRead or executeWrite for managed transactions requiring automatic retries and error handling. Use session.run for implicit transaction scenarios like LOAD CSV, where you need direct control over the transaction lifecycle and manual result consumption.