Skip to main content

skills-graph

A small library to persist, retrieve and evolve AI skills in Memgraph.

Part of the Context Graph family — usually wired into memgraph-context-graph so that skill usage across Claude Code / Codex sessions is recorded automatically. This README covers using it directly.

Graph Model

(:Skill {name, description, content, license, compatibility,
         allowed_tools, metadata, created_at, updated_at, source_path?})
(:Skill)-[:DEPENDS_ON]->(:Skill)
(:Session|:Agent)-[:USED_SKILL {first_access, last_access, access_count, actions}]->(:Skill)

USED_SKILL starts at the subagent's (:Agent) when actions-graph has created it, otherwise at a MERGE (:Session {session_id}) — skills-graph MERGEs the shared Session node it does not own (see the Context Graph map). source_path is set only when a skill is created by observing a local SKILL.md read.

Quick Start

from skills_graph import SkillGraph, Skill

# Connect (uses MEMGRAPH_URL, MEMGRAPH_USER, MEMGRAPH_PASSWORD env vars by default)
sg = SkillGraph()

# Prepare the database schema (constraints + indexes)
sg.setup()

# Store a skill.
# name: lowercase letters/digits/hyphens only, 1-64 chars, no leading/trailing/
# consecutive hyphens (an invalid name raises SkillValidationError).
sg.add_skill(
    Skill(
        name="memgraph-cypher",
        description="Writing Cypher queries for Memgraph",
        content="# Cypher for Memgraph\n\nUse MATCH, CREATE, MERGE ...",
    )
)

# Retrieve by name
skill = sg.get_skill("memgraph-cypher")

# Search
sg.search_by_name("memgraph")

# Dependencies
sg.add_dependency("advanced-cypher", "memgraph-cypher")
deps = sg.get_dependencies("advanced-cypher")

# List all
all_skills = sg.list_skills()

# Update
sg.update_skill("memgraph-cypher", content="updated content")

# Delete
sg.delete_skill("memgraph-cypher")

Memgraph Context Graph integration

Wire SkillGraphConnector into an AgentLink and skill usage is recorded automatically from any runtime adapter's event stream (Claude Code, Codex, OpenAI SDK):

from skills_graph import SkillGraph
from skills_graph.connector import SkillGraphConnector
from memgraph_context_graph import AgentLink
from memgraph_context_graph.adapters.claude import ClaudeAdapter

link = AgentLink()
link.add_connector(SkillGraphConnector(SkillGraph()))

adapter = ClaudeAdapter(link, session_id="s-1")
hooks = adapter.get_runtime_hooks()

Requires the memgraph-context-graph extra: pip install "skills-graph[memgraph-context-graph]".

The connector detects skill usage from TOOL_START/TOOL_END/MESSAGE events — direct tool names like get_skill, MCP-style names like mcp__skills__get_skill, and local reads of an Agent Skills definition (.../skills/<name>/SKILL.md), which covers runtimes where using a skill appears as a file read rather than a dedicated tool call. Search/list results that surface skill objects are also recorded through USED_SKILL.

Installation

pip install skills-graph
# or, for the connector:  pip install "skills-graph[memgraph-context-graph]"

Needs a running Memgraph (default bolt://localhost:7687):

docker run --rm -p 7687:7687 memgraph/memgraph

From a workspace checkout, uv sync installs it with its siblings.

Testing

uv run pytest tests/ -v

Metadata

Release files for skills-graph 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for skills-graph 0.2.2
File Size Uploaded Provenance Actions
skills_graph-0.2.2.tar.gz 19.1 kB Without provenance Details for skills_graph-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for skills-graph 0.2.2
File Interpreter ABI Platform Actions
skills_graph-0.2.2-py3-none-any.whl Python 3 none any Details for skills_graph-0.2.2-py3-none-any.whl

Total release size: 30.4 kB

Release files / skills_graph-0.2.2.tar.gz

Download URL skills_graph-0.2.2.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
60b117293c14985d56f87c7a360b68cedb0b46e9e3caa7b1fbac30dd4b019cac
BLAKE2b-256 checksum
How to use checksums
75f636304858610f72d2c2877634474e3fe923c4097fdb05abc682f273adb1d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / skills_graph-0.2.2-py3-none-any.whl

Download URL skills_graph-0.2.2-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b8f20fb8b598855dcf394f5252dac75d531a41d9456f746c78403b7e9999a62
BLAKE2b-256 checksum
How to use checksums
68835ca2868e36e43f122e3fabd56b14002aaa1eb8cdfdcc356f86958ad9fd74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for skills-graph 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page