neo4j
Neo4j is the leading graph database for connected data. Learn Cypher query language, node and relationship modeling, graph algorithms, and integration with Node.js using the official neo4j-driver.
What this skill does
# Neo4j
Neo4j stores data as nodes and relationships (edges), making it ideal for social networks, recommendation engines, fraud detection, and knowledge graphs.
## Installation
```bash
# Docker (recommended)
docker run -d --name neo4j -p 7474:7474 -p 7687:7687 \
-e NEO4J_AUTH=neo4j/password123 \
neo4j:5
# Access browser UI at http://localhost:7474
# Bolt protocol at bolt://localhost:7687
# Node.js driver
npm install neo4j-driver
# Python driver
pip install neo4j
```
## Cypher Basics
```cypher
// create-nodes.cypher: Create nodes with labels and properties
CREATE (alice:Person {name: 'Alice', email: '[email protected]', age: 30})
CREATE (bob:Person {name: 'Bob', email: '[email protected]', age: 28})
CREATE (graphDb:Technology {name: 'Neo4j', category: 'Database'})
RETURN alice, bob, graphDb;
```
```cypher
// create-relationships.cypher: Connect nodes with typed relationships
MATCH (a:Person {name: 'Alice'}), (b:Person {name: 'Bob'})
CREATE (a)-[:KNOWS {since: 2024}]->(b)
RETURN a, b;
MATCH (a:Person {name: 'Alice'}), (t:Technology {name: 'Neo4j'})
CREATE (a)-[:USES {skill_level: 'expert'}]->(t)
RETURN a, t;
```
## Querying
```cypher
// queries.cypher: Common query patterns
// Find friends of friends
MATCH (p:Person {name: 'Alice'})-[:KNOWS]->()-[:KNOWS]->(fof)
WHERE fof <> p
RETURN DISTINCT fof.name;
// Shortest path between two people
MATCH path = shortestPath(
(a:Person {name: 'Alice'})-[:KNOWS*..6]-(b:Person {name: 'Charlie'})
)
RETURN path, length(path);
// Pattern matching with filtering
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;
```
## Indexes and Constraints
```cypher
// indexes.cypher: Create indexes and constraints for performance
CREATE CONSTRAINT person_email IF NOT EXISTS
FOR (p:Person) REQUIRE p.email IS UNIQUE;
CREATE INDEX person_name IF NOT EXISTS
FOR (p:Person) ON (p.name);
// Composite index
CREATE INDEX order_status_date IF NOT EXISTS
FOR (o:Order) ON (o.status, o.created_at);
// Full-text index
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;
```
## Node.js Driver
```javascript
// db.js: Neo4j client with official Node.js driver
const neo4j = require('neo4j-driver');
const driver = neo4j.driver(
'bolt://localhost:7687',
neo4j.auth.basic('neo4j', 'password123')
);
async function findFriends(name) {
const session = driver.session({ database: 'neo4j' });
try {
const result = await session.executeRead(tx =>
tx.run(
'MATCH (p:Person {name: $name})-[:KNOWS]->(friend) RETURN friend.name AS name',
{ name }
)
);
return result.records.map(r => r.get('name'));
} finally {
await session.close();
}
}
async function createFriendship(person1, person2) {
const session = driver.session({ database: 'neo4j' });
try {
await session.executeWrite(tx =>
tx.run(
`MERGE (a:Person {name: $p1})
MERGE (b:Person {name: $p2})
MERGE (a)-[:KNOWS]->(b)`,
{ p1: person1, p2: person2 }
)
);
} finally {
await session.close();
}
}
// Cleanup on exit
process.on('exit', () => driver.close());
module.exports = { findFriends, createFriendship };
```
## Python Driver
```python
# app.py: Neo4j with official Python driver
from neo4j import GraphDatabase
driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password123"))
def find_friends(name):
with driver.session() as session:
result = session.run(
"MATCH (p:Person {name: $name})-[:KNOWS]->(f) RETURN f.name AS name",
name=name,
)
return [record["name"] for record in result]
def recommend_friends(name):
with driver.session() as session:
result = session.run("""
MATCH (p:Person {name: $name})-[:KNOWS]->(friend)-[:KNOWS]->(rec)
WHERE NOT (p)-[:KNOWS]->(rec) AND rec <> p
RETURN rec.name AS name, count(*) AS mutual
ORDER BY mutual DESC LIMIT 5
""", name=name)
return [dict(r) for r in result]
driver.close()
```
## Graph Data Modeling Tips
```text
Modeling Guidelines:
- Nouns → Node labels (Person, Product, Order)
- Verbs → Relationship types (PURCHASED, KNOWS, REVIEWED)
- Adjectives → Properties on nodes or relationships
- Always direction: (a)-[:KNOWS]->(b), query can ignore direction with -[:KNOWS]-
- Avoid super-nodes (millions of relationships); use intermediate nodes
- Use relationship properties for weight, timestamp, metadata
```
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.