agentleFS
wzpersonwzperson/graph-engineering-skills/skills/graph-engineering/SKILL.md

graph-engineering

Skill1 starsChanged 4 months agoMITView on GitHub

Guide for applying current (2025-2026) graph engineering practice when building software with AI agents: domain graphs as a maintained repo artifact, code knowledge graphs, GraphRAG-family retrieval, temporal knowledge-graph memory, and agent-orchestration-as-graphs. Use this skill whenever the user wants to start a new project with domain modeling, build or maintain a knowledge graph or ontology, add graph-based retrieval (GraphRAG/LightRAG) over documents, give an agent long-term memory, do impact analysis before changing code, or asks about "graph engineering", "knowledge graph", "ontology", "world model", "domain model", "GraphRAG", "context graph", 图工程, 知识图谱, 领域建模, or 图驱动开发 — even if they don't say the word "graph" explicitly, trigger this when they ask to "model the domain first" or "understand the domain before coding".

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 0 are common, 7 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the user asks what graph engineering *is*, or which approach fits their situation, read references/landscape.md — it maps the 2026 …

    line 42
  2. Very specific:

    Lightweight path (important): if the task is a small change to an existing project that already has a .graph/ directory — a bug fix, copy …

    line 46
  3. Distinctive:

    Never model an unfamiliar domain from your priors alone.

    line 55
  4. Distinctive:

    Search for: standard terminology of the domain, existing ontologies or industry schemas (schema.org, industry standards), how the top 2-3 …

    line 60
  5. Very specific:

    Write the findings to .graph/research.md as a domain dossier: key concepts with definitions, disputed/ambiguous terms, constraints, and a …

    line 66
  6. Distinctive:

    Keep it proportionate: a weekend tool needs a 20-line dossier.

    line 71
  7. Very specific:

    Create .graph/world.yaml from templates/world.yaml (a fully worked example is in examples/world.example.yaml — read it before writing your …

    line 76
  8. Very specific:

    Every entity/rule that came from research gets a source: field pointing to the dossier entry.

    line 96
  9. Distinctive:

    Before implementing ANY feature or change, answer these six questions explicitly — in the plan, in the PR description, or aloud to the user:

    line 101
  10. Very specific:

    Write nothing tool-specific into project artifacts: .graph/ is plain YAML/Markdown, so any agent (or human) can read it.

    line 137
  11. Distinctive:

    Don't build a graph database (Neo4j etc.) for a domain graph under ~200 nodes — files in git are strictly better: diffable, reviewable, no …

    line 144
  12. Distinctive:

    Don't run entity extraction over a whole corpus "to have a graph".

    line 146
  13. Very specific:

    Don't create a multi-agent orchestration graph when a single agent loop solves it — this is the field's own hardest-won lesson (see …

    line 148
  14. Distinctive:

    Don't let this skill turn a one-line fix into a ceremony.

    line 151

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Graph Engineering

<!-- 中文注释:本 skill 的核心立场 —— 图是被维护的工件,代码和上下文从图派生。 但不是所有任务都需要图:先分类,再选路线,小改动走轻量通道。 -->

You are helping build software where a graph is a maintained artifact, and code, context, and agent behavior derive from it. This is the durable core of what the field calls "graph engineering" as of 2026. The term itself is young and contested; what matters is the practice, which splits into four distinct problem families. Route first, then work.

Step 0 — Route the task

Classify what the user actually needs. Most tasks need exactly ONE of these families; do not build all four.

FamilySignal from the userWhere to go
A. Domain graph — model a business domain as source-of-truth for a project"new project", "model the domain", "领域建模", requirements docs, UGIOS-style workflowsThis file, Steps 1–4, plus references/domain-graph.md
B. Retrieval graph — answer questions over a document corpus"RAG over our docs", "GraphRAG", corpus QA, "global questions across many files"references/retrieval-and-memory.md
C. Memory graph — an agent that remembers across sessions"agent memory", "remember users", facts that change over timereferences/retrieval-and-memory.md
D. Orchestration graph — structure a multi-step agent system"multi-agent", "workflow", "pipeline of agents", LangGraphreferences/orchestration.md
E. Code graph — navigate/analyze an existing codebase"who calls this", "impact of changing X", large unfamiliar reporeferences/domain-graph.md § Code graphs

If the user asks what graph engineering is, or which approach fits their situation, read references/landscape.md — it maps the 2026 terminology (graph engineering, context graphs, world models, ontology) with sources.

Lightweight path (important): if the task is a small change to an existing project that already has a .graph/ directory — a bug fix, copy change, minor feature — do NOT rerun the full pipeline. Run only the six-question impact check in Step 3. If all six answers are "no", just make the change. A graph workflow that taxes every one-line fix will be abandoned; protecting the lightweight path is what keeps the graph alive.

Step 1 — Research before modeling (调研理解)

Never model an unfamiliar domain from your priors alone. Before creating any graph artifact:

  1. Use web search if available (Claude Code and Codex both may have it; if not, ask the user for source material instead — do not silently skip). Search for: standard terminology of the domain, existing ontologies or industry schemas (schema.org, industry standards), how the top 2-3 existing products in this space model the same concepts, and regulatory/business rules that constrain the domain.
  2. Interrogate what the user gave you — requirements docs, an existing codebase (reverse-engineer its implicit domain model), conversation history.
  3. Write the findings to .graph/research.md as a domain dossier: key concepts with definitions, disputed/ambiguous terms, constraints, and a source URL for every claim that came from the web. The dossier is what makes the graph auditable — a reviewer can trace every entity back to why it exists.

Keep it proportionate: a weekend tool needs a 20-line dossier; a compliance system needs a thorough one.

Step 2 — Build the domain graph

Create .graph/world.yaml from templates/world.yaml (a fully worked example is in examples/world.example.yaml — read it before writing your first graph; the example teaches more than the schema).

Modeling rules that current practice converged on (rationale in references/domain-graph.md):

  • Property-graph style, in plain YAML/Markdown — reviewable in a pull request, no graph database required. Reach for RDF/OWL only when you must interop with external ontologies.
  • Entities, relationships, events, rules, capabilities are the five node classes. Model events and decisions as first-class nodes, not just static entities — "why did X happen" queries are what make the graph worth having (this is the "context graph" insight: record decisions, not just objects).
  • Timestamps on facts that can change. For any relationship that can become false (employment, pricing, status), add valid_from / valid_to instead of deleting — supersede, don't erase (bi-temporal pattern from Graphiti/Zep).
  • Start minimal, evolve incrementally. A 15-node graph that the team actually updates beats a 300-node graph that rots. Add nodes when a real feature needs them.
  • Every entity/rule that came from research gets a source: field pointing to the dossier entry.

Step 3 — Graph-driven change (the six questions)

Before implementing ANY feature or change, answer these six questions explicitly — in the plan, in the PR description, or aloud to the user:

  1. New entity?
  2. New relationship?
  3. New event?
  4. New rule (business rule / invariant / permission)?
  5. New capability (something the system can now do)?
  6. Changed meaning of anything already in the graph?

Any "yes" → update .graph/world.yaml in the SAME change set as the code, and say which nodes changed. All "no" → the graph is untouched; implement directly. The graph updates with the code, never "later" — a stale graph is worse than no graph because agents will trust it.

Step 4 — Validate

  • Structural checks (run whenever the graph changes): every relationship endpoint names an existing entity; no duplicate IDs; every rule references at least one entity or relationship; every research-derived node has a source. references/domain-graph.md § Validation has a ready-to-adapt Python check script and CI wiring — put it in CI so the graph can't silently rot.
  • Review checklist (before calling a milestone done): use the yes/no checklist in references/domain-graph.md § Review. Answer each question with evidence, not vibes; "Architecture: ✓" is not a review.

Working across Claude Code and Codex

This skill follows the Agent Skills standard and runs unchanged in both tools:

  • Claude Code: ~/.claude/skills/graph-engineering/ (personal) or .claude/skills/ (project)
  • Codex: ~/.codex/skills/graph-engineering/ or the shared ~/.agents/skills/ location; invoke explicitly with $graph-engineering if it doesn't auto-trigger

Write nothing tool-specific into project artifacts: .graph/ is plain YAML/Markdown, so any agent (or human) can read it. Reference the graph from the project's AGENTS.md / CLAUDE.md with three lines: where the graph lives, the six-question rule, and where the dossier is.

What NOT to do

  • Don't build a graph database (Neo4j etc.) for a domain graph under ~200 nodes — files in git are strictly better: diffable, reviewable, no infra.
  • Don't run entity extraction over a whole corpus "to have a graph". Graphs are built to answer a class of questions; name the questions first.
  • Don't create a multi-agent orchestration graph when a single agent loop solves it — this is the field's own hardest-won lesson (see references/orchestration.md).
  • Don't let this skill turn a one-line fix into a ceremony. Lightweight path exists; use it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.