huaweicloud/huaweicloud-skills

huawei-cloud-ges-graph

Provides access guide for Huawei Cloud Graph Database GES service.

Voir la source

Mode d’emploi

  1. Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
  2. Consultez le document original pour les outils, identifiants et environnements requis.
  3. Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-ges-graph

Avant de commencer

  • L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
  • Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

⚠️ Execution Method (Must Read): This skill executes queries via local Python or Node.js scripts under `scripts/`. Using direct API calls is prohibited. - Query scripts are located under the skill directory scripts/ (e.g., scripts/ges_graph_skill.py) - All scripts and environment check scripts are inside the skill package. You must use `skill action=exec` to execute them; do not run them directly in the shell - Prefer inline execution (python -c or node -e) over creating temporary script files. See "Inline Execution (No Temp Files)" section below. - All paths are relative to the skill directory, which is the directory where this SKILL.md resides

GES Graph Access Guidance

Overview

Huawei Cloud Graph Engine Service (GES) persistent edition atomic capability, providing access guide for graph database operations. Covers Cypher queries, GQL queries, schema/label management, summary info queries, graph data editing and other core capabilities.

Directory Structure

The directory conventions are as follows (all paths are relative to the skill directory):

  1. scripts/ - Contains the Python and Node.js execution scripts
  • ges_graph_skill.py - Python SDK for GES graph operations
  • ges_graph_skill.js - Node.js SDK for GES graph operations
  1. references/ - Contains documentation and configuration examples
  • ges_env.csv.example - Environment configuration template

Prerequisites

Before using this skill, ensure the following conditions are met:

1. Runtime Environment

Supports Python or Node.js runtime. Requires Python 3.8+ or Node.js 14+.

2. Graph Instance Configuration

This skill supports both environment variables and configuration files. Environment variables take precedence over configuration files.

Environment Variables and Parameters

Environment VariableDescriptionRequired
GES_GRAPH_IPGES service IPYes
GES_GRAPH_PORTGES service portYes
GES_PROJECT_IDProject IDYes
GES_GRAPH_NAMEGraph nameYes
GES_IAM_URLIAM service URLYes
GES_REGIONRegionYes
HUAWEI_CLOUD_AKAccess KeyYes*
HUAWEI_CLOUD_SKSecret KeyYes*
GES_USERNAMEUsernameConditional**
GES_PASSWORDPasswordConditional**
GES_DOMAIN_NAMEDomain nameConditional**
GES_TOKENToken (highest priority)Optional
AK/SK required for AKSK authentication. Username/password conditionally required* when AKSK is not available.

Configuration File (`.env/ges_env.csv`)

Config file path: .env/ges_env.csv

Config ItemDescriptionRequiredExample Value
graph_ipGES service IPYes100.95.xxx.xxx
graph_portGES service portYes80
project_idProject IDYesyourprojectid
graph_nameGraph nameYesyourgraphname
iam_urlIAM service URLYes(see region table below)
access_keyAccess KeyYes*youraccesskey
secret_keySecret KeyYes*yoursecretkey
usernameUsernameConditional**your_username
passwordPasswordConditional**your_password
domain_nameDomain nameConditional**yourdomainname
regionRegionYescn-north-4
access_key/secret_key required for AKSK authentication. username/password/domain_name conditionally required* when AKSK is not available.

IAM URLs by Region

RegionURLprotocol
cn-north-4iam.cn-north-4.myhuaweicloud.com/v3/auth/tokensHTTPS
ap-southeast-1iam.ap-southeast-1.myhuaweicloud.com/v3/auth/tokensHTTPS

Three methods are supported (priority from high to low):

  1. Environment variable GES_TOKEN
  2. AKSK method (HUAWEI_CLOUD_AK + HUAWEI_CLOUD_SK or access_key + secret_key)
  3. Password method (username + password + domain_name)

⛔ Prohibited Operations (Safety Guardrail)

This skill prohibits the following operations:
Prohibited OperationDescriptionReason
❌ Printing sensitive credentialsPrinting AK/SK, password, token, or other sensitive informationRisk of sensitive information leakage
The following high-risk operations require explicit agent confirmation before execution:
High-Risk OperationDescriptionConfirmation Prompt
⚠️ Clearing all graph dataclear_graph() or similar clear operations"Are you sure you want to clear all data in the graph? This operation is irreversible."
⚠️ Batch deleting nodes/edgesUnconditional bulk deletion of all nodes or edges"Are you sure you want to batch delete all nodes/edges? This operation is irreversible."
If a user requests any of the above high-risk operations, explicit confirmation must be obtained: "This is a high-risk operation and requires your explicit confirmation. Please reply with 'confirm' to proceed."

