neo4j-spring-data-skill

Implements Spring Data Neo4j entity mapping, repositories, and vector search in Spring Boot applications.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building Spring Boot applications backed by Neo4j requires correct entity mapping, repository design, Cypher parameterization, and transaction handling, and mistakes in any of these cause mapping errors, N+1 queries, or data integrity issues. ## Core Features & Use Cases - Entity and Relationship Mapping: Guides @Node, @Relationship, @RelationshipProperties, @DynamicLabels, and ID strategies including UUID business keys with optimistic locking. - Repository Patterns: Covers Neo4jRepository, ReactiveNeo4jRepository, derived queries, @Query with bound Cypher parameters, pagination, projections, and custom fragment implementations via Neo4jClient. - Spring AI Vector Search: Configures Neo4jVectorStore with schema initialization, embedding dimensions, and metadata-filtered similarity search. - Use Case: When building a movie catalog service, use this Skill to define MovieEntity with ACTED_IN relationship properties, write a paged repository query returning collect(r), collect(p), and avoid the common findAll() full-graph traversal pitfall. ## Quick Start Ask your assistant to create a Spring Data Neo4j repository with a Person entity, a KNOWS relationship, and a parameterized @Query finder method.

Frequently Asked Questions about neo4j-spring-data-skill

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

FAQPage Schema
How do I map entities and relationships in Spring Data Neo4j?▼

Annotate classes with @Node and an explicit label, use @Id @GeneratedValue for internal IDs, and declare @Relationship with explicit direction. For relationships carrying data, create a @RelationshipProperties class with @RelationshipId and @TargetNode fields.

How do I write custom Cypher queries in a Neo4jRepository?▼

Add @Query with Cypher on repository methods and always bind values with $paramName parameters, never string concatenation. For relationship-rich results, return the root node plus collect(r) and collect(p) so SDN maps relationship properties correctly.

Which Spring Data Neo4j version works with Spring Boot 3?▼

SDN 8.0.x pairs with Spring Boot 3.3.x/3.4.x, SDN 8.1.x with Spring Boot 3.4.x+, and SDN 7.5.x with Spring Boot 3.2.x, all requiring Java 17+. Use spring-boot-starter-data-neo4j and let the Spring Boot BOM manage versions.

Can I use reactive and imperative Neo4j repositories together?▼

No, mixing ReactiveNeo4jRepository and Neo4jRepository in the same application context throws an IllegalStateException. Pick one stack; for reactive, add spring-boot-starter-webflux alongside the Neo4j starter.

Why does findAll() cause timeouts in Spring Data Neo4j?▼

findAll() greedily fetches the entire reachable graph, which causes timeouts or out-of-memory errors beyond roughly 100 nodes. Replace it with a custom @Query that includes LIMIT and returns only the nodes and relationships the use case needs.

Does Spring AI Neo4jVectorStore work with existing Neo4j config?▼

Yes, Neo4jVectorStore reuses the spring.neo4j connection settings and requires Neo4j 5.15+. Set spring.ai.vectorstore.neo4j.initialize-schema to true and match embedding-dimension to your embedding model, then call similaritySearch with optional metadata filters.