Arangodb

From G1Joshi/Agent-Skills · View interactive version

Arangodb is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert ArangoDB multi-model database assistance covering AQL, document collections, graphs, and Foxx microservices. Use when querying graph relationships, joining document stores, or designing multi-model schemas.

How to use this skill

Skill file

ArangoDB

ArangoDB is a native multi-model database. It allows you to store data as Key/Values, JSON Documents, and Graphs, and query them all with a single language (AQL).

When to Use

Quick Start

// AQL (ArangoDB Query Language) - SQL-like
FOR u IN users
  FILTER u.active == true
  FOR order IN OUTBOUND u orders
    RETURN { user: u.name, order: order.product }

Core Concepts

Multi-Model Document & Edge Collections

Documents store unstructured JSON entities; Edge collections define directed connections between documents using _from and _to attributes:

// Vertex Document (users/alice)
{ "_key": "alice", "name": "Alice Mercer", "role": "Lead Architect" }

// Edge Document (knows/edge_1)
{ "_from": "users/alice", "_to": "users/bob", "relationship": "mentor", "since": 2024 }

ArangoDB Query Language (AQL) Graph Traversal

Traverses interconnected relationship graphs up to N hops:

// 1 to 3 hops outward traversal from Alice
FOR v, e, p IN 1..3 OUTBOUND 'users/alice' GRAPH 'socialGraph'
  FILTER e.relationship == 'mentor'
  RETURN {
    colleague: v.name,
    distance: LENGTH(p.edges),
    path: p.vertices[*].name
  }

Distributed Cluster Sharding (OneShard & SmartGraphs)

Ensures interconnected graph vertices and edges are colocated on identical physical DB servers to eliminate network hop penalties:

// Creates a SmartGraph partitioned by customer tenant ID
const graph = db._createSmartGraph(
  "tenantSocialGraph",
  [{ collection: "members", from: ["users"], to: ["users"] }],
  { smartGraphAttribute: "tenantId" },
);

Common Patterns

Graph Traversal with AQL

Problem: Querying deeply nested social or hierarchy connections in relational stores requires slow multi-table recursive joins.

Solution:

Traverse nodes and edges declaratively with AQL:

FOR v, e, p IN 1..3 OUTBOUND 'users/alice' GRAPH 'social_graph'
  FILTER v.status == 'active'
  RETURN {
    friend: v.name,
    distance: LENGTH(p.edges),
    path: p.vertices[*].name
  }

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| :--------------------------------- | :------------------------------------------------------- | :----------------------------------------------------------------------------------- |

| [1200] conflict | Optimistic locking collision on document update. | Retry update using current document _rev or use overwriteMode: 'replace'. |

| [1501] collection not found | Attempted query against non-existent collection or typo. | Verify collection names and ensure creation migrations have executed. |

| Out of memory in graph traversal | Unbounded traversal depths on large dense graphs. | Specify explicit min..max depths and add prune/filter conditions early in traversal. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.