Cypher and GQL Query Languages

GES supports two query languages: Cypher (Neo4j-compatible) and GQL (international standard graph query language).

Cypher Usage

Python:

python
# Execute a Cypher query
result = skill.execute_query("MATCH (n) RETURN n LIMIT 10")

# Create a node (_ID_ is used only during creation to set a custom ID)
result = skill.execute_query(
    "CREATE (n:Person {_ID_: 'p001', name: '张三'}) RETURN n"
)

# Match query
result = skill.execute_query(
    "MATCH (n:Person)-[:KNOWS]->(m) WHERE n.name = '张三' RETURN m"
)

# Update a node (match via id() function)
result = skill.execute_query(
    "MATCH (n) WHERE id(n) = 123 SET n.name = '李四' RETURN n"
)

# Delete a node
result = skill.execute_query(
    "MATCH (n) WHERE id(n) = 123 DETACH DELETE n"
)

# Aggregate query
result = skill.execute_query(
    "MATCH (n:Person) RETURN n.city, count(*) as cnt ORDER BY cnt DESC"
)

Node.js:

javascript
const { GESGraphSkill } = require('./ges_graph_skill.js');
const skill = new GESGraphSkill();

// Execute a Cypher query
const result = await skill.executeQuery("MATCH (n) RETURN n LIMIT 10");

// Create a node (_ID_ is used only during creation to set a custom ID)
const result = await skill.executeQuery(
    "CREATE (n:Person {_ID_: 'p001', name: '张三'}) RETURN n"
);

// Match query
const result = await skill.executeQuery(
    "MATCH (n:Person)-[:KNOWS]->(m) WHERE n.name = '张三' RETURN m"
);

// Update a node
const result = await skill.executeQuery(
    "MATCH (n) WHERE id(n) = 123 SET n.name = '李四' RETURN n"
);

// Delete a node
const result = await skill.executeQuery(
    "MATCH (n) WHERE id(n) = 123 DETACH DELETE n"
);

// Aggregate query
const result = await skill.executeQuery(
    "MATCH (n:Person) RETURN n.city, count(*) as cnt ORDER BY cnt DESC"
);

// Path query
const result = await skill.executeQuery(
    "MATCH p=(n:Person)-[*1..3]->(m) WHERE n.name = '张三' RETURN p"
);

Inline Execution (No Temp Files)

Execute Cypher queries directly via skill action=exec without creating any script files.

Note: When running via skill action=exec, the working directory is the project root. The installed skill is located under .agents/skills/huawei-cloud-ges-graph, not under skills/ai/ges/.

Python:

bash
skill exec py -c "
import sys, os; cwd=os.getcwd()
skill_dir = os.path.join(cwd, '.agents', 'skills', 'huawei-cloud-ges-graph')
sys.path.insert(0, os.path.join(skill_dir, 'scripts'))
from ges_graph_skill import get_skill
import json
r = get_skill().execute_query('MATCH (n) RETURN n LIMIT 5')
print(json.dumps(r, ensure_ascii=False, indent=2))
"

Node.js:

bash
skill exec node -e "
const path = require('path');
const cwd = process.cwd();
const scriptPath = path.join(cwd, '.agents', 'skills', 'huawei-cloud-ges-graph', 'scripts', 'ges_graph_skill.js');
const { GESGraphSkill } = require(scriptPath);
(async () => {
    const r = await new GESGraphSkill().executeQuery('MATCH (n) RETURN n LIMIT 5');
    console.log(JSON.stringify(r, null, 2));
})();
"

Common Cypher Statements

CategoryStatementDescription
Schemacall db.schema()Get graph schema information
Indexescall db.indexes()View all indexes
Kill querycall dbms.killQuery('queryId')Terminate a running query
Running queriescall dbms.listQueries()View current queries
System parameterscall dbms.parameter('needNodeIndex', false)Remove index constraint (large graph scenarios)

