kr7shnasomani/kairos / .agents/skills/neo4j-cypher-skill
neo4j-cypher-skill
VerifiedGenerates, optimizes, and validates Cypher 25 queries for Neo4j 2025.x and 2026.x. Use when writing new Cypher queries, optimizing slow queries, graph pattern matching, vector or fulltext search, subqueries, or batch writes. Covers MATCH, MERGE, CREATE, WITH, RETURN, CALL, UNWIND, FOREACH, LOAD CSV, SEARCH, expressions, functions, indexes, and subqueries. Does NOT handle driver migration or API changes — use neo4j-migration-skill. Does NOT cover DB administration or server ops — use neo4j-cli-tools-skill.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 2.8 KB |
| SKILL.md | skill md | 19.4 KB |
| references/advanced-patterns.md | markdown | 7.8 KB |
| references/apoc.md | markdown | 11.0 KB |
| references/cypher-syntax.md | markdown | 24.0 KB |
| references/graph-type.md | markdown | 4.4 KB |
| references/indexes.md | markdown | 13.7 KB |
| references/performance.md | markdown | 6.3 KB |
| references/schema-guardrail.md | markdown | 4.8 KB |
| references/syntax-traps.md | markdown | 3.8 KB |
| scripts/define_schema.py | script | 3.6 KB |
| scripts/generate_schema.py | script | 2.0 KB |
| scripts/import_neo4j_schema.py | script | 8.0 KB |
scripts/generate_schema.py
View on GitHub"""
Export APOC meta.schema from a live Neo4j instance.
Usage:
python scripts/generate_schema.py [db-name]
Reads credentials from environment variables or a .env file:
NEO4J_URI (default: bolt://localhost:7687)
NEO4J_USERNAME (default: neo4j)
NEO4J_PASSWORD (required)
NEO4J_DATABASE (default: db-name arg or "neo4j")
Output: <db-name>-schema.json in the current directory.
Add *-schema.json to .gitignore if the schema contains sensitive structure.
"""
import os
import json
import sys
from datetime import datetime, timezone
from neo4j import GraphDatabase
try:
from dotenv import load_dotenv
load_dotenv()
except ImportError:
pass # python-dotenv optional; env vars already set take precedence
URI = os.getenv("NEO4J_URI", "bolt://localhost:7687")
USERNAME = os.getenv("NEO4J_USERNAME", "neo4j")
PASSWORD = os.getenv("NEO4J_PASSWORD")
def fetch_and_map_schema(db_name=None):
if not PASSWORD:
print("Error: NEO4J_PASSWORD is not set. Add it to your .env file or environment.")
sys.exit(1)
name = db_name or os.getenv("NEO4J_DATABASE", "neo4j")
print(f"Connecting to {URI} (database: {name}) ...")
try:
with GraphDatabase.driver(URI, auth=(USERNAME, PASSWORD)) as driver:
records, _, _ = driver.execute_query(
"CALL apoc.meta.schema()", database_=name
)
if not records:
print("No schema records returned. Is APOC installed?")
return
raw_schema = records[0].data()
raw_schema["schema_retrieved_at"] = datetime.now(timezone.utc).isoformat()
output_path = f"{name}-schema.json"
with open(output_path, "w", encoding="utf-8") as f:
json.dump(raw_schema, f, indent=2)
print(f"Schema saved to {output_path}")
except Exception as e:
print(f"Failed: {e}")
sys.exit(1)
if __name__ == "__main__":
db_name = sys.argv[1] if len(sys.argv) > 1 else None
fetch_and_map_schema(db_name)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |