neo4j
БесплатноБез исполняемых скриптовНе проверенNeo4j is a graph database that stores nodes and relationships and is queried with Cypher. Use when a user asks to model connected data, write Cypher queries…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Neo4j
Overview
Neo4j stores data as nodes (with labels and properties) and typed, directed relationships, which makes multi-hop questions (friends of friends, who bought what others bought, which accounts share a device) cheap compared with SQL joins. Releases now use calendar versions (2026.10 at the time of writing) next to the 5.26 long-term line; Docker tags neo4j:latest, neo4j:2026.10.1 and neo4j:5.26 exist. Queries run in Cypher; examples below were run against Neo4j 2026.10.1 Community with neo4j-driver 6.2 and the Python neo4j 6.4 driver.
Instructions
Step 1: Run Neo4j locally
export NEO4J_PASSWORD="$(openssl rand -base64 18)" # keep it in your secret store
docker run -d --name neo4j \
-p 127.0.0.1:7474:7474 -p 127.0.0.1:7687:7687 \
-v neo4j_data:/data \
-e NEO4J_AUTH="neo4j/${NEO4J_PASSWORD}" \
neo4j:2026.10.1
Browser UI at http://localhost:7474, Bolt at neo4j://localhost:7687. The password must be at least 8 characters and is applied only on the first start of an empty /data volume. Publishing ports on 127.0.0.1 keeps the database off the network. Run queries from a shell with docker exec -it neo4j cypher-shell -u neo4j -p "$NEO4J_PASSWORD".
Drivers:
npm install neo4j-driver
pip install neo4j
Step 2: Create data
Use MERGE for anything that may already exist; CREATE always makes a new node.
CREATE (alice:Person {name: 'Alice', email: '[email protected]', age: 30})
CREATE (bob:Person {name: 'Bob', email: '[email protected]', age: 28})
CREATE (neo:Technology {name: 'Neo4j', category: 'Database'})
RETURN alice, bob, neo;
MATCH (a:Person {name: 'Alice'}), (b:Person {name: 'Bob'})
CREATE (a)-[:KNOWS {since: 2024}]->(b);
MATCH (a:Person {name: 'Alice'}), (t:Technology {name: 'Neo4j'})
CREATE (a)-[:USES {skill_level: 'expert'}]->(t);
Each MATCH ... CREATE makes one relationship per matched pair; if MATCH finds nothing, nothing is created and no error is raised.
Step 3: Query
// Friends of friends
MATCH (p:Person {name: 'Alice'})-[:KNOWS]->()-[:KNOWS]->(fof)
WHERE fof <> p
RETURN DISTINCT fof.name;
// Shortest path, any direction, at most 6 hops
MATCH path = shortestPath((a:Person {name: 'Alice'})-[:KNOWS*..6]-(b:Person {name: 'Charlie'}))
RETURN path, length(path);
// Same with the newer quantified-path syntax (Cypher 25 / GQL)
MATCH path = SHORTEST 1 (a:Person {name: 'Alice'})-[:KNOWS]-+(b:Person {name: 'Charlie'})
RETURN length(path);
// Filter on a relationship property and collect
MATCH (p:Person)-[r:USES]->(t:Technology)
WHERE r.skill_level = 'expert'
RETURN p.name, collect(t.name) AS technologies;
// Aggregation
MATCH (p:Person)-[:KNOWS]->(friend)
RETURN p.name, count(friend) AS friend_count
ORDER BY friend_count DESC LIMIT 10;
Never build Cypher by string concatenation. Pass values as parameters ($name); this prevents Cypher injection and lets Neo4j reuse the query plan. Labels, relationship types and property keys cannot be parameters.
Step 4: Indexes and constraints
Create them before loading data at scale; a MERGE or MATCH on an unindexed property scans every node with the label.
CREATE CONSTRAINT person_email IF NOT EXISTS
FOR (p:Person) REQUIRE p.email IS UNIQUE; // also creates a backing index
CREATE INDEX person_name IF NOT EXISTS FOR (p:Person) ON (p.name);
CREATE INDEX order_status_date IF NOT EXISTS
FOR (o:Order) ON (o.status, o.created_at); // composite
CREATE FULLTEXT INDEX person_search IF NOT EXISTS
FOR (p:Person) ON EACH [p.name, p.bio];
CALL db.index.fulltext.queryNodes('person_search', 'Alice') YIELD node, score
RETURN node.name, score;
SHOW INDEXES YIELD name, type, state;
Indexes populate in the background; check state is ONLINE before relying on them.
Vector index for embeddings (set vector.dimensions to your model's size, for example 1536):
CREATE VECTOR INDEX doc_embeddings IF NOT EXISTS
FOR (d:Doc) ON (d.embedding)
OPTIONS {indexConfig: {`vector.dimensions`: 1536, `vector.similarity_function`: 'cosine'}};
CALL db.index.vector.queryNodes('doc_embeddings', 5, $queryEmbedding)
YIELD node, score RETURN node.title, score;
Step 5: Node.js driver
Create one driver per application and reuse it; sessions are cheap, drivers are not. executeQuery handles sessions, transactions and retries.
// db.js
const neo4j = require('neo4j-driver');
const driver = neo4j.driver(
process.env.NEO4J_URI || 'neo4j://localhost:7687',
neo4j.auth.basic(process.env.NEO4J_USER || 'neo4j', process.env.NEO4J_PASSWORD)
);
async function findFriends(name) {
const { records } = await driver.executeQuery(
'MATCH (p:Person {name: $name})-[:KNOWS]->(friend) RETURN friend.name AS name',
{ name },
{ database: 'neo4j', routing: neo4j.routing.READ }
);
return records.map(r => r.get('name'));
}
async function createFriendship(person1, person2) {
await driver.executeQuery(
`M
Установить neo4j в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл neo4j?
Neo4j is a graph database that stores nodes and relationships and is queried with Cypher. Use when a user asks to model connected data, write Cypher queries, find shortest paths or recommendations, create indexes and constraints, run Neo4j in Docker, or connect from Node.js or Python with the official drivers. Covers social graphs, fraud detection, knowledge graphs and vector search.
Как установить скилл neo4j?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл neo4j запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic