neo4j-driver-java-skill

Write Java and Kotlin code using the Neo4j Java Driver v6 API.

Updated Aug 25, 2026
One-click install
npx skills add https://github.com/cardox6/steuer-graph --skill neo4j-driver-java-skill-cardox6
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: neo4j-driver-java-skill
Source: https://github.com/cardox6/steuer-graph/tree/main/.agents/skills/neo4j-driver-java-skill
Command: npx skills add https://github.com/cardox6/steuer-graph --skill neo4j-driver-java-skill-cardox6

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct Neo4j client code in Java or Kotlin requires navigating driver lifecycle rules, transaction APIs, result consumption semantics, and error handling pitfalls that commonly cause bugs like ResultConsumedException, session leaks, and lost commits. ## Core Features & Use Cases - Driver Setup & Lifecycle: Maven/Gradle dependency configuration, single-driver-per-application pattern, URI scheme selection, and verifyConnectivity fail-fast checks. - Transaction APIs: Guidance on choosing between executableQuery, executeRead/executeWrite managed transactions, explicit transactions, async CompletableFuture, and reactive RxSession patterns. - Error Handling & Safety: Rules for consuming Result inside callbacks, null-safe value extraction, commit uncertainty, rollback safety, and UNWIND batch write parameter constraints. - Use Case: A developer building a Spring Boot service backed by Neo4j Aura uses this Skill to set up the driver, implement retry-safe writes with MERGE, and avoid returning un-consumed Result objects from transaction callbacks. ## Quick Start Ask the assistant to write a Java method that connects to Neo4j Aura and runs a parameterized read query using executableQuery with the database name specified.

Frequently Asked Questions about neo4j-driver-java-skill

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

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

Add the org.neo4j.driver:neo4j-java-driver dependency via Maven or Gradle, then create one Driver instance with GraphDatabase.driver(uri, AuthTokens.basic(user, password)) and call verifyConnectivity(). Use neo4j+s:// URIs for Aura and share the single driver across the application.

What is the difference between executableQuery and executeRead in the Neo4j Java driver?▼

executableQuery is the recommended default: it eagerly returns records, auto-retries, and handles bookmarks automatically. executeRead/executeWrite are managed transactions giving callback control and streaming for large results, but the Result must be fully consumed inside the callback.

Why does my Neo4j Java code throw ResultConsumedException?▼

ResultConsumedException occurs when a Result cursor is read after its managed transaction callback has returned, because the transaction closes and invalidates the cursor. Fix it by collecting records into a List or Map inside the callback before returning.

Does the Neo4j Java driver support async and reactive programming?▼

Yes. driver.asyncSession() returns CompletionStage-based APIs for CompletableFuture workflows, and driver.rxSession() integrates with Project Reactor or RxJava for backpressure-aware streaming. Sessions must be closed in both success and error paths, using exceptionallyCompose for async cleanup.

How do I batch insert data into Neo4j from Java?▼

Use a single UNWIND query with a List<Map<String,Object>> parameter, for example UNWIND $items AS item MERGE (p:Person {name: item.name}). Parameter maps may only contain plain Java types like String, Long, Double, Boolean, List, and Map; custom objects must be converted first.

When should I not use this Neo4j Java driver guidance?▼

This guidance does not cover Cypher query authoring, driver version migrations, or Spring Data Neo4j annotations like @Node and Neo4jRepository. Those concerns belong to dedicated Cypher, migration, or Spring Data skills respectively.