agentleFS
mmccallammccalla/coding-agent-skill-library/skills/knowledge-graph-rag/SKILL.md

knowledge-graph-rag

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Builds, refactors and hardens Neo4j-native KG-enabled RAG with LangGraph, hybrid retrieval, text-to-Cypher, and provenance. Use when implementing GraphRAG, graph-backed retrieval, or guarded text-to-Cypher pipelines.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when building, refactoring, reviewing or hardening Neo4j-native GraphRAG or KG-enabled RAG systems that require graph-aware …

    line 14
  2. Very specific:

    Do not use it for generic document RAG, vector-only retrieval, or ontology-only design work where knowledge-retrieval-rag or …

    line 16
  3. Very specific:

    Use reference/implementation-lifecycle.md for ingestion, resolution, retrieval, LangGraph orchestration, evaluation, security guardrails, …

    line 27
  4. Very specific:

    Use reference/code-patterns.md only when concrete schemas, Cypher, retriever or evaluator patterns are needed.

    line 28
  5. Very specific:

    Use reference/testing-contract.md before claiming implementation, refactor or hardening work is complete.

    line 29
  6. Very specific:

    Use reference/metadata.yaml when stack defaults, activation keywords or audience metadata are needed.

    line 30
  7. Distinctive:

    Prefer Neo4j-native graph, full-text and vector indexes unless an ADR justifies another store.

    line 34
  8. Very specific:

    Use deterministic identifiers, MERGE/upsert semantics and transaction boundaries for repeatable ingestion.

    line 35
  9. Distinctive:

    Never expose raw database metadata, embeddings, audit fields or unrestricted schema details directly to an LLM.

    line 36
  10. Distinctive:

    Keep responsibilities separated: configuration, domain models, ingestion, graph persistence, retrieval, orchestration, generation, …

    line 43

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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

KG-Enabled RAG

When to use

Use this skill when building, refactoring, reviewing or hardening Neo4j-native GraphRAG or KG-enabled RAG systems that require graph-aware retrieval, provenance-first ingestion, guarded text-to-Cypher, conceptual schema control or graph-backed answer generation.

Do not use it for generic document RAG, vector-only retrieval, or ontology-only design work where knowledge-retrieval-rag or ontology-and-knowledge-graph-modeling is sufficient.

Objective

Implement Neo4j-native KG-enabled RAG with provenance-first ingestion, guarded retrieval, grounded answers, and tests.

Procedure

  1. Inspect the repository for existing graph, retrieval, LLM, prompt, evaluation, Neo4j, LangGraph, Pydantic, FastAPI and OpenTelemetry conventions.
  2. Apply the non-negotiable invariants from reference/implementation-lifecycle.md: Neo4j-native storage by default, idempotent writes, curated conceptual schema, structured LLM outputs, evidence links and guarded Cypher.
  3. Align to the smallest useful vertical slice rather than replacing the repository architecture wholesale.
  4. Use reference/implementation-lifecycle.md for ingestion, resolution, retrieval, LangGraph orchestration, evaluation, security guardrails, done criteria and anti-patterns.
  5. Use reference/code-patterns.md only when concrete schemas, Cypher, retriever or evaluator patterns are needed.
  6. Use reference/testing-contract.md before claiming implementation, refactor or hardening work is complete.
  7. Use reference/metadata.yaml when stack defaults, activation keywords or audience metadata are needed.

Non-negotiable invariants

  • Prefer Neo4j-native graph, full-text and vector indexes unless an ADR justifies another store.
  • Use deterministic identifiers, MERGE/upsert semantics and transaction boundaries for repeatable ingestion.
  • Never expose raw database metadata, embeddings, audit fields or unrestricted schema details directly to an LLM.
  • Validate all LLM outputs with typed schemas and reject, repair or quarantine invalid extractions.
  • Link every decision-relevant fact, relationship, claim, summary, answer and evaluation result to source evidence.
  • Parameterise Cypher and default user-facing text-to-Cypher to read-only, bounded queries.

Recommended architecture

Keep responsibilities separated: configuration, domain models, ingestion, graph persistence, retrieval, orchestration, generation, evaluation, observability, security, API and CLI. API layers should not contain business logic.

Reference files

  • reference/metadata.yaml — version, audience, activation keywords and default stack metadata.
  • reference/implementation-lifecycle.md — detailed invariants, repository architecture, lifecycle steps, security guardrails, done criteria and anti-patterns.
  • reference/code-patterns.md — conceptual schema config, Pydantic extraction models, idempotent Neo4j persistence, local/global search and evaluator examples.
  • reference/testing-contract.md — required unit, integration, end-to-end and evaluation tests.

Related skills

  • knowledge-retrieval-rag — generic document-grounded RAG patterns.
  • ontology-and-knowledge-graph-modeling — semantic modelling and competency questions.
  • data-lineage-and-provenance — traceability for graph facts, retrieval evidence and generated answers.
  • guardrails-safety-patterns — validation, policy and tool-use controls.
  • evaluation-and-monitoring — retrieval, answer and operational quality measurement.

References

Verification

  • Relevant reference files were loaded for the task scope.
  • Files changed reported.
  • Commands and validations run with results stated.
  • Behaviour intentionally changed described.
  • Assumptions and residual risks or follow-up work stated.

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.