GQL Usage (Supported by this Skill)

GQL is the ISO/IEC 39075 standardized graph query language. GES invokes it via action_id=execute-gql-query.

python
# GQL requires the underlying _request method
client = GESClient()
result = client._request('POST', '/action?action_id=execute-gql-query', json={
    "statements": [{
        "statement": "INSERT (n:Person{_ID_:'p001', firstName:'Eywa'}) RETURN n",
        "parameters": {},
        "resultDataContents": ["row"]
    }]
})

Common GQL Statements

CategoryStatementDescription
InsertINSERT (n:Person{_ID_:'p001', firstName:'Eywa'}) RETURN nInsert node
MatchMATCH (n:Person WHERE element_id(n)='p001') RETURN nConditional match
UpdateMATCH (n:Person WHERE element_id(n)='p001') SET n.lastName='Higgo' RETURN nUpdate properties
Remove propertyMATCH (n:Person WHERE element_id(n)='p001') REMOVE n.lastName RETURN nRemove property
Delete nodeMATCH (n:Person WHERE element_id(n)='p001') DELETE nDelete node
FilterMATCH (n:Person)-[:KNOWS]->(m) FILTER element_id(n)='7933' AND m.gender='male' RETURN mFilter results
FOR loopFOR a IN [1,2,3] RETURN aLoop statement
LET variableLET a = 1, b = 2 RETURN a, bVariable definition
UNION... UNION ALL ...Merge result sets

Cypher vs GQL Key Differences

FeatureCypherGQL
Internal IDid(n)element_id(n)
Custom ID (insert only)_ID_ property_ID_ property
Node matchingMATCH (n)MATCH (n WHERE ...)
SET statementSET n.prop = valueSET n.prop = value
Remove propertyREMOVE n.propREMOVE n.prop
LoopsNot supportedFOR x IN [...]
Variable definitionNot supportedLET x = value## Core Interfaces (Core Commands)

Cypher Query

python
# Execute a Cypher query
result = skill.execute_query("MATCH (n) RETURN n LIMIT 10")

# Execute a Cypher query with parameters
result = skill.execute_query(
    "MATCH (n) WHERE n.name = $name RETURN n",
    parameters={"name": "张三"}
)

Vertex Operations

python
# Add a node
result = skill.client.add_node(
    node_id="mem_001",
    labels=["Memory", "conversation"],
    properties={"content": "User said Hello", "timestamp": 1234567890}
)

# Batch add nodes
result = skill.client.add_nodes_batch([
    {"id": "mem_001", "labels": ["Memory"], "properties": {"content": "test1"}},
    {"id": "mem_002", "labels": ["Memory"], "properties": {"content": "test2"}}
])

# Get a node
result = skill.client.get_node("mem_001")

# Update a node
result = skill.client.update_node("mem_001", {"content": "New content"})

# Delete a node
result = skill.client.delete_node("mem_001")

Edge Operations

python
# Add an edge
result = skill.client.add_edge(
    start_node_id="mem_001",
    end_node_id="mem_002",
    edge_type="RELATED_TO",
    properties={"weight": 0.8}
)

# Delete an edge
result = skill.client.delete_edge("mem_001", "mem_002", "RELATED_TO")

# Get edges of a node
result = skill.client.get_edges("mem_001", direction="both")

Label Operations

python
# Add a label to a node
result = skill.client.add_label_to_node("mem_001", "important")

# Query nodes by label
result = skill.client.get_nodes_by_label("Memory", limit=100)

Graph Management

python
# Get schema information
result = skill.get_schema_info()

# Get graph statistics
result = skill.get_statistics()

# Clear all data in the graph (dangerous operation)
result = skill.clear_all_memories()

Import/Export

python
# Import graph data
job_id = skill.client.import_graph(
    schema_path="obs://bucket/schema.xml",
    vertex_path="obs://bucket/vertex",
    edge_path="obs://bucket/edge"
)

# Export graph data (access_key/secret_key are read from .env automatically)
job_id = skill.client.export_graph(
    export_path="obs://bucket/export",
    vertex_set_name="set_vertex",
    edge_set_name="set_edge"
)

GES Syntax Guide

Node ID Handling

GES uses the special _ID_ property to handle string-type node IDs:

  • Creating nodes uses the _ID_ property:
