Agent skill

Neo4j Cypher Guide

by opsmill in opsmill/infrahub

Comprehensive guide for writing modern Neo4j Cypher queries.

Apache-2.0Auto-check passedDevOps & Cloud

Install Neo4j Cypher Guide

skills CLI
$ npx skills add opsmill/infrahub --skill neo4j-cypher-guide -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install opsmill/infrahub neo4j-cypher-guide --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/opsmill/infrahub.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/neo4j-cypher-guide .claude/skills/neo4j-cypher-guide && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
neo4j-cypher-guide
GitHub stars
531
Used in
1 other repo
Token cost
~1.8k tokens
SKILL.md length
613 words
Files
4 (incl. references)
Skills in repo
32
Repo updated
First seen
Licence
Apache-2.0

At a glance

Comprehensive guide for writing modern Neo4j Cypher queries.

  • Works in 5 steps: Use modern syntax patterns - QPP for… → Optimize during traversal - Filter early… → Always filter nulls when sorting - Add… → …
  • DevOps & Cloud work in your project
  • SKILL.md covers Quick Compatibility Check, Core Principles for Query…, Critical Sorting Rule and Query Pattern Selection Guide, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Neo4j Cypher Guide is an agent skill from opsmill/infrahub. Comprehensive guide for writing modern Neo4j Cypher queries. Essential for text2cypher MCP tools and LLMs generating Cypher queries. Covers removed/deprecated syntax, modern replacements, CALL subqueries for reads, COLLECT patterns, sorting best practices, set-based writes, and Quantified Path Patterns (QPP) for efficient graph traversal.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/deprecated-syntax.md`, `references/qpp.md` and `references/subqueries.md`).

It sits in DevOps & Cloud. It works with Neo4j. The repository describes itself as: Infrahub is a graph-based data management platform with built-in version control, CI workflows, peer review, and API access. It’s purpose-built to power reliable infrastructure… The licence is Apache-2.0.

When your agent uses it

  • DevOps & Cloud work in your project

Example prompts

  • “/neo4j-cypher-guide”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Use modern syntax patterns - QPP for complex traversals, CALL subqueries for complex reads
  2. Optimize during traversal - Filter early within patterns, not after expansion
  3. Always filter nulls when sorting - Add IS NOT NULL checks for sorted properties
  4. Explicit is better than implicit - Always use explicit grouping and type checking
  5. Write set-based, not per-node - One query with a WHERE/property condition beats fetching

What it can do on your machine

Read from SKILL.md and the folder at commit 460d724. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are cypher).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Neo4j Cypher Guide loads about 1.8k tokens when it runs, and up to ~5.3k if it reads all its reference files. Until then it costs about 90 tokens; SKILL.md has 613 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~90
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from opsmill/infrahub at commit 460d724, republished under its Apache-2.0 licence (© opsmill). 613 words, ~1,821 tokens.

Download SKILL.mdSave it as .claude/skills/neo4j-cypher-guide/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
neo4j-cypher-guide
description
Comprehensive guide for writing modern Neo4j Cypher queries. Essential for text2cypher MCP tools and LLMs generating Cypher queries. Covers removed/deprecated syntax, modern replacements, CALL subqueries for reads, COLLECT patterns, sorting best practices, set-based writes, and Quantified Path Patterns (QPP) for efficient graph traversal.

Neo4j Modern Cypher Query Guide

This skill helps generate Neo4j Cypher queries using modern syntax patterns and avoiding deprecated features. It focuses on efficient query patterns for graph traversal, data retrieval, and set-based writes.

Quick Compatibility Check

When generating Cypher queries, immediately avoid these REMOVED features:

  • ❌ id() function → Use elementId()
  • ❌ Implicit grouping keys → Use explicit WITH clauses
  • ❌ Pattern expressions for lists → Use pattern comprehension or COLLECT subqueries
  • ❌ Repeated relationship variables → Use unique variable names
  • ❌ Automatic list to boolean coercion → Use explicit checks

Core Principles for Query Generation

  1. Use modern syntax patterns - QPP for complex traversals, CALL subqueries for complex reads

  2. Optimize during traversal - Filter early within patterns, not after expansion

  3. Always filter nulls when sorting - Add IS NOT NULL checks for sorted properties

  4. Explicit is better than implicit - Always use explicit grouping and type checking

  5. Write set-based, not per-node - One query with a WHERE/property condition beats fetching nodes and mutating them one by one (an N+1). E.g. delete all rows for one owner in one shot:

    cypher
    MATCH (n:Preference { owner_id: $owner_id })
    DETACH DELETE n

    not "fetch matching nodes, then run one DELETE per node".

Critical Sorting Rule

ALWAYS filter NULL values when sorting:

cypher
// WRONG - May include null values
MATCH (n:Node)
RETURN n.name, n.value
ORDER BY n.value

// CORRECT - Filter nulls before sorting
MATCH (n:Node)
WHERE n.value IS NOT NULL
RETURN n.name, n.value
ORDER BY n.value

Query Pattern Selection Guide

For Simple Queries

Use standard Cypher patterns with modern syntax:

cypher
MATCH (n:Label {property: value})
WHERE n.otherProperty IS :: STRING
RETURN n
For Variable-Length Paths

Consider Quantified Path Patterns (QPP) for better performance:

cypher
// Instead of: MATCH (a)-[*1..5]->(b)
// Use: MATCH (a)-[]-{1,5}(b)

// With filtering:
MATCH (a)((n WHERE n.active)-[]->(m)){1,5}(b)
For Aggregations

Use COUNT{}, EXISTS{}, and COLLECT{} subqueries:

cypher
MATCH (p:Person)
WHERE count{(p)-[:KNOWS]->()} > 5
RETURN p.name,
       exists{(p)-[:MANAGES]->()} AS isManager
For Complex Read Operations

Use CALL subqueries for sophisticated data retrieval:

cypher
MATCH (d:Department)
CALL (d) {
  MATCH (d)<-[:WORKS_IN]-(p:Person)
  WHERE p.salary IS NOT NULL  // Filter nulls
  WITH p ORDER BY p.salary DESC
  LIMIT 3
  RETURN collect(p.name) AS topEarners
}
RETURN d.name, topEarners

Common Query Transformations

Counting Patterns
cypher
// Old: RETURN size((n)-[]->())
// Modern: RETURN count{(n)-[]->()}
Checking Existence
cypher
// Old: WHERE exists((n)-[:REL]->())
// Modern: WHERE EXISTS {MATCH (n)-[:REL]->()}
// Also valid: WHERE exists{(n)-[:REL]->()}
Element IDs
cypher
// Old: WHERE id(n) = 123
// Modern: WHERE elementId(n) = "4:abc123:456"
// Note: elementId returns a string, not integer
Sorting with Null Handling
cypher
// Always add null check
MATCH (n:Node)
WHERE n.sortProperty IS NOT NULL
RETURN n
ORDER BY n.sortProperty

// Or use NULLS LAST
MATCH (n:Node)
RETURN n
ORDER BY n.sortProperty NULLS LAST

When to Load Reference Documentation

Load the appropriate reference file when:

references/deprecated-syntax.md
  • Migrating queries from older Neo4j versions
  • Encountering syntax errors with legacy queries
  • Need complete list of removed/deprecated features
references/subqueries.md
  • Working with CALL subqueries for reads
  • Using COLLECT or COUNT subqueries
  • Handling complex aggregations
  • Implementing sorting with null filtering
references/qpp.md
  • Optimizing variable-length path queries
  • Need early filtering during traversal
  • Working with paths longer than 3-4 hops
  • Complex pattern matching requirements

Query Generation Checklist

Before finalizing any generated query:

  1. ✅ No deprecated functions (id, btree indexes, etc.)
  2. ✅ Explicit grouping for aggregations
  3. ✅ NULL filters for all sorted properties
  4. ✅ Appropriate subquery patterns for reads
  5. ✅ Consider QPP for paths with filtering needs
  6. ✅ Use COUNT{} instead of size() for pattern counting
  7. ✅ Variable scope clauses in CALL subqueries
  8. ✅ Unique variable names for relationships
Show full SKILL.md (231 more words)Show less

Error Resolution Patterns

"Implicit grouping key" errors
cypher
// Problem: RETURN n.prop, count(*) + n.other
// Solution: WITH n.prop AS prop, n.other AS other, count(*) AS cnt
//          RETURN prop, cnt + other
"id() function not found"
cypher
// Use elementId() but note it returns a string, not integer
"Repeated variable" errors
cypher
// Problem: MATCH (a)-[r*]->(), (b)-[r*]->()
// Solution: MATCH (a)-[r1*]->(), (b)-[r2*]->()

Performance Tips

  1. Start with indexed properties - Always anchor patterns with indexed lookups
  2. Filter early in QPP - Apply WHERE clauses within the pattern
  3. Filter nulls before sorting - Prevent unexpected results and improve performance
  4. Limit expansion depth - Use reasonable upper bounds in quantifiers
  5. Use EXISTS for existence checks - More efficient than counting
  6. Profile queries - Use PROFILE to identify bottlenecks

Modern Cypher Features

Label Expressions
cypher
WHERE n:Label1|Label2  // OR
WHERE n:Label1&Label2  // AND
WHERE n:!Archived      // NOT
Dynamic Labels and Types

Labels and relationship types accept parameters (Neo4j 5.26+):

cypher
MATCH (n:$($label))                    // dynamic node label
MATCH (a)-[r:$($rel_type)]->(b)        // dynamic relationship type

Choosing between a dynamic label and interpolating the label into the query text is a performance tradeoff, not a style rule: each interpolated variant is planned and cached separately, but the planner generally does better with a static label than a dynamic one. If the label is the primary filter of the MATCH, prefer a static/interpolated label; when other indexed predicates carry the filtering, a dynamic label is more likely to be acceptable. When in doubt, PROFILE both.

Type Predicates
cypher
WHERE n.prop IS :: STRING
WHERE n.value IS :: INTEGER NOT NULL
WHERE n.data IS :: LIST<STRING>
Subquery Patterns for Reads
  • COUNT{} - Count patterns efficiently
  • EXISTS{} - Check pattern existence
  • COLLECT{} - Collect complex results
  • CALL{} - Execute subqueries for complex reads
Quantified Path Patterns
  • Inline filtering during traversal
  • Access to nodes and relationships in patterns
  • Significant performance improvements (up to 1000x)
  • Support for complex, multi-hop patterns

Always prefer modern syntax patterns for better performance and maintainability.

© opsmill, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .agents/skills/neo4j-cypher-guide of opsmill/infrahub.

  • SKILL.md
  • references/deprecated-syntax.md
  • references/qpp.md
  • references/subqueries.md

Open the folder on GitHubat commit 460d724

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in opsmill/infrahub, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Neo4j Cypher Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Neo4j Cypher Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Neo4j Cypher Guide this skillopsmill/infrahub5311 repos~1.8kAutomated safety check: PassApache-2.0
Neo4j Aura Provisioning Skillneo4j-contrib/neo4j-skills1141 repos~3.7kAutomated safety check: NotesMIT
Performing Cloud Asset Inventory With Cartographymukul975/Anthropic-Cybersecurity-Skills34k—~1.7kAutomated safety check: PassApache-2.0
Cognee Docker Setuptopoteretes/cognee32k1 repos~901Automated safety check: NotesApache-2.0
Using Graph Databasesancoleman/ai-design-components526—~3.2kAutomated safety check: PassMIT
Neo4j Gds Skillneo4j-contrib/neo4j-skills114—~5kAutomated safety check: NotesMIT

Similar skills

  • Neo4j Aura Provisioning Skill

    neo4j-contrib/neo4j-skills

    Provisions and manages Neo4j Aura instances via CLI (aura-cli v1.7+) or REST API.

    114 GitHub starsUsed in 1 repo~3.7k tokens
    DevOps & CloudAuto-check: notes
  • Performing Cloud Asset Inventory With Cartography

    mukul975/Anthropic-Cybersecurity-Skills

    Run Cartography to sync AWS, GCP, or Azure resources into a Neo4j graph database, mapping relationships such as IAM permission chains, network paths, and cross-account trust.

    34k GitHub stars~1.7k tokensUpdated 1 mo ago
    DevOps & CloudAuto-check passed
  • Cognee Docker Setup

    topoteretes/cognee

    Runs the Cognee AI memory platform in Docker, from a one-file prebuilt image to a full compose stack with UI, MCP server, Postgres and Neo4j.

    32k GitHub starsUsed in 1 repo~901 tokens
    DevOps & CloudAuto-check: notes
  • Using Graph Databases

    ancoleman/ai-design-components

    Graph database implementation for relationship-heavy data models.

    526 GitHub stars~3.2k tokensUpdated 10 mo ago
    DatabasesAuto-check passed
  • Neo4j Gds Skill

    neo4j-contrib/neo4j-skills

    Neo4j Graph Data Science (GDS) embedded plugin via Python client or Cypher — covers graphdatascience client 2.x, GraphDataScience, gds.graph.project.native, gds.graph.project.cypher, snakecase…

    114 GitHub stars~5k tokensUpdated 2 days ago
    Backend & APIsAuto-check: notes
  • Neo4j Query Tuning Skill

    neo4j-contrib/neo4j-skills

    Diagnoses and fixes slow Neo4j Cypher queries by reading execution plans, identifying bad operators (AllNodesScan, CartesianProduct, Eager, NodeByLabelScan), and prescribing fixes (indexes, hints…

    114 GitHub stars~2.6k tokensUpdated 2 days ago
    DatabasesAuto-check: notes

More from opsmill/infrahub

All 32 skills in this repo
  • Analyzing CI Flakiness

    opsmill/infrahub

    Analyzes recent CI failures on pull requests to identify flaky tests, using retry outcomes (failed attempt → green re-run) and cross-PR recurrence as evidence, and maintains a local longitudinal…

    531 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Audit Docs

    opsmill/infrahub

    Audits internal (dev/) and external (docs/) documentation completeness for a feature, subject, or set of existing docs, maps changes indicated by the user, across Infrahub's documentation layers…

    531 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Commit

    opsmill/infrahub

    Stages and commits the current changes onto a safe working branch, enforcing branch discipline and optionally pushing upstream.

    531 GitHub stars~2.8k tokensUpdated yesterday
    Auto-check: notes
  • A skill your agent uses when you've fixed a bug, added a feature, or made any user-facing change in a project that uses Towncrier and need to record it for the changelog — before committing or…

    531 GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed
  • Creating Issues

    opsmill/infrahub

    Turns a single feature idea, improvement, or bug into ONE well-structured GitHub issue.

    531 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Creating Prd

    opsmill/infrahub

    Synthesises the current conversation context into a Product Requirements Document and publishes it to GitHub (as a comment on a referenced issue, or a new issue).

    531 GitHub stars~4k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Neo4j Cypher Guide

What does Neo4j Cypher Guide do?

Comprehensive guide for writing modern Neo4j Cypher queries. Neo4j Cypher Guide is an agent skill from opsmill/infrahub. Comprehensive guide for writing modern Neo4j Cypher queries.

When should I use Neo4j Cypher Guide?

Neo4j Cypher Guide fits situations like: devOps & Cloud work in your project.

How do I install Neo4j Cypher Guide in Claude Code?

Run `npx skills add opsmill/infrahub --skill neo4j-cypher-guide -a claude-code`. Or copy the skill folder (.agents/skills/neo4j-cypher-guide in opsmill/infrahub) into .claude/skills/neo4j-cypher-guide in your project. Claude Code loads it when a task matches its description.

How do I install Neo4j Cypher Guide in Codex?

Run `npx skills add opsmill/infrahub --skill neo4j-cypher-guide -a codex`. Or copy the skill folder (.agents/skills/neo4j-cypher-guide in opsmill/infrahub) into .agents/skills/neo4j-cypher-guide in your project. Codex loads it when a task matches its description.

Can I use Neo4j Cypher Guide in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add opsmill/infrahub --skill neo4j-cypher-guide -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/neo4j-cypher-guide, .gemini/skills/neo4j-cypher-guide, .github/skills/neo4j-cypher-guide and .opencode/skills/neo4j-cypher-guide in your project.

What does Neo4j Cypher Guide need to run?

SKILL.md names no scripts, command-line tools or credentials: Neo4j Cypher Guide is instructions for the agent only.

Does Neo4j Cypher Guide access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Neo4j Cypher Guide safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Neo4j Cypher Guide use?

Neo4j Cypher Guide is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Neo4j Cypher Guide use?

About 1.8k tokens (SKILL.md is roughly 7.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Neo4j Cypher Guide?

Skills that share tags, products or a category with Neo4j Cypher Guide: Neo4j Aura Provisioning Skill (neo4j-contrib/neo4j-skills, 114 stars), Performing Cloud Asset Inventory With Cartography (mukul975/Anthropic-Cybersecurity-Skills, 34k stars), Cognee Docker Setup (topoteretes/cognee, 32k stars) and Using Graph Databases (ancoleman/ai-design-components, 526 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Neo4j Cypher Guide?

opsmill (a GitHub organization) maintains it in opsmill/infrahub, which has 531 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 8, 2026.

Source: opsmill/infrahub on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.