neo4j-getting-started-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Neo4j Getting-Started Skill

Neo4j 入门技能

Guide a user or agent from zero to a working Neo4j application by executing the 8 stages below in order.
At the start of each stage: read the corresponding
${CLAUDE_SKILL_DIR}/references/<stage-name>.md
file and follow its instructions. Only load the stage you are currently executing — not all at once.
"User" means both a human developer and an autonomous coding agent.

引导用户或Agent按以下8个阶段逐步完成从0到搭建可运行Neo4j应用的全流程。
每个阶段开始时:读取对应的
${CLAUDE_SKILL_DIR}/references/<stage-name>.md
文件并遵循其中的指令。仅加载当前正在执行的阶段——不要一次性加载所有阶段。
"用户"既指人类开发者,也指自主编码Agent。

Project Structure

项目结构

All generated code, data, scripts, queries, and notebooks must be written to the working directory so the user can inspect, reuse, and re-run them after the session ends. Never generate output only as text in the conversation — always write it to a file.
Organize files into this layout. Create subdirectories before writing files.
.env                    ← DB credentials (gitignored, loaded by python-dotenv)
aura.env                ← Aura API credentials (gitignored, never overwrite)
progress.md             ← stage-by-stage progress (this skill writes it)
requirements.txt        ← Python dependencies

schema/
  schema.json           ← graph model definition
  schema.cypher         ← DDL: constraints + indexes
  reset.cypher          ← wipe all data (keep schema)

data/
  generate.py           ← synthetic data generator  (DATA_SOURCE=synthetic)
  import.py             ← CSV/file importer          (DATA_SOURCE=csv or relational)
  *.csv                 ← any provided or generated data files

queries/
  queries.cypher        ← validated Cypher query library

scripts/
  provision_aura.py     ← Aura provisioning script (generated during provision stage)

notebook.ipynb          ← app artifact (root — standard jupyter convention)
app.py                  ← app artifact (root — streamlit run app.py)
main.py                 ← app artifact (root — uvicorn main:app)
graphrag_app.py         ← app artifact (root)
Root-level files (
.env
,
requirements.txt
, app code) stay at root because tooling expects them there. Everything else goes in the appropriate subfolder.

所有生成的代码、数据、脚本、查询和笔记本文件必须写入工作目录,以便用户在会话结束后可以检查、复用和重新运行。切勿仅在对话中以文本形式生成输出——务必写入文件。
按照以下布局组织文件。写入文件前先创建子目录。
.env                    ← 数据库凭证(已加入git忽略,由python-dotenv加载)
aura.env                ← Aura API凭证(已加入git忽略,切勿覆盖)
progress.md             ← 阶段式进度记录(本技能负责写入)
requirements.txt        ← Python依赖项

schema/
  schema.json           ← 图模型定义
  schema.cypher         ← DDL:约束 + 索引
  reset.cypher          ← 清空所有数据(保留模型)

data/
  generate.py           ← 合成数据生成器  (DATA_SOURCE=synthetic)
  import.py             ← CSV/文件导入器          (DATA_SOURCE=csv或relational)
  *.csv                 ← 任何提供或生成的数据文件

queries/
  queries.cypher        ← 已验证的Cypher查询库

scripts/
  provision_aura.py     ← Aura资源部署脚本(在部署阶段生成)

notebook.ipynb          ← 应用产物(根目录——遵循Jupyter标准约定)
app.py                  ← 应用产物(根目录——streamlit run app.py)
main.py                 ← 应用产物(根目录——uvicorn main:app)
graphrag_app.py         ← 应用产物(根目录)
根目录文件(
.env
requirements.txt
、应用代码)保留在根目录,因为工具链默认在此处查找。其余所有文件放入对应的子文件夹。

Progress Tracking

进度跟踪

The skill maintains
progress.md
in the working directory to support resumability.
On startup:
  1. Check if
    progress.md
    exists.
  2. If it exists, find the first pending stage:
    bash
    grep -B1 "^status: pending" progress.md | grep "^###" | head -1
  3. Resume from that stage. Read its context block (the key=value lines beneath the header) to restore
    DOMAIN
    ,
    USE_CASE
    ,
    NEO4J_URI
    , etc. — do not re-ask the user for information already recorded.
  4. For each completed stage, read every file listed in its
    files=
    line before proceeding. These files are the ground truth — do not reconstruct their content from memory.
    • schema/schema.json
      → re-read before model, load, query, or build stages
    • queries/queries.cypher
      → re-read before build stage
    • data/generate.py
      → re-read before import or reset
  5. If
    progress.md
    does not exist, start from
    0-prerequisites
    .
