/database-operations-skills:neo4j-graph-database-operationsfrom database-operations-skills
Guides Cypher query writing for operational diagnosis, Neo4j causal clustering setup and troubleshooting, and index/constraint management (property indexes, full-text indexes, uniqueness constraints).
Ships in database-operations-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.
None: SKILL.md is the whole skill.
Neo4j stores data as a property graph — nodes and relationships, both of which can carry properties — and is purpose-built for queries that traverse relationships (multi-hop "who is connected to whom, and how" questions) that are expensive or awkward to express as repeated joins in a relational engine. Its operational model is unusual because relationship traversal cost in Neo4j is proportional to the number of relationships actually traversed, not the total graph size — a query that stays well-indexed at the entry point and traverses a bounded number of hops stays fast regardless of overall graph size, while one missing an index or traversing unbounded depth degrades sharply. This skill covers Cypher fundamentals needed for operational diagnosis, causal clustering (Neo4j's replication/HA mechanism), and index/ constraint management — the operational core that keeps a Neo4j deployment fast and available as the graph grows. For a distinct multi-model engine that combines graph with document and key-value data in one database rather than a graph-only architecture, see arangodb-multi-model-database-operations.
CREATE INDEX ... FOR (n:Label) ON (n.prop) vs. the newer
CREATE INDEX ... FOR (n:Label) ON (n.prop) unified syntax) changed
between the 3.x/4.x and 5.x lines — verify syntax against the target
version before assuming portability.dbms.security role-based access configured for any multi-user
deployment — Neo4j Enterprise supports fine-grained, role-based
privilege grants per label/relationship-type/property.// Find nodes with no relationships at all (often orphaned/incomplete data)
MATCH (n:Customer)
WHERE NOT (n)--()
RETURN n.customerId LIMIT 100;
// Check relationship cardinality distribution for a label — spot a
// "super-node" with disproportionately many relationships
MATCH (n:Customer)-[r:PLACED]->(:Order)
WITH n, count(r) AS orderCount
RETURN avg(orderCount), max(orderCount), percentileCont(orderCount, 0.99);
A super-node (a single node with an extremely high relationship count — e.g. a "country" node connected to millions of customer nodes) is Neo4j's rough equivalent of a Cassandra hot partition or a MongoDB low-cardinality shard key: any traversal through that node becomes expensive regardless of indexing, since the traversal must still enumerate a huge relationship set. Identify and redesign around super-nodes (e.g. an intermediate grouping node, or reconsidering whether that relationship should exist at that granularity) rather than only adding more indexes, since indexing helps find the node, not traverse through it cheaply.
PROFILE
MATCH (c:Customer {email: '[email protected]'})-[:PLACED]->(o:Order)-[:CONTAINS]->(p:Product)
WHERE p.category = 'electronics'
RETURN o.orderId, p.name;
PROFILE (runs the query and reports actual row counts per operator) is
the Cypher equivalent of PostgreSQL's EXPLAIN ANALYZE — use it, not
EXPLAIN alone (which only estimates), to find the real bottleneck.
Look for a NodeByLabelScan (full label scan, analogous to a Seq Scan) where an index-backed NodeIndexSeek is expected — this
typically means the starting property (email here) has no index:
CREATE INDEX customer_email_idx FOR (c:Customer) ON (c.email);
Also watch for an unintended Cartesian product: a MATCH clause
with two disconnected patterns (no relationship linking them) computes
every combination of both patterns' matches, which can silently
explode result size and cost even though the query "looks" like a
normal traversal — Neo4j's planner will flag this in the query plan
(CartesianProduct operator) and, in recent versions, warns about it
explicitly; treat that warning as a real problem to fix, not noise to
suppress.
// Bounded-depth traversal — safe, cost scales with actual hop count and fan-out
MATCH (start:Person {id: $id})-[:KNOWS*1..3]-(friend:Person)
RETURN DISTINCT friend;
An unbounded variable-length traversal ([:KNOWS*] with no upper
bound) on a densely connected graph can expand combinatorially — always
set an explicit upper bound unless the graph's connectivity is known to
be sparse enough that unbounded traversal is genuinely safe. Direction
matters for both correctness and performance: -[:KNOWS]-> (a directed
pattern) can use an index/degree lookup scoped to that direction, while
-[:KNOWS]- (undirected, matching either direction) must consider
relationships in both directions — use directed patterns whenever the
underlying relationship is genuinely modeled as directional.
# neo4j.conf — core server
dbms.mode=CORE
dbms.cluster.discovery.type=LIST
dbms.cluster.discovery.endpoints=core1:5000,core2:5000,core3:5000
dbms.cluster.raft.advertised_address=core1:7000
# neo4j.conf — read replica
dbms.mode=READ_REPLICA
dbms.cluster.discovery.endpoints=core1:5000,core2:5000,core3:5000
Core servers use Raft consensus to elect a leader and replicate writes synchronously enough to guarantee committed writes survive a minority of core-server failures; read replicas asynchronously catch up from the cluster and serve read traffic, scaling read throughput horizontally without adding write-quorum overhead. Verify cluster health and role assignment:
CALL dbms.cluster.overview() YIELD id, addresses, role;
A core server showing role: FOLLOWER indefinitely with no LEADER
present anywhere in the overview indicates the cluster cannot currently
elect a leader — check for a genuine network partition or an
even-numbered core-server count that's landed in a scenario where no
partition holds a strict majority (same quorum-math reasoning as an
odd-node requirement in Galera or Cassandra token-ring topology
elsewhere in this repo).
-- Property index for fast lookup by a commonly-filtered property
CREATE INDEX order_status_idx FOR (o:Order) ON (o.status);
-- Composite index for a query commonly filtering on both properties together
CREATE INDEX order_customer_status_idx FOR (o:Order) ON (o.customerId, o.status);
-- Uniqueness constraint (also implicitly creates a backing index)
CREATE CONSTRAINT customer_id_unique FOR (c:Customer) REQUIRE c.customerId IS UNIQUE;
-- Full-text index for free-text search over a property
CREATE FULLTEXT INDEX product_search_idx FOR (p:Product) ON EACH [p.name, p.description];
A uniqueness constraint both enforces the invariant at write time (rejecting a duplicate) and creates a backing index automatically — for any property that must genuinely be unique, prefer the constraint over a plain index plus application-level uniqueness checking, since the latter is racy under concurrent writes while the constraint is enforced by the database itself. Building an index on a large existing label population is a background operation but still consumes real I/O and can take time proportional to node count — schedule for a low-traffic window on a large graph rather than assuming it's instantaneous.
[:REL*1..n]) unless the graph's connectivity is provably
sparse enough for unbounded traversal to be safe.PROFILE, not EXPLAIN alone, to diagnose real query cost —
EXPLAIN only estimates, and Neo4j's planner estimates can be
materially wrong on a skewed graph (e.g. around a super-node).CartesianProduct operators in query plans —
a query "looks" like a normal multi-pattern traversal but silently
computes a full cross-product if the patterns aren't actually
connected by a relationship.Symptom: A Cypher query traversing from a specific node type is
fast for most starting nodes but catastrophically slow for a small
subset.
Fix: Those specific starting nodes are super-nodes with an
extremely high relationship count (check with
MATCH (n:Label) RETURN n, size((n)--()) AS degree ORDER BY degree DESC LIMIT 10). Redesign the data model around the super-node
(an intermediate grouping node, or reconsidering whether that
relationship should exist at that granularity) rather than only
adding more indexes at the traversal's entry point.
Symptom: A query with two seemingly independent MATCH clauses
returns a much larger and slower-to-compute result set than expected.
Fix: The two patterns aren't connected by any relationship,
producing an unintended Cartesian product (every combination of both
patterns' matches). Check the query plan for a CartesianProduct
operator, and either connect the patterns via a shared variable/
relationship or restructure into separate queries if a genuine
cross-product wasn't intended.
Symptom: A causal cluster's dbms.cluster.overview() shows every
core server as FOLLOWER, with no LEADER anywhere, and writes fail.
Fix: The cluster cannot achieve Raft quorum — check for an
even-numbered core-server count (a genuine network partition can then
leave no side with a strict majority) or an actual network partition
between core servers. Always run an odd number of core servers (3 or
5), and investigate connectivity between them (the
dbms.cluster.discovery.endpoints list and actual network reachability)
before assuming a software bug.
Symptom: A read replica falls further and further behind the cluster's write throughput and never catches up. Fix: Read replicas replicate asynchronously and can genuinely fall behind under sustained high write volume, particularly if under-provisioned relative to the core servers. Check replica lag via monitoring (transaction ID comparison between replica and leader), scale the read replica's resources, or add more read replicas to spread read load rather than routing all reads to a single overloaded replica.
Symptom: Someone runs MATCH (n) DETACH DELETE n (deleting all
nodes and their relationships) directly against a production database
intending to clear test data from a specific label only.
Fix: An unscoped MATCH (n) matches every node in the entire
graph, not just the intended label — DETACH DELETE then removes all
of it along with every relationship, irreversibly.
Warning — destructive action. Always scope a deletion query to the specific label/property intended (
MATCH (n:TestData) DETACH DELETE n), run the equivalent read-onlyMATCH ... RETURN count(n)first to confirm scope matches intent, and restrict broad delete privileges via Neo4j's role-based access control to a narrow admin role rather than general application credentials.
Scenario: A social-recommendation feature's Cypher query — "find friends-of-friends who follow a shared list of interests" — has become slow for a small number of accounts, while working fine for the vast majority of users.
PROFILE
MATCH (u:User {id: $id})-[:FOLLOWS]->(:Interest)<-[:FOLLOWS]-(other:User)
MATCH (u)-[:FRIENDS_WITH*1..2]-(fof:User)
WHERE fof = other
RETURN DISTINCT other.id;
The plan shows an enormous number of rows processed at the
Expand(All) step for the :FOLLOWS relationship from a specific
:Interest node.MATCH (i:Interest {name: 'photography'})<-[:FOLLOWS]-()
RETURN count(*);
-- 2,400,000
Confirmed: "photography" is a super-node followed by millions of
users, and any traversal through it is expensive regardless of
indexing.CREATE INDEX user_friends_lookup_idx FOR (u:User) ON (u.id);
restructuring the query to first compute the (much smaller)
friends-of-friends set, then filter by shared interest membership,
rather than starting from the high-degree interest node.:Interest
and similar "hub" labels as part of routine graph health review, so
the next emerging super-node is caught before it causes a
user-visible regression.DETACH DELETE, a dropped constraint) against a production graph.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin database-operations-skills23 skills in this plugin
/arangodb-multi-model-database-operationsCovers operating ArangoDB, a multi-model database combining document, graph, and key-value collections in a single engine with a unified query language (AQL): collection type selection, graph traversal via AQL, and cluster configuration (coordinators, DB-servers, agency). Use when the user asks to "write an AQL query," "should I use a document or edge collection in ArangoDB," "set up an ArangoDB cluster," "why is this AQL graph traversal slow," or "choose between ArangoDB and a single-purpose database for a mixed graph/document workload."
/cassandra-wide-column-database-operationsCovers Apache Cassandra ring topology and token/partition design, tunable consistency levels (ONE, QUORUM, ALL, LOCAL_QUORUM), compaction strategy selection (SizeTiered, Leveled, TimeWindow), and tombstone/GC-grace management. Use when the user asks to "design a Cassandra partition key," "choose a Cassandra consistency level," "why is this Cassandra query slow," "pick a compaction strategy," "Cassandra tombstone warnings in logs," or "add/remove a node from a Cassandra ring."
/clickhouse-analytical-database-operationsCovers operating ClickHouse, the leading open-source OLAP columnar database: MergeTree engine family selection (MergeTree, ReplacingMergeTree, AggregatingMergeTree, SummingMergeTree), sharding and replication topology via ReplicatedMergeTree and Distributed tables, and materialized views for streaming aggregation. Use when the user asks to "set up a ClickHouse cluster," "pick a MergeTree engine," "why are my ClickHouse queries slow," "shard and replicate ClickHouse tables," "deduplicate rows in ClickHouse," or "build a ClickHouse materialized view for rollups."
/cloud-data-warehouse-operations-snowflake-bigquery-redshiftComparative operations guide for the three dominant managed cloud data warehouses: Snowflake virtual warehouse sizing and multi-cluster scaling, BigQuery slot allocation and on-demand vs. capacity pricing, and Redshift cluster/RA3 node sizing and workload management (WLM) — plus cost-control and query-performance practices common to all three. Use when the user asks to "size a Snowflake warehouse," "control BigQuery query costs," "tune Redshift WLM queues," "why is this warehouse query slow," "reduce our data warehouse bill," or "choose between Snowflake, BigQuery, and Redshift."
/database-backup-and-restore-strategiesCross-database backup tooling and restore-testing discipline: pg_dump/pg_basebackup for PostgreSQL, mysqldump/Percona XtraBackup for MySQL/MariaDB, and mongodump/mongorestore for MongoDB — logical vs. physical backup trade-offs, point-in-time recovery, and why an untested restore is not a real backup. Use when the user asks to "set up database backups," "restore from a pg_basebackup," "why did our mysqldump restore fail," "test our backup/restore process," "set up point-in-time recovery," or "design a backup retention policy."
/database-connection-pooling-strategiesCross-database connection pooling patterns and tooling: PgBouncer for PostgreSQL, ProxySQL for MySQL/MariaDB, and the shared design questions (transaction vs. session vs. statement pooling modes, backend pool sizing, failover-aware routing) that apply regardless of the underlying database engine. Use when the user asks to "size a connection pool," "choose between transaction and session pooling," "set up ProxySQL for MySQL," "why do prepared statements break under pooling," or "route reads/writes through a proxy during failover."
Other plugins' skills for the same job