/neo4j-skills:neo4j-import-skillfrom neo4j-skills
Imports structured data (CSV, JSON, Parquet) into Neo4j using LOAD CSV, CALL IN TRANSACTIONS, neo4j-admin bulk import, apoc.load, and driver batch writes. Covers method selection, header format, type coercion, null handling, and post-import validation.
Ships in neo4j-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
neo4j-document-import-skillneo4j-cypher-skillneo4j-cli-tools-skillneo4j-gds-skill| Dataset size | DB state | Source | Method |
|---|---|---|---|
| Any size | Online | CSV (Aura or local) | LOAD CSV + CALL IN TRANSACTIONS |
| < 1M rows | Online | List/API response | UNWIND + CALL IN TRANSACTIONS |
| > 10M rows | Offline (local/self-managed) | CSV / Parquet | neo4j-admin database import full |
| Any size | Online | APOC available | apoc.periodic.iterate (+ apoc.load.csv — APOC Extended only) |
| Any size | Online | JSON/API | apoc.load.json or driver batching |
| Incremental delta | Offline (Enterprise) | CSV | neo4j-admin database import incremental |
Aura: only https:// URLs — no file:///. Use neo4j-admin import only on self-managed.
Run in this exact order — skipping causes hard-to-debug duplicates or missed index usage:
Constraints BEFORE import. Additional indexes AFTER import.
populationPercent until 100%Create uniqueness constraints (enables index used by MERGE):
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Person) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Movie) REQUIRE n.movieId IS UNIQUE;
Neo4j 2026.06+ (Enterprise/Aura, GA):
ALTER CURRENT GRAPH TYPE SET { … }replaces all individual constraint statements with a single declarative block. Seeneo4j-cypher-skill/references/graph-type.md. Use individualCREATE CONSTRAINTon Community Edition or pre-2026.02.
Verify APOC if using apoc. procedures*:
RETURN apoc.version();
If fails → APOC not installed. Use plain LOAD CSV instead.
Confirm target accepts writes (not a secondary/replica):
SHOW DATABASE neo4j YIELD name, role, writer, currentStatus;
writer = true on standalone servers and on the cluster's writer. If no row has writer = true → stop; redirect the write to the writer endpoint (neo4j:// routing URI). Don't use dbms.cluster.role() — fails with "no such procedure" on 2026.x standalone.
Count source file rows before import (catch encoding issues early):
wc -l data/persons.csv # Linux/macOS
Verify UTF-8 encoding — LOAD CSV requires UTF-8. Re-encode if needed:
file -i persons.csv # Check encoding
iconv -f latin1 -t utf-8 persons.csv > persons_utf8.csv
CYPHER 25
LOAD CSV WITH HEADERS FROM 'file:///persons.csv' AS row
CALL (row) {
MERGE (p:Person {id: row.id})
ON CREATE SET
p.name = row.name,
p.age = toIntegerOrNull(row.age),
p.score = toFloatOrNull(row.score),
p.active = toBoolean(row.active),
p.born = CASE WHEN row.born IS NOT NULL AND row.born <> '' THEN date(row.born) ELSE null END,
p.createdAt = datetime()
ON MATCH SET
p.updatedAt = datetime()
} IN TRANSACTIONS OF 10000 ROWS
ON ERROR CONTINUE
REPORT STATUS AS s
RETURN s.transactionId, s.committed, s.errorMessage
Null/empty-string rules:
null (safe)"" → stored as "" not null — use nullIf(row.x, '') to converttoInteger(null) throws → always use toIntegerOrNull()toFloat(null) throws → always use toFloatOrNull()null properties — they are silently dropped on SETCYPHER 25
LOAD CSV WITH HEADERS FROM 'file:///knows.csv' AS row
CALL (row) {
MATCH (a:Person {id: row.fromId})
MATCH (b:Person {id: row.toId})
MERGE (a)-[:KNOWS {since: toIntegerOrNull(row.year)}]->(b)
} IN TRANSACTIONS OF 5000 ROWS
ON ERROR CONTINUE
REPORT STATUS AS s
RETURN s.committed, s.errorMessage
REPORT STATUS makes the CALL return rows → query must end with RETURN (or FINISH), else syntax error "incomplete query".
Always import ALL nodes before ANY relationships — MATCH fails on missing nodes.
CYPHER 25
LOAD CSV WITH HEADERS FROM 'file:///data.tsv' AS row FIELDTERMINATOR '\t'
CALL (row) { MERGE (p:Person {id: row.id}) }
IN TRANSACTIONS OF 10000 ROWS ON ERROR CONTINUE
LOAD CSV WITH HEADERS FROM 'file:///archive.csv.gz' AS row ...
| Scheme | Example |
|---|---|
| AWS S3 | s3://my-bucket/data/persons.csv |
| Google Cloud Storage | gs://my-bucket/persons.csv |
| Azure Blob | azb://account/container/persons.csv |
linenumber() // current line number — use as fallback ID
file() // absolute path of file being loaded
CALL (row) {
// write logic
} IN [n CONCURRENT] TRANSACTIONS
[OF batchSize ROW[S]]
[ON ERROR {CONTINUE | BREAK | FAIL | RETRY [FOR duration SECONDS] [THEN {CONTINUE|BREAK|FAIL}]}]
[REPORT STATUS AS statusVar]
| Mode | Behavior | Use when |
|---|---|---|
ON ERROR FAIL | Default. Stops the query on first error; failed batch rolls back, earlier batches stay committed | Fail-fast import. Not all-or-nothing — for that use one batch (OF <n> ROWS above row count) or a single transaction |
ON ERROR CONTINUE | Skips failed batch, continues remaining batches | Resilient bulk load — track errors via REPORT STATUS |
ON ERROR BREAK | Stops after first failed batch; keeps completed work | Semi-strict: stop early, keep successful batches |
ON ERROR RETRY | Exponential backoff retry (default 30s) + fallback | Concurrent writes with deadlock risk |
ON ERROR CONTINUE/BREAK → outer transaction succeeds even if inner batches fail.
ON ERROR FAIL → cannot be combined with REPORT STATUS AS.
CYPHER 25
LOAD CSV WITH HEADERS FROM 'file:///large.csv' AS row
CALL (row) {
MERGE (p:Person {id: row.id}) SET p.name = row.name
} IN 4 CONCURRENT TRANSACTIONS OF 5000 ROWS
ON ERROR RETRY FOR 30 SECONDS THEN CONTINUE
REPORT STATUS AS s
RETURN s.committed, s.errorMessage
Use CONCURRENT for read-heavy MERGE on non-overlapping key spaces. Risk: deadlocks on overlapping writes → combine with ON ERROR RETRY.
| Column | Type | Meaning |
|---|---|---|
s.started | BOOLEAN | Batch transaction started |
s.committed | BOOLEAN | Batch committed successfully |
s.transactionId | STRING | Transaction ID |
s.errorMessage | STRING or null | Error detail if batch failed |
| Row count | Recommended batch size | Notes |
|---|---|---|
| < 100k | 10 000 | Default is fine |
| 100k – 1M | 10 000 – 50 000 | Monitor heap; increase if fast |
| 1M – 10M | 50 000 – 100 000 | Enable CONCURRENT if CPUs available |
| > 10M online | 50 000 | Consider neo4j-admin import instead |
| Relationship import | 5 000 | Lower — each batch does 2x MATCH |
Fastest method: ~3 min for 31M nodes / 78M rels on SSD. DB must be stopped or non-existent.
neo4j-admin database import full \
--nodes=Person="./persons_header.csv,./persons.csv" \
--nodes=Movie="./movies_header.csv,./movies.csv" \
--relationships=ACTED_IN="./acted_in_header.csv,./acted_in.csv" \
--relationships=DIRECTED="./directed_header.csv,./directed.csv" \
--delimiter=, \
--id-type=STRING \
--bad-tolerance=0 \
--threads=$(nproc) \
--high-parallel-io=on \
neo4j
File paths need a directory part (./file.csv, import/file.csv or absolute) — bare names fail: "Unable to find the parent of the path". Database name goes last, after a single-value flag (as above) — placed right after --nodes=/--relationships= it is parsed as one more file.
Dry run (2026.02+) — validate without writing:
neo4j-admin database import full --dry-run ...
# persons_header.csv
personId:ID(Person),name,born:int,score:float,active:boolean,:LABEL
# persons.csv (data file — no header row)
p001,Alice,1985,9.2,true,Person
p002,Bob,1990,7.1,false,Person
| Field | Meaning |
|---|---|
:ID | Unique ID for relationship wiring (not stored as property by default) |
:ID(Group) | Scoped ID space — use when node types share IDs |
:LABEL | One or more labels; semicolon-separated: Person;Employee |
prop:int | Typed property; types: int long float double boolean byte short string |
prop:date | Temporal: date localtime time localdatetime datetime duration; Parquet INTERVAL columns import as DURATION [2026.07+] |
prop:int[] | Array — semicolon-separated values in cell: 1;2;3 |
"prop:vector{coordinateType:float,dimensions:3}" | Vector (2025.10+) — map must give coordinateType (byte short int long float double) and dimensions (1-4096); quote the header field (contains ,). Coordinates semicolon-separated in CSV; imports directly from native Parquet list types [2026.06+]. Storing VECTOR needs block format (Enterprise); Community fails |
# acted_in_header.csv
:START_ID(Person),:END_ID(Movie),role,:TYPE
# acted_in.csv
p001,tt0133093,Neo,ACTED_IN
p002,tt0133093,Morpheus,ACTED_IN
:START_ID / :END_ID must reference the same :ID group as the node files.
| Flag | Default | Notes |
|---|---|---|
--delimiter | , | Single-byte UTF-8 char, TAB, \ID, or U+XXXX; newline chars rejected [2026.07+] |
--vector-delimiter | ; | Separates prop:vector coordinates; must differ from --delimiter and --quote [enforced 2026.06+] |
--id-type | STRING | STRING | INTEGER | ACTUAL |
--bad-tolerance | -1 (unlimited, changed 2025.12) | Set 0 for strict prod imports |
--threads | CPU count | Set explicitly on shared hosts |
--max-off-heap-memory | 90% RAM | Reduce if other services share host |
--high-parallel-io | off | Set on for SSD/NVMe |
--format | standard | block for >34B nodes/rels |
--overwrite-destination | false | Required if DB already exists |
--dry-run | false | 2026.02+ — validate without writing |
Pass a Cypher file with CREATE CONSTRAINT / CREATE INDEX statements; executed automatically after import completes. Constraints are created first (correct order enforced). File paths can be local or remote (s3://, gs://, https://).
neo4j-admin database import full \
--nodes=Person="./persons_header.csv,./persons.csv" \
--format=block \
--schema=./schema.cypher \
neo4j
Community rejects --schema ("Record format batch import does not support schema changes").
// schema.cypher
CREATE CONSTRAINT person_id IF NOT EXISTS FOR (n:Person) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT movie_id IF NOT EXISTS FOR (n:Movie) REQUIRE n.id IS UNIQUE;
CREATE RANGE INDEX person_email IF NOT EXISTS FOR (n:Person) ON (n.email);
CREATE TEXT INDEX movie_title IF NOT EXISTS FOR (n:Movie) ON (n.title);
For incremental import, DROP CONSTRAINT / DROP INDEX are also supported [2025.02+] — used to remove indexes before the merge phase and recreate them after for faster writes. --schema also accepts graph-type DDL: ALTER CURRENT GRAPH TYPE SET {…} for full [2026.05+], ALTER CURRENT GRAPH TYPE ADD/DROP/ALTER {…} for incremental [2026.06+] — see neo4j-cypher-skill/references/graph-type.md.
Three-stage process — limits downtime to prepare and merge (or --stage=all on a stopped DB):
# Back up first: a failed or aborted merge may corrupt the database
# Stage 1: prepare — DB stopped (STOP DATABASE neo4j WAIT)
neo4j-admin database import incremental --stage=prepare --force \
--nodes=Person=./persons_header.csv,./delta.csv neo4j
# Stage 2: build — imports, deduplicates, validates; DB may be online in read-only mode
# (ALTER DATABASE neo4j SET ACCESS READ ONLY). Repeat --nodes/--relationships
neo4j-admin database import incremental --stage=build --force \
--nodes=Person=./persons_header.csv,./delta.csv neo4j
# Stage 3: merge — DB stopped; updates indexes and constraints. No --nodes needed
neo4j-admin database import incremental --stage=merge --force neo4j
Enterprise only (Community has only import full). Uniqueness constraints must exist on the key label/property pairs of imported nodes, else the command errors. block format needed only for CSV update/delete actions.
Read references/apoc-patterns.md when you need this.
Use when source is not a file (API responses, DB migrations). Collect into BATCH_SIZE (10 000) lists, call UNWIND $rows AS row MERGE ... per batch. ~10x faster than row-at-a-time. → Python + JS examples
| Operation | MCP tool | Notes |
|---|---|---|
SHOW CONSTRAINTS, SHOW INDEXES | read-cypher | Always inspect before import |
CREATE CONSTRAINT, CREATE INDEX | write-cypher | Gate: show planned constraint, confirm |
| LOAD CSV / CALL IN TRANSACTIONS | write-cypher | Gate: show row count + Cypher, confirm |
| Verify counts | read-cypher | Post-import: MATCH (n:Label) RETURN count(n) |
| Poll index state | read-cypher | Poll until all state = 'ONLINE' |
Write gate — before any bulk write via MCP, show:
EXPLAIN planWait for user confirmation. Never auto-execute CALL IN TRANSACTIONS or CREATE CONSTRAINT without confirmation.
MCP tools take only {"query": "...", "params": {...}} — no database argument. Database comes from server config: NEO4J_MCP_DATABASE (STDIO) or the /db/{db}/mcp URL path (HTTP).
| Error | Cause | Fix |
|---|---|---|
Couldn't load the external resource | file:/// path not in Neo4j import dir | Move file to $NEO4J_HOME/import/; check dbms.security.allow_csv_import_from_file_urls=true |
Cannot merge node using null property value | MERGE key resolved to null | Validate row.id IS NOT NULL before MERGE; add WHERE row.id IS NOT NULL |
toInteger() called on null | Null column fed to non-null-safe fn | Replace toInteger() → toIntegerOrNull(), toFloat() → toFloatOrNull() |
Node N already exists / constraint violation mid-import | Duplicate source IDs | Dedup source CSV; use MERGE not CREATE; add IF NOT EXISTS to constraint |
| Heap overflow / OutOfMemoryError | Batch too large or file too large | Reduce batch size; switch to CALL IN TRANSACTIONS; neo4j-admin for offline |
TransactionStartFailed … can only be executed in an implicit transaction | CALL { … } IN TRANSACTIONS run inside session.execute_write / explicit tx | Run it with session.run (auto-commit). driver.execute_query uses a managed transaction and fails the same way. Inside execute_write, use UNWIND batches instead |
Invalid input 'IN': expected...' | PERIODIC COMMIT used | Replace USING PERIODIC COMMIT → CALL IN TRANSACTIONS — PERIODIC COMMIT removed in Cypher 25 |
neo4j-admin: Bad input data | Wrong header format or type mismatch | Check :ID, :START_ID, :END_ID present; check typed columns parse correctly |
| neo4j-admin: import fails silently | --bad-tolerance default was unlimited pre-2025.12 | Set --bad-tolerance=0 to surface all errors |
| Index not used during MERGE | Constraint not created before import | Drop data, create constraint, re-import |
| Relationship import missing nodes | Relationships imported before nodes | Always import ALL node files before ANY relationship files |
After import completes — run all:
// Row counts per label
MATCH (n:Person) RETURN count(n) AS persons;
MATCH ()-[:KNOWS]->() RETURN count(*) AS knows_rels;
// After import: create additional non-unique indexes (populated async)
CREATE TEXT INDEX movie_title IF NOT EXISTS FOR (n:Movie) ON (n.title);
CREATE RANGE INDEX person_born IF NOT EXISTS FOR (n:Person) ON (n.born);
// Poll population — wait until populationPercent = 100 before opening to queries
SHOW INDEXES YIELD name, state, populationPercent
WHERE state <> 'ONLINE' OR populationPercent < 100
RETURN name, state, populationPercent
ORDER BY populationPercent;
// Spot check: null keys = import bug
MATCH (p:Person) WHERE p.id IS NULL RETURN count(p) AS missing_id;
Do NOT run production queries until all indexes are ONLINE.
apoc.* proceduresSHOW DATABASE … YIELD writer = true)toIntegerOrNull() / toFloatOrNull() — never bare toInteger()/toFloat()nullIf(row.x, '') applied where empty string ≠ nullCALL IN TRANSACTIONS used (not USING PERIODIC COMMIT)ON ERROR CONTINUE + REPORT STATUS for production loads--bad-tolerance=0 set; --high-parallel-io=on for SSD.env; .env in .gitignoreWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub neo4j/agent-skills --plugin neo4j-skills30 skills in this plugin
/neo4j-agent-memory-skillAuthoritative reference for the neo4j-agent-memory Python package — a graph-native memory system for AI agents built on Neo4j — and for the hosted service (NAMS) at memory.neo4jlabs.com. Use this skill whenever the user mentions neo4j-agent-memory, agent memory with Neo4j, context graphs, the POLE+O model, MemoryClient/MemorySettings, the memory MCP server, or any of the framework integrations (LangChain, PydanticAI, CrewAI, AWS Strands, Google ADK, Microsoft Agent Framework, OpenAI Agents, LlamaIndex). Also use when the user mentions the hosted service at memory.neo4jlabs.com, NAMS, the Neo4j Agent Memory Service, the `nams_` API key prefix, or the hosted MCP endpoint. Also use when writing documentation, blog posts, tutorials, PRDs, or code samples for the project, when comparing agent memory approaches, or when positioning graph-native memory against vector-only approaches — even if the user doesn't explicitly name the package. Does NOT handle GraphRAG pipelines — use neo4j-graphrag-skill./neo4j-aura-agent-skillManages Neo4j Aura Agents via the v2beta1 REST API — create, list, get, update, delete, and invoke Aura agents backed by an AuraDB instance. Use when configuring Aura Agent tools (CypherTemplate, SimilaritySearch, Text2Cypher), setting system prompts, deploying agents to REST or MCP endpoints, invoking agents with natural language queries, or generating evaluation datasets (max 50 questions) for the Aura Agent evaluation feature. Covers OAuth2 auth, organization/project scoping, tool parameter schemas, and InvokeAgentResponse format. Does NOT cover AuraDB instance provisioning — use neo4j-aura-provisioning-skill. Does NOT cover vector index creation — use neo4j-vector-index-skill./neo4j-aura-graph-analytics-skillServerless Aura Graph Analytics (AGA) GDS Sessions — covers GdsSessions, AuraGraphDataScience, AuraAPICredentials, DbmsConnectionInfo, SessionMemory, get_or_create, remote graph projection with gds.graph.project.cypher and gds.graph.project.remote, gds.graph.project.native, gds.graph.construct, graphdatascience client 2.0 session endpoints, async compute and gds.jobs, AuraDB Cypher API memory/sessionId projection, algorithms, write-back, and session lifecycle. Use for AuraDB-connected, self-managed Neo4j, or standalone DataFrame/Spark session workloads. Does NOT cover the embedded GDS plugin on Aura Pro or self-managed Neo4j — use neo4j-gds-skill. Does NOT handle Cypher authoring — use neo4j-cypher-skill. Does NOT cover Snowflake Graph Analytics — use neo4j-snowflake-graph-analytics-skill./neo4j-aura-provisioning-skillProvisions and manages Neo4j Aura instances via CLI (aura-cli v1.7+) or REST API. Use when creating, pausing, resuming, resizing, or deleting AuraDB Free/Professional/Business Critical/VDC instances; downloading credentials; scripting CI/CD pipelines; polling async status; or using the Terraform neo4j-labs/neo4jaura provider. Covers auth setup (client credentials OAuth2), credential lifecycle (download once — never recoverable), instance type selection, region codes, and Python provisioning scripts. Does NOT handle Cypher queries — use neo4j-cypher-skill. Does NOT cover Graph Data Science algorithms — use neo4j-gds-skill or neo4j-aura-graph-analytics-skill. Does NOT cover neo4j-admin/cypher-shell — use neo4j-cli-tools-skill./neo4j-cli-tools-skillUse when working with Neo4j command-line tools — neo4j-cli (modern unified CLI — Cypher via Bolt, schema inspection, Aura management, Docker containers, credential management, agent skill catalog install; install with curl -sSfL https://neo4j.sh/install.sh | bash), neo4j-admin (backup, restore, import, memory sizing), cypher-shell (ad-hoc queries, scripting, CI/CD), or neo4j-mcp (quick MCP server install). Does NOT cover Cypher query authoring — use neo4j-cypher-skill. Does NOT cover driver upgrades — use neo4j-migration-skill. Does NOT cover full MCP editor configuration — use neo4j-mcp-skill. Does NOT cover the relate embedded engine (relatedb.ai) — use the relate skill; choice guide in neo4j-getting-started-skill./neo4j-cypher-skillGenerates, optimizes, and validates Cypher 25 queries for Neo4j 2025.x and 2026.x. Use when writing new Cypher queries, optimizing slow queries, graph pattern matching, vector or fulltext search, subqueries, or batch writes. Covers MATCH, MERGE, CREATE, WITH, RETURN, CALL, UNWIND, FOREACH, LOAD CSV, SEARCH, expressions, functions, indexes, and subqueries. Does NOT handle driver migration or API changes — use neo4j-migration-skill. Does NOT cover DB administration or server ops — use neo4j-cli-tools-skill. Does NOT cover Cypher on the relate embedded engine — use the relate skill.Other plugins' skills for the same job