skills/forge-graph-query/SKILL.md
[read-only] Run a Cypher query against the Neo4j knowledge graph. Use when you need to find bug hotspots, trace cross-feature dependencies, check test coverage gaps, or explore module relationships. Pass the query as an argument.
npx skillsauth add quantumbitcz/dev-pipeline forge-graph-queryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
See shared/skill-contract.md for the standard exit-code table.
Before any action, verify:
git rev-parse --show-toplevel 2>/dev/null. If fails: report "Not a git repository. Navigate to a project directory." and STOP..claude/forge.local.md exists. If not: report "Forge not initialized. Run /forge-init first." and STOP.You are the graph query executor. Your job is to accept a Cypher query, validate that the graph is available, execute the query, and display formatted results.
Before starting, resolve the Neo4j container name: read graph.neo4j_container_name from .claude/forge.local.md. If not set, use default forge-neo4j. Use the resolved name in ALL docker commands below.
Run the health check script:
"${CLAUDE_PLUGIN_ROOT}/shared/graph/neo4j-health.sh"
/forge-graph-init to start the graph." Abort.Inject project_id automatically into all queries:
PROJECT_ID=$(derive_project_id "$PROJECT_ROOT")
User can override by specifying their own :param project_id in the query, or omit project_id for cross-project queries.
Accept the Cypher query from the skill argument (the text following /forge-graph-query on the command line).
Store the query in $QUERY.
Run the query against Neo4j:
echo "$QUERY" | \
docker exec -i forge-neo4j cypher-shell -u neo4j -p forge-local --format plain
Capture both stdout and stderr.
Present the raw output from cypher-shell. If the output is empty (no rows returned), show: "Query returned no results."
Also show the query that was executed, so the user can reference or modify it:
Query:
MATCH (n:ProjectClass) RETURN n.name LIMIT 10
Results:
n.name
------
UserService
OrderRepository
PaymentGateway
...
(3 rows)
If the output is large (more than 50 rows), truncate display to 50 rows and note: "Showing first 50 of N rows. Add a LIMIT clause to restrict results."
After displaying results, offer useful next steps based on the query type:
MATCH ... RETURN with no LIMIT: suggest adding LIMIT for large graphs.MATCH (n) RETURN DISTINCT labels(n)./forge-graph-status to see all available labels and relationship types.| Condition | Action |
|-----------|--------|
| Prerequisites fail | Report specific error message and STOP |
| Neo4j not healthy | Report "Neo4j is not available. Run /forge-graph-init to start the graph." and STOP |
| No query provided | Prompt the user: "Enter your Cypher query:" |
| Invalid Cypher syntax | Display the error output from cypher-shell and suggest checking query syntax |
| Query returns no results | Report "Query returned no results." Suggest checking node labels with MATCH (n) RETURN DISTINCT labels(n) |
| Query returns too many rows (>50) | Truncate to 50 rows with note. Suggest adding LIMIT clause |
| Docker connection fails | Report "Cannot connect to Neo4j container. Check if Docker is running." and STOP |
/forge-graph-status -- See available node labels and relationship types before querying/forge-graph-debug -- Structured diagnostic recipes without needing raw Cypher knowledge/forge-graph-rebuild -- Rebuild the graph if queries return stale or missing data/forge-graph-init -- Initialize the graph if it is not running/forge-ask -- Natural language queries about the codebase (uses graph as one of its data sources)development
[writes] Build, fix, deploy, review, or modify code in this project. Universal entry for the forge pipeline. Auto-bootstraps on first run; brainstorms before planning when given a feature description. Use when you want to take any productive action: implementing features, fixing bugs, reviewing branches, deploying, committing, running migrations.
tools
[writes] Manage forge state and configuration: recovery, abort, config edits, session handoff, automations, playbooks, output compression, knowledge graph maintenance. Use when you need to recover from broken pipeline state, edit settings, or manage long-lived state.
development
[writes] Create, list, show, resume, or search forge session handoffs. Use when context is getting heavy and you want to transfer a forge run or conversation into a fresh Claude Code session, or to resume from a prior handoff artefact. Subcommands - no args (write), list, show, resume, search.
development
[writes] Manage the Neo4j knowledge graph. Subcommands: init, rebuild (writes); status, query <cypher>, debug (read-only). Requires Docker. No default — an explicit subcommand is required. Use when setting up the graph for the first time, rebuilding after major refactors, checking graph health, or running ad-hoc Cypher diagnostics.