cypher
  CREATE (n:Memory{_ID_: 'mem_001', content: 'test'})
  • Other operations use the id() function:
cypher
  MATCH (n) WHERE id(n) = 'mem_001' RETURN n
  MATCH (n)-[r]->(m) WHERE id(n) = 'mem_001' RETURN r

Schema Requirements

GES requires that schema (Labels and Properties) be defined before corresponding nodes can be created. Schema can be defined through:

  1. Creating Labels and properties via the GES management console
  2. Importing data with schema through the import interface

Response Format

All Cypher interfaces return a unified JSON format:

json
{
  "results": [
    {
      "columns": ["column1", "column2"],
      "data": [
        {"row": ["value1", "value2"], "meta": [null, null]}
      ]
    }
  ],
  "errors": []
}

Error Handling

python
from ges_graph_skill import get_skill

skill = get_skill()
try:
    result = skill.execute_query("MATCH (n) RETURN n")
except Exception as e:
    print(f"Error: {e}")

Important Notes

  1. Token validity: Token is valid for 24 hours; the code refreshes automatically
  2. Schema constraint: Ensure Labels and Properties are defined before creating nodes
  3. Dangerous operations: clear_graph() deletes all data in the graph; use with caution
  4. Asynchronous operations: For large data import/export, asynchronous mode is recommended

Reference Documentation

  • Configuration file format: references/ges_env.csv.example — Environment configuration file template and field descriptions
  • Graph database format: https://support.huaweicloud.com/usermanual-ges/ges010153.html — Detailed GES graph data format documentation
  • How to access the business API: https://support.huaweicloud.com/api-ges/ges030112.html — GES business API access guide

Tâches connexes

du même dépôt

Autres Skills

Tous les Skills
huaweicloud
Communauté

huawei-cloud-devbridge-tunnel

Create and manage DevBridge development tunnels on Huawei Cloud to securely expose local development services to remote devices. Based on DevBridge CLI v0.2.x and API Key authentication. Use this skill when the user wants to: (1) install and configure the DevBridge CLI, (2) create/list/update/delete tunnels, (3) manage tunnel ports and protocols, (4) host local services through tunnels, (5) connect to remote tunnels from another device, (6) manage authentication and API Keys. Trigger: user menti

Installations / 1h
3
GitHub Stars
59
Mis à jour
20 nov.
huaweicloud
Communauté

huawei-cloud-find-skills

Invoke this skill to search, list, query, discover, browse, find and install any Huawei Cloud (华为云) agent skill. Triggers include: "华为云", "华为云有什么skill", "华为云相关skill", "华为云agent skill 市场", "华为云skill类目", "explore Huawei Cloud skills", "show Huawei Cloud skill categories", "does a Huawei Cloud skill exist for...", "which Huawei Cloud skills exist", "搜索华为云技能", "查询华为云skill列表", "有没有管理ECS/OBS/RDS的skill", "帮我找 XX 华为云skill", "介绍 XX Skill 内容", "华为云 XX Skill 具体做什么", "安装华为云Skill".

Installations / 1h
3
GitHub Stars
59
Mis à jour
20 nov.
huaweicloud
Communauté

huawei-cloud-terraform-installer

Installs Terraform CLI cross-platform with Huawei Cloud mirror support. Use this skill whenever the user mentions installing Terraform, setting up Terraform environment, or when IaC tasks detect missing Terraform. Trigger: install terraform, setup terraform, terraform environment, huaweicloud provider.

Installations / 1h
6
GitHub Stars
59
Mis à jour
7 nov.
huaweicloud
Communauté

huawei-cloud-billing-scout

Huawei Cloud BSS billing (not AWS/Azure/other clouds; refuses pricing quotes, real-name review, and any non-billing scope): balance, spend, attribution, reconciliation, coupons, stored-value cards, enterprise/partner billing. One-page briefing via hcloud. Use when the request is about Huawei Cloud billing. Triggers include: 华为云余额, 华为云欠费, 华为云本月花费, 华为云扣费原因, 华为云账单对账, 华为云资源包, 华为云优惠券, 华为云企业主账号, 华为云伙伴账务, 华为云服务编码, Huawei Cloud balance / bill / spend / reconciliation / coupon / stored-value card / BSS b

Installations / 1h
5
GitHub Stars
59
Mis à jour
7 nov.