On stage completion — update (or create)
progress.md
:
  • If the stage's
    ###
    section already exists, update
    status: pending
    status: done
    and append any new key=value lines.
  • If the section doesn't exist, append it following the format below.
Format:
markdown
undefined
本技能在工作目录中维护
progress.md
文件,以支持任务续接。
启动时:
  1. 检查
    progress.md
    是否存在。
  2. 如果存在,找到第一个待处理阶段:
    bash
    grep -B1 "^status: pending" progress.md | grep "^###" | head -1
  3. 从该阶段恢复。读取其上下文块(标题下方的key=value行)以恢复
    DOMAIN
    USE_CASE
    NEO4J_URI
    等信息——不要重新询问用户已记录的信息。
  4. 在继续之前,读取每个已完成阶段
    files=
    行中列出的所有文件。这些文件是真实依据——不要凭记忆重构其内容。
    • schema/schema.json
      → 在模型、加载、查询或构建阶段前重新读取
    • queries/queries.cypher
      → 在构建阶段前重新读取
    • data/generate.py
      → 在导入或重置前重新读取
  5. 如果
    progress.md
    不存在,从
    0-prerequisites
    阶段开始。
阶段完成时 —— 更新(或创建)
progress.md
  • 如果该阶段的
    ###
    部分已存在,将
    status: pending
    更新为
    status: done
    并追加任何新的key=value行。
  • 如果该部分不存在,按照以下格式追加。
格式:
markdown
undefined

Neo4j Getting-Started — Progress

Neo4j Getting-Started — Progress

<!-- Resume: grep for "status: pending" to find the next stage -->
<!-- Resume: grep for "status: pending" to find the next stage -->

0-prerequisites

0-prerequisites

status: done
status: done

1-context

1-context

status: done DOMAIN=social USE_CASE=friend recommendations EXPERIENCE=beginner DB_TARGET=aura-free DATA_SOURCE=synthetic APP_TYPE=notebook EXEC_METHOD=query-api
status: done DOMAIN=social USE_CASE=friend recommendations EXPERIENCE=beginner DB_TARGET=aura-free DATA_SOURCE=synthetic APP_TYPE=notebook EXEC_METHOD=query-api

2-provision

2-provision

status: done NEO4J_URI=neo4j+s://abc123.databases.neo4j.io
status: done NEO4J_URI=neo4j+s://abc123.databases.neo4j.io

3-model

3-model

status: done labels=Person,Post relationships=FOLLOWS,POSTED constraints=2
status: done labels=Person,Post relationships=FOLLOWS,POSTED constraints=2

4-load

4-load

status: done nodes=200 Person, 50 Post relationships=1400 FOLLOWS, 300 POSTED
status: done nodes=200 Person, 50 Post relationships=1400 FOLLOWS, 300 POSTED

5-explore

5-explore

status: pending
status: pending

6-query

6-query

status: pending
status: pending

7-build

7-build

status: pending

---
status: pending

---

Execution Protocol

执行协议

For each stage:
  1. Announce the stage:
    "## Stage: <name> — <purpose>"
  2. Read
    ${CLAUDE_SKILL_DIR}/references/<name>.md
  3. Execute the instructions in that file
  4. Verify the stage's completion condition
  5. Update
    progress.md
    with
    status: done
    and stage-specific context
  6. Proceed to the next stage (HITL: pause for approval first)
If a stage fails, recover using the error guidance in the stage reference file. Do not skip stages unless the skip condition below explicitly permits it.

每个阶段执行步骤:
  1. 宣布当前阶段:
    "## Stage: <name> — <purpose>"
  2. 读取
    ${CLAUDE_SKILL_DIR}/references/<name>.md
  3. 执行该文件中的指令
  4. 验证阶段完成条件
  5. 更新
    progress.md
    ,设置
    status: done
    并添加阶段特定上下文
  6. 进入下一阶段(HITL模式:先暂停等待用户批准)
如果某个阶段失败,使用该阶段参考文件中的错误指导进行恢复。除非以下跳过条件明确允许,否则请勿跳过阶段。

Stages

阶段说明

Stages run in the numbered order shown. Each depends on the one before it completing successfully (except where a skip condition applies). Read the linked reference file when entering each stage.
0-prerequisites → 1-context → 2-provision → 3-model → 4-load → 5-explore → 6-query → 7-build
Shared capabilities used across multiple stages:
  • Cypher execution:
    ${CLAUDE_SKILL_DIR}/references/capabilities/execute-cypher.md
    (3 options;
    EXEC_METHOD
    chosen in
    context
    )
  • Cypher authoring rules:
    ${CLAUDE_SKILL_DIR}/references/capabilities/cypher-authoring.md
    (or defer to
    neo4j-cypher-authoring-skill
    )
  • MCP configuration:
    ${CLAUDE_SKILL_DIR}/references/capabilities/mcp-config.md
    (used in
    prerequisites
    and
    build
    )
  • Query validation:
    ${CLAUDE_SKILL_DIR}/scripts/validate_queries.py
    — batch-validate all queries in one call (used in
    query
    )

阶段按所示编号顺序运行。每个阶段依赖前一个阶段成功完成(除非适用跳过条件)。进入每个阶段时请阅读对应的参考文件。
0-prerequisites → 1-context → 2-provision → 3-model → 4-load → 5-explore → 6-query → 7-build
多个阶段共用的能力:
  • Cypher执行:
    ${CLAUDE_SKILL_DIR}/references/capabilities/execute-cypher.md
    (3种选项;
    EXEC_METHOD
    context
    阶段选择)
  • Cypher编写规则:
    ${CLAUDE_SKILL_DIR}/references/capabilities/cypher-authoring.md
    (或委托给
    neo4j-cypher-authoring-skill
  • MCP配置:
    ${CLAUDE_SKILL_DIR}/references/capabilities/mcp-config.md
    (用于
    prerequisites
    build
    阶段)
  • 查询验证:
    ${CLAUDE_SKILL_DIR}/scripts/validate_queries.py
    —— 批量验证所有查询(用于
    query
    阶段)

0 —
prerequisites

0 —
prerequisites

Purpose: Verify and install required CLI tools before doing anything else.
Reference:
${CLAUDE_SKILL_DIR}/references/0-prerequisites.md

Completes when:
neo4j-mcp
binary is reachable;
.gitignore
has
.env
entry.
Never skip.

目标:在开始其他操作前,验证并安装所需的CLI工具。
参考文件
${CLAUDE_SKILL_DIR}/references/0-prerequisites.md

完成条件
neo4j-mcp
二进制文件可访问;
.gitignore
包含
.env
条目。
切勿跳过。

1 —
context

1 —
context

Purpose: Collect domain, use-case, experience, infrastructure target, data source, and output type. Detect
EXEC_METHOD
for Cypher execution.
Reference:
${CLAUDE_SKILL_DIR}/references/1-context.md

Completes when:
DOMAIN
,
USE_CASE
,
EXPERIENCE
,
DB_TARGET
,
DATA_SOURCE
,
APP_TYPE
,
EXEC_METHOD
are known.
Skip condition: all variables already provided in conversation context.

目标:收集领域、用例、经验水平、基础设施目标、数据源和输出类型。检测Cypher执行的
EXEC_METHOD

参考文件
${CLAUDE_SKILL_DIR}/references/1-context.md

完成条件
DOMAIN
USE_CASE
EXPERIENCE
DB_TARGET
DATA_SOURCE
APP_TYPE
EXEC_METHOD
均已确定。
跳过条件:所有变量已在对话上下文中提供。

2 —
provision

2 —
provision

Purpose: Provision a running Neo4j database and save credentials to
.env
.
Reference:
${CLAUDE_SKILL_DIR}/references/2-provision.md

Completes when:
.env
exists with
NEO4J_URI/USERNAME/PASSWORD/DATABASE
; connectivity verified.
Skip condition:
DB_TARGET=existing
→ write
.env
from user credentials, proceed to
3-model
.

目标:部署运行中的Neo4j数据库并将凭证保存到
.env

参考文件
${CLAUDE_SKILL_DIR}/references/2-provision.md

完成条件
.env
文件存在,包含
NEO4J_URI/USERNAME/PASSWORD/DATABASE
;已验证连接性。
跳过条件
DB_TARGET=existing
→ 从用户凭证写入
.env
,直接进入
3-model
阶段。

3 —
model

3 —
model

Purpose: Design or discover a graph data model suited to the use-case.
Reference:
${CLAUDE_SKILL_DIR}/references/3-model.md

Completes when:
schema.json
and
schema.cypher
written.
Skip condition:
DATA_SOURCE=demo
→ use demo schema, proceed to
4-load
.
HITL checkpoint (HITL mode only — skip entirely in autonomous mode): show model draft, wait for approval.

目标:设计或发现适合该用例的图数据模型。
参考文件
${CLAUDE_SKILL_DIR}/references/3-model.md

完成条件:已写入
schema.json
schema.cypher

跳过条件
DATA_SOURCE=demo
→ 使用演示模型,直接进入
4-load
阶段。
HITL检查点(仅HITL模式——自主模式下完全跳过):展示模型草稿,等待用户批准。

4 —
load

4 —
load

Purpose: Apply schema constraints, then import data (demo, synthetic, CSV, or documents).
Reference:
${CLAUDE_SKILL_DIR}/references/4-load.md

Depends on:
3-model
(constraints must exist before import).
Completes when: node count ≥ 50;
import/
scripts written;
reset.cypher
written.

目标:应用模型约束,然后导入数据(演示数据、合成数据、CSV或文档)。
参考文件
${CLAUDE_SKILL_DIR}/references/4-load.md

依赖
3-model
(导入前必须存在约束)。
完成条件:节点数≥50;已写入
import/
脚本;已写入
reset.cypher

5 —
explore

5 —
explore

Purpose: Deliver a visual entry point to the graph — the "it clicks" moment.
Reference:
${CLAUDE_SKILL_DIR}/references/5-explore.md

Completes when: browser URL printed to user, or notebook visualization cell added.
Hard gate — never skip.

目标:提供图的可视化入口点——即“豁然开朗”的时刻。
参考文件
${CLAUDE_SKILL_DIR}/references/5-explore.md

完成条件:已向用户打印浏览器URL,或已添加笔记本可视化单元格。
硬性要求——切勿跳过。

6 —
query

6 —
query

Purpose: Generate and validate a Cypher query library for the use-case.
Reference:
${CLAUDE_SKILL_DIR}/references/6-query.md

Completes when:
queries.cypher
has ≥5 queries; ≥2 traversals; ≥3 return results.

目标:为该用例生成并验证Cypher查询库。
参考文件
${CLAUDE_SKILL_DIR}/references/6-query.md

完成条件
queries.cypher
包含≥5个查询;≥2个遍历查询;≥3个查询返回结果。

7 —
build

7 —
build

Purpose: Generate a runnable application, dashboard, notebook, or agent integration.
Reference:
${CLAUDE_SKILL_DIR}/references/7-build.md

Completes when: artifact exists, passes syntax check, returns non-empty use-case results.

目标:生成可运行的应用、仪表板、笔记本或Agent集成。
参考文件
${CLAUDE_SKILL_DIR}/references/7-build.md

完成条件:产物存在,通过语法检查,返回非空的用例结果。

Success Gates (all 7 required)

成功校验(需全部满足)

GateStageCondition
db_running
provision
driver.verify_connectivity()
succeeds
model_valid
model≥2 node labels, ≥1 rel type, ≥1 constraint in DB
data_present
load
MATCH (n) RETURN count(n)
≥ 50
queries_work
query≥5 queries; ≥2 traversals; ≥3 return ≥1 result
graph_visible
exploreBrowser URL or notebook viz delivered to user
app_generated
buildArtifact exists, passes syntax, returns non-empty results
integration_ready
buildMCP config or agent framework code present (if requested)

校验项对应阶段条件
db_running
provision
driver.verify_connectivity()
执行成功
model_valid
model数据库中存在≥2个节点标签、≥1种关系类型、≥1个约束
data_present
load
MATCH (n) RETURN count(n)
结果≥50
queries_work
query≥5个查询;≥2个遍历查询;≥3个查询返回≥1条结果
graph_visible
explore已向用户提供浏览器URL或笔记本可视化内容
app_generated
build产物存在,通过语法检查,返回非空结果
integration_ready
build存在MCP配置或Agent框架代码(如果已请求)

Fast Paths

快速路径

SituationAction
DB_TARGET=existing
Skip
provision
; write
.env
from user creds; go to
model
DATA_SOURCE=demo
Skip custom modeling; use demo schema; jump to
load
DB_TARGET=existing
+ data present
Skip
provision
,
model
,
load
; introspect schema; go to
explore

场景操作
DB_TARGET=existing
跳过
provision
;从用户凭证写入
.env
;进入
model
阶段
DATA_SOURCE=demo
跳过自定义建模;使用演示模型;直接进入
load
阶段
DB_TARGET=existing
+ 已有数据
跳过
provision
model
load
;自动检测模型;进入
explore
阶段

HITL vs Autonomous Mode

HITL vs 自主模式

HITL (conversational): pause after
model
for model review; pause after
load
for data review.
Autonomous (CI-like, all context provided upfront): never pause for approval at any stage; auto-approve all decisions; proceed immediately through all 8 stages; print browser URL to stdout; target ≤15 min from DB running.
How to detect autonomous mode — check at the start of stage 1:
Autonomous if ANY of the following are true:
  • The initial prompt contains all of:
    DOMAIN
    ,
    USE_CASE
    ,
    EXPERIENCE
    ,
    DB_TARGET
    ,
    DATA_SOURCE
    ,
    APP_TYPE
    (or equivalent phrasing like "Domain: X, use-case: Y, ...")
  • The session was started with
    --auto-approve
    or similar non-interactive flag
  • All context variables are already recorded in
    progress.md
    (resuming an autonomous run)
HITL if: the user opened a fresh conversation without providing full context upfront.
In autonomous mode: every HITL checkpoint in every stage reference file is automatically skipped. Do not ask for approval. Do not say "does this look right?" Do not pause. Continue to the next step immediately.

HITL(对话式):在
model
阶段后暂停等待模型审核;在
load
阶段后暂停等待数据审核。
自主模式(类CI,所有上下文提前提供):任何阶段都不暂停等待批准;自动批准所有决策;立即执行完所有8个阶段;向标准输出打印浏览器URL;目标是数据库运行后≤15分钟完成。
如何检测自主模式——在阶段1开始时检查:
满足以下任一条件即为自主模式:
  • 初始提示包含所有以下内容:
    DOMAIN
    USE_CASE
    EXPERIENCE
    DB_TARGET
    DATA_SOURCE
    APP_TYPE
    (或等效表述,如“Domain: X, use-case: Y, ...”)
  • 会话通过
    --auto-approve
    或类似非交互标志启动
  • 所有上下文变量已记录在
    progress.md
    中(恢复自主运行任务)
HITL模式:用户发起新对话但未提前提供完整上下文。
自主模式下:所有阶段参考文件中的HITL检查点均自动跳过。 请勿请求批准。请勿询问“这样看起来对吗?”。请勿暂停。立即进入下一步。

Final Summary (deliver after all gates pass)

最终总结(所有校验项通过后提供)

Step 1 — write
README.md
to the working directory using the template below. Fill in every
<placeholder>
from
progress.md
and the actual generated files. This is a required output — do not skip it.
IMPORTANT — portable commands: All re-run commands in README.md MUST use
python3
(never an absolute path like
/opt/homebrew/bin/python3.14
or
/usr/local/bin/python3
). The README is shared with others who have different Python installs.
markdown
undefined
步骤1 —— 将
README.md
写入工作目录
,使用以下模板。从
progress.md
和实际生成的文件中填充所有
<placeholder>
。这是必填输出——请勿跳过。
重要——可移植命令:README.md中的所有重新运行命令必须使用
python3
(绝对路径如
/opt/homebrew/bin/python3.14
/usr/local/bin/python3
绝不允许)。README会分享给其他拥有不同Python安装环境的用户。
markdown
undefined

<DOMAIN> Graph — <USE_CASE>

<DOMAIN> Graph — <USE_CASE>

A synthetic <DOMAIN> graph built with Neo4j, covering <USE_CASE>. Generated by the neo4j-getting-started-skill on <date>.
使用Neo4j构建的合成<DOMAIN>图,覆盖<USE_CASE>场景。 由neo4j-getting-started-skill于<date>生成。

What's in the graph

图中包含内容

LabelCountDescription
<Label><N><one line>
Relationships: <TYPE1>, <TYPE2>, ...
Constraints: <N> uniqueness constraints applied
标签数量描述
<Label><N><单行描述>
关系类型: <TYPE1>, <TYPE2>, ...
约束: 已应用<N>个唯一性约束

Explore visually

可视化探索

Open in Neo4j Browser: <browser_url>
Use
NEO4J_PASSWORD
from
.env
to connect, then run:
cypher
// Starter query — shows the full graph sample
MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 50
在Neo4j Browser中打开: <browser_url>
使用
.env
中的
NEO4J_PASSWORD
连接,然后运行:
cypher
// 入门查询——显示完整图样本
MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 50

Files

文件说明

FilePurposeRe-run
schema/schema.json
Graph model
schema/schema.cypher
Constraints + indexes
source .env && cypher-shell -a $NEO4J_URI -u $NEO4J_USERNAME -p $NEO4J_PASSWORD --file schema/schema.cypher
schema/reset.cypher
Wipe data, keep schema
source .env && cypher-shell -a $NEO4J_URI -u $NEO4J_USERNAME -p $NEO4J_PASSWORD --file schema/reset.cypher
data/generate.py
Regenerate synthetic data
source .venv/bin/activate && python3 data/generate.py
data/import.py
Re-import CSVs into Neo4j
source .venv/bin/activate && python3 data/import.py
queries/queries.cypher
Query libraryPaste into Neo4j Browser
<artifact>
<app type>
<run command>
requirements.txt
Python dependencies
source .venv/bin/activate && pip install -r requirements.txt
(Omit
data/generate.py
row when
DATA_SOURCE=csv
; omit
data/import.py
row when
DATA_SOURCE=synthetic
.)
文件用途重新运行命令
schema/schema.json
图模型定义
schema/schema.cypher
约束 + 索引
source .env && cypher-shell -a $NEO4J_URI -u $NEO4J_USERNAME -p $NEO4J_PASSWORD --file schema/schema.cypher
schema/reset.cypher
清空数据,保留模型
source .env && cypher-shell -a $NEO4J_URI -u $NEO4J_USERNAME -p $NEO4J_PASSWORD --file schema/reset.cypher
data/generate.py
重新生成合成数据
source .venv/bin/activate && python3 data/generate.py
data/import.py
将CSV重新导入Neo4j
source .venv/bin/activate && python3 data/import.py
queries/queries.cypher
查询库粘贴到Neo4j Browser中运行
<artifact>
<应用类型>
<运行命令>
requirements.txt
Python依赖项
source .venv/bin/activate && pip install -r requirements.txt
(当
DATA_SOURCE=csv
时省略
data/generate.py
行;当
DATA_SOURCE=synthetic
时省略
data/import.py
行。)

Run the app

运行应用

bash
python3 -m venv .venv     # skip if .venv already exists
source .venv/bin/activate
pip install -r requirements.txt
<run command>
<For FastAPI only — include this section:> Open http://localhost:8000/docs for the interactive API docs.
<For MCP integration — include this section when APP_TYPE includes mcp:>
bash
python3 -m venv .venv     # 如果.venv已存在则跳过
source .venv/bin/activate
pip install -r requirements.txt
<run command>
<仅FastAPI需包含此部分:> 打开http://localhost:8000/docs查看交互式API文档。
<当APP_TYPE包含mcp时需包含此部分:>

MCP integration

MCP集成

To query your graph directly from Claude:
Claude Code — copy
mcp-claude-code.json
into
.claude/settings.json
:
bash
cp mcp-claude-code.json .claude/settings.json
Then reload Claude Code (
/reload
or restart). Ask: "What node labels are in my Neo4j database?"
Claude Desktop — merge
mcp-claude-desktop.json
into
~/Library/Application Support/Claude/claude_desktop_config.json
, then restart Claude Desktop.
Available MCP tools:
get-schema
,
read-cypher
,
write-cypher
.
要直接从Claude查询你的图:
Claude Code —— 将
mcp-claude-code.json
复制到
.claude/settings.json
bash
cp mcp-claude-code.json .claude/settings.json
然后重新加载Claude Code(
/reload
或重启)。提问:"我的Neo4j数据库中有哪些节点标签?"
Claude Desktop —— 将
mcp-claude-desktop.json
合并到
~/Library/Application Support/Claude/claude_desktop_config.json
,然后重启Claude Desktop。
可用MCP工具:
get-schema
,
read-cypher
,
write-cypher

Reset and reload

重置与重新加载

bash
source .env
cypher-shell -a $NEO4J_URI -u $NEO4J_USERNAME -p $NEO4J_PASSWORD --file schema/reset.cypher
source .venv/bin/activate
python3 data/generate.py   # or skip if using your own CSVs
python3 data/import.py
bash
source .env
cypher-shell -a $NEO4J_URI -u $NEO4J_USERNAME -p $NEO4J_PASSWORD --file schema/reset.cypher
source .venv/bin/activate
python3 data/generate.py   # 如果使用自定义CSV则跳过
python3 data/import.py

Sample queries

示例查询

cypher
// <use-case-specific query 1 — fill in from queries/queries.cypher>
<query>

// <use-case-specific query 2>
<query>
(Cypher comments use
//
, not
--
.)
cypher
// <用例特定查询1 —— 从queries/queries.cypher中填充>
<query>

// <用例特定查询2>
<query>
(Cypher注释使用
//
,而非
--
。)

Next steps

下一步

  • Explore GraphAcademy to deepen your Neo4j knowledge
  • Edit
    data/*.csv
    to change the dataset, then re-run
    data/import.py
  • Extend the model: add new node labels or relationship types in
    schema/schema.json

**Step 2 — print this to the conversation:**
✓ Neo4j Getting-Started — Complete
Database: <NEO4J_URI> Browser: https://browser.neo4j.io/?connectURL=<encoded>
── What was generated (keep these files) ─────────────────────── schema/schema.json Graph model definition schema/schema.cypher Re-apply constraints/indexes: cypher-shell ... --file schema/schema.cypher schema/reset.cypher Wipe data, keep schema: cypher-shell ... --file schema/reset.cypher data/generate.py Regenerate synthetic data: source .venv/bin/activate && python3 data/generate.py data/*.csv Source data files — edit to change the dataset data/import.py Re-import from CSVs: source .venv/bin/activate && python3 data/import.py queries/queries.cypher Query library — paste into Neo4j Browser or run with cypher-shell <app-file> <run-command> requirements.txt Install deps: source .venv/bin/activate && pip install -r requirements.txt
── Gates ─────────────────────────────────────────────────────── db_running ✓ model_valid ✓ data_present ✓ queries_work ✓ graph_visible ✓ app_generated ✓ integration_ready ✓/–
── Next steps ──────────────────────────────────────────────────
  • Explore: open the Browser URL → run MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 50
  • Iterate: edit data/*.csv → source .venv/bin/activate && python3 data/import.py (reset first)
  • Learn: https://graphacademy.neo4j.com

Omit lines that don't apply (e.g. omit `data/import.py` when `DATA_SOURCE=synthetic`,
omit `data/generate.py` when `DATA_SOURCE=csv`).
  • 探索GraphAcademy以深化Neo4j知识
  • 编辑
    data/*.csv
    以更改数据集,然后重新运行
    data/import.py
  • 扩展模型:在
    schema/schema.json
    中添加新的节点标签或关系类型

**步骤2 —— 将以下内容打印到对话中:**
✓ Neo4j 入门流程 —— 完成
数据库: <NEO4J_URI> 浏览器: https://browser.neo4j.io/?connectURL=<encoded>
── 已生成的文件(请保留这些文件) ─────────────────────── schema/schema.json 图模型定义 schema/schema.cypher 重新应用约束/索引: cypher-shell ... --file schema/schema.cypher schema/reset.cypher 清空数据,保留模型: cypher-shell ... --file schema/reset.cypher data/generate.py 重新生成合成数据: source .venv/bin/activate && python3 data/generate.py data/*.csv 源数据文件——编辑可更改数据集 data/import.py 从CSV重新导入: source .venv/bin/activate && python3 data/import.py queries/queries.cypher 查询库——粘贴到Neo4j Browser或用cypher-shell运行 <app-file> <运行命令> requirements.txt 安装依赖: source .venv/bin/activate && pip install -r requirements.txt
── 校验项 ─────────────────────────────────────────────────────── db_running ✓ model_valid ✓ data_present ✓ queries_work ✓ graph_visible ✓ app_generated ✓ integration_ready ✓/–
── 下一步 ──────────────────────────────────────────────────
  • 探索: 打开浏览器URL → 运行MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 50
  • 迭代: 编辑data/*.csv → source .venv/bin/activate && python3 data/import.py(先重置)
  • 学习: https://graphacademy.neo4j.com

省略不适用的行(例如,当`DATA_SOURCE=synthetic`时省略`data/import.py`行,当`DATA_SOURCE=csv`时省略`data/generate.py`行)。