neo4j-ontology-skill
Author and validate Neo4j Ontology Graph Specification (ontology graph spec)
- 01GitHub stars
- 121
- 02Installs
- New
- 03Files scanned
- 4
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 1eb0182b058bb264… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
When to Use
- Authoring an ontology document (Neo4j Ontology Graph Specification) from a domain description
- Editing existing ontology YAML/JSON: nodes, relationships, properties, types, constraints, cardinality, extensions
- Validating an ontology document against the spec schema
When NOT to Use
- Cypher queries, or loading/applying an ontology into a database →
neo4j-cypher-skill(ontology Cypher procedures do not exist yet — later work there) - Generic graph modeling advice (node vs property vs label, anti-patterns, supernodes) →
neo4j-modeling-skill
Authoring Workflow
Step 1 — Gather domain intent
Identify what is being modeled: entity types (nodes), connections (relationships + direction), properties per element, identifying keys, mandatory fields, cardinality. If the domain or required shape is unclear, ask the user what is being modeled and which questions the ontology must answer. Do NOT guess a domain.
Step 2 — Draft the document
YAML or JSON per user preference; default YAML (more readable). Apply the Core Facts below. Load references/format-reference.md when anything beyond the minimal example is needed (full labels object, constraint objects, extensions, full data-type grammar).
Step 3 — Validate
# From the skill directory:
uv run scripts/validate.py <document.{yaml,yml,json}>
# From the repo root:
uv run neo4j-ontology-skill/scripts/validate.py <document.{yaml,yml,json}>
Exit 0 = valid · exit 1 = schema violations (one line per field path) · exit 2 = parse/read/fetch error. PEP 723 script — uv resolves deps (jsonschema, pyyaml) itself.
The validator fetches the schema live — nothing is vendored. Resolution order: --schema <path-or-url> (explicit, no fallback) → the document's own schema field when it is a URL → the published current alias → repo raw fallback (only when the published host is unreachable). The document's schema URL decides which version it validates against: set it to the published versioned URL of the version being authored (older versions validate against their published schema).
Step 4 — Fix and re-validate
Fix every reported error; re-run Step 3. Repeat until exit 0. Validation is MANDATORY — never present an ontology as done with a non-zero exit.
Core Facts
- Required root fields:
schema,id(unique ontology id string),version(STRING — user-defined revision label; quote it in YAML:version: "1"). Root rejects unknown fields (additionalProperties: false). schemavalue: a published versioned URL. Root key is plainschema, NOT$schema.- New document: fetch
https://neo4j.com/docs/ontology-graph-spec/current/schema.json, read its$id, write that versioned URL. Never write the/current/alias (it moves). - Existing document: keep its
schemaURL; change only when the user asks to upgrade, then re-validate. - Version tagged on GitHub but
/<version>/schema.jsonnot 200 → unpublished; don't use it.
- New document: fetch
nodes/relationshipsare maps keyed by LOCAL IDS, not labels/types. Label lives inlabelorlabels.identifier; relationship type lives intype. Endpoints reference node ids (from.node/to.node) — label renames never break references.label: Xis shorthand forlabels: {identifier: X}. Use the fulllabelsobject only whenimpliedoroptionallabels exist.- Type tokens come from the Neo4jType enum exactly — case-sensitive. Tokens incl.
STRING,INTEGER,FLOAT,BOOLEAN,DATE,DURATION,POINT,UUID; temporal tokens contain a space (ZONED DATETIME,LOCAL TIME); parameterized tokens use angle brackets (LIST<STRING>,VECTOR<FLOAT32>).UUIDandVECTOR<...>have no LIST arm. No unions, no nested lists.dimension(integer|null) sits on the property, paired with VECTOR types. - Constraints — two forms:
- Flags on a property:
key: true,unique: true,must_exist: true(snake_case — NOTmustExist). Single-property shorthands;key= unique + exists per Neo4j key-constraint semantics. - Object form:
constraintsis a MAP id → constraint object{type: EXISTS|KEY|PROPERTY_TYPE|UNIQUE, properties: [p1, ...], name: optional}— required for composites (≥ 2 properties) and nameable constraints.propertiesmust name properties declared on the SAME element.
- Flags on a property:
- Endpoint cardinality:
countexact, ormin_count/max_countranged; absent = unconstrained (0..*). - Extensions: fixed
extensionsshape per element — node:indexes/display/custom; relationship:indexes/custom; root:data_source_tables/data_source_mappings/custom; labels/property/constraint/index:customonly. Unknown extension keys rejected.customis free-form — arbitrary owner data, never validated by the spec schema. - Absent means none — never write empty maps/lists (
properties: {},aliases: [],custom: {}); omit them.
Minimal Example
library.ontology.yaml — 2 nodes, 1 relationship:
schema: "https://neo4j.com/docs/ontology-graph-spec/1.1.0/schema.json"
id: library
version: "1"
name: Library
nodes:
author:
label: Author
properties:
id: { type: STRING, key: true }
name: { type: STRING, must_exist: true }
book:
label: Book
properties:
isbn: { type: STRING, key: true }
relationships:
wrote:
type: WROTE
from: { node: author, max_count: 1 }
to: { node: book }
Validates exit 0 via scripts/validate.py. schema URL = newest published on 2026-11-02; apply the schema rule above rather than copying it. Full YAML+JSON worked examples in references/format-reference.md.
References
Load on demand:
- references/format-reference.md — full field reference: every node/relationship/property/endpoint field,
labelsobject, constraint objects, extension shapes, data-type grammar, gotchas, YAML+JSON examples - Published schema base:
https://neo4j.com/docs/ontology-graph-spec/— immutable/<version>/schema.jsonper spec version, moving alias/current/schema.json
Spec Status
Published: the ONT-31 URLs above are live and are the canonical schema source. If the published host is unreachable, the validator falls back to the raw schema from neo4j/ontology-graph-spec main (moving). Ontology Cypher procedures do not exist yet; applying an ontology to a database is out of scope here.
Checklist
- Root fields
schema,id,versionpresent;versiona quoted string;schema= published versioned URL (new document:$idof/current/schema.json; never/current/) under plainschemakey - No unknown root fields; no
$schema -
nodes/relationshipskeyed by local ids; relationshipfrom/toreference node ids - Every node has
labelorlabels.identifier - Type tokens exact from the Neo4jType enum (case-sensitive; spaced temporal tokens);
dimensionon the property with VECTOR types - Flags only for single-property constraints; object form (
type∈ EXISTS/KEY/PROPERTY_TYPE/UNIQUE) for composites/named; constraintpropertiesexist on the same element - Extension keys match the element's fixed shape; arbitrary data only under
custom - No empty maps/lists written
-
uv run scripts/validate.py <file>exits 0 (every reported error fixed and re-validated)
Files
4- README.md
e8356326c63.0 KB - SKILL.md
ccfcc8c0db8.0 KB - references/format-reference.md
b3cd59461014.9 KB - scripts/validate.py
f68fdefa4b6.6 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from neo4j-contrib/neo4j-skills8
Authoritative reference for the neo4j-agent-memory Python package — a graph-native memory system for AI agents built on Neo4j — and for the hosted service (NAMS) at memory.neo4jlabs.com. Use this skill whenever the user mentions neo4j-agent-memory, agent memory with Neo4j, context graphs, the POLE+O
Manages Neo4j Aura Agents via the v2beta1 REST API — create, list, get, update, delete,
Serverless Aura Graph Analytics (AGA) GDS Sessions — covers GdsSessions,
Provisions and manages Neo4j Aura instances via CLI (aura-cli v1.7+) or REST API.
Use when working with Neo4j command-line tools — neo4j-cli (modern unified
Generates, optimizes, and validates Cypher 25 queries for Neo4j 2025.x and 2026.x.
Ingests unstructured and semi-structured documents into Neo4j as a knowledge graph.
Neo4j .NET Driver v6 — IDriver lifecycle, DI registration (singleton), ExecutableQuery
Related methodology skillsscan passed
Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts, create page objects, configure test fixtures, set up reporters, add CI integration, implement API mocking, or perform visual regression testing. Trigger terms:
Install and use gstack in Capy and Claude Code. Load at session start to check this machine, and for gstack planning, code review, debugging, QA, design, security, documentation, and shipping workflows.
Publish and manage research papers on Hugging Face Hub. Supports creating paper pages, linking papers to models/datasets, claiming authorship, and generating professional markdown-based research articles.
Help developers new to Elasticsearch get from zero to a working search experience. Guide them through understanding their intent, mapping their data, and building a search experience with best practices baked in. Use this when the user shows intent to build search-related functionality, asks about E
Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.
Review workspace changes, PRs, commits, or branch comparisons with the host agent's model. OCR's CLI selects files and resolves rules; the host reviews them for defects and explains changes that affect users or callers. Use when the user has no separate API key for OCR or wants to reuse their coding