Skill: write-graph-query
Invoked by:
graph-query-engineer(primary).When to invoke: "write this Cypher/GQL"; "why is this path slow?"; "local vs global GraphRAG search."
Output: language pick + bounded pattern + index advice + lint result. Fill
../../templates/query-language-decision.md.
Procedure
- Pick the language from the engine + model, not the brand. Default teaching order: Cypher first, then GQL equivalent, then Gremlin / SPARQL 1.1 stubs. See
../../knowledge/graph-languages-and-engines-2026.md. - Type every relationship. Bound every quantified path (
*1..Nor GQL{1, N}). - If the user pasted
-[*]->or-[]-, rewrite it; do not “just add LIMIT.” - If the job is PageRank / community / global shortest-path over a projection, say algorithm library — do not invent
CALL algo.*. - GraphRAG query section (only after a retrieval graph exists):
- Local — bounded typed neighborhood of seed entities.
- Global — read community summaries (not an unbounded walk).
- DRIFT — local first, escalate to community text.
Construction stays on
construct-retrieval-graph.
- Lint snippets with
../../scripts/lint_graph_shape.py. Pre-GQL*in a.gqlfile is a WARNING.
Guardrails
- Advisory only — the user runs the snippet. No driver.
- Not Neo4j-only. Not GraphQL (
.graphql→graphql-engineering). - Date any engine claim
[verify-at-use]. - SPARQL is 1.1 only.