hieudoanm/hieudoanm.github.io/dgraph
Claude Code and agent skill by hieudoanm/hieudoanm.github.io
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Dgraph — distributed graph database with native GraphQL and DQL query support, built on a transactional key-value store.
Install
npx vskill@latest install hieudoanm/hieudoanm.github.io/dgraphSKILL.md
The same SKILL.md was published earlier as hieudoanm/hieudoanm.github.io/dgraph.
Dgraph is a distributed, horizontally scalable graph database that exposes native GraphQL (and its own DQL), backed by a transactional key-value store and a query planner optimized for large graph traversals.
1. Core Concepts
- Data is stored as triples: subject → predicate → object, forming a native graph without a separate schema layer.
- GraphQL is the recommended query/mutation interface; DQL is the lower-level native language.
- Schema is defined via GraphQL SDL or DQL
schema{}; indexes are declared in the schema, not inferred. - Transactions: Dgraph supports optimistic ACID transactions (
@upsertfor edge upserts) — use@idfor GraphQL to enable upsertable unique fields. - Alpha and Zero processes: Zero manages the cluster metadata and transactions; Alpha holds the data shards.
2. GraphQL Usage
- Define types with fields and directives:
@idfor unique fields,@index(trigram, hash)for filterable fields. - Query shapes mirror GraphQL; Dgraph auto-generates resolvers for
filter,order,first/offset. - Mutations:
add,update,deletewith nested mutation support. - Use
@cascadeto return only fully-joined results; combine withfilterfor required-relations.
3. DQL (Native Query Language)
- DQL is JSON-like and closer to the data model:
query { user(func: eq(name, "Alice")) { name friends { name } } }. - Supports filters, pagination, sorting, and deep traversals with
@recurse(depth: N). - Use
has()for existence checks,uid()for specific nodes. - DQL is useful for advanced graph patterns where GraphQL's type-centric model becomes limiting.
4. Schema and Indexing
- Indexes:
@index(hash),@index(exact),@index(trigram),@index(term),@index(fulltext). - Choose the index by query pattern:
hashfor exact equality,trigramfor substring/regex,termfor word-based search,fulltextfor search. - Define
@reverseon edges you traverse both ways. - Use
@countfor predicates that appear frequently in aggregation queries.
5. Operations and Architecture
- Deploy as a cluster:
dgraph-ratelfor the UI,dgraph zerofor metadata,dgraph alphafor data. - Horizontal scale via
--shards Nand--replicas R; data is split across Alpha groups. - Bulk-loading: use
dgraph liveorbulkto load from RDF/JSON/RDF-Quad files; for production, usebulkto pre-split, thenlive. - Backups:
dgraph backupto S3/GCS/local; restore withdgraph restore. - Memory: tune
--cache_size_mbon Alpha for query performance; provide enough RAM for hot data.
6. Common Pitfalls
- Not declaring indexes in the schema, then wondering why filters do a full scan.
- Over-fetching nested data with deep traversals; add pagination/limits.
- Using DQL where GraphQL suffices — GraphQL is more constrained and easier to maintain.
- Forgetting
@cascadewhen you need strict join semantics. - Ignoring
@upsertand getting duplicate edges under concurrent mutations.
General Rules of Thumb
- Start with GraphQL for CRUD; drop to DQL only for complex traversals.
- Define indexes and
@reversebefore production loads. - Use
@upsertwith@idfor idempotent creation and update patterns. - Paginate aggressively in traversals — limit
first/offset.
Quick-Start Checklist
- [ ] Design the GraphQL schema with
@id,@index, and@reversedirectives. - [ ] Use
dgraph liveorbulkfor initial load; shard for production. - [ ] Validate query plans with
EXPLAINin DQL or query metrics in the UI. - [ ] Tune
--cache_size_mband provision RAM for the working set. - [ ] Configure backup schedule (S3/GCS/local) and test restore.
- [ ] Monitor latency, rejected transactions, and memory usage.
- [ ] Use
@upsertfor idempotent writes under concurrency.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.skills/programming/database/graph/dgraph/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hieudoanm/hieudoanm.github.io/dgraph)