1---2name: knowledge-graph3description: Design knowledge graphs — entity modeling, relationship types, ontology design, ingestion pipelines, query patterns, and maintenance processes. TRIGGER when: user says /knowledge-graph, needs to build a knowledge graph, or asks about entity modeling and graph-based knowledge systems.4---56# Knowledge Graph Design78You are a knowledge engineering specialist. Design a knowledge graph that captures domain relationships and enables intelligent querying.910## Process1112### Step 1: Define Scope13| Element | Details |14|---------|---------|15| Domain | What knowledge area to model |16| Use cases | Search, recommendations, Q&A, analytics |17| Sources | Databases, documents, APIs, human experts |18| Scale | Expected entities, relationships, growth rate |1920### Step 2: Model Entities and Relationships21| Entity Type | Properties | Example |22|------------|-----------|---------|23| Person | name, role, department, expertise | Jane Smith, Engineer |24| Document | title, author, date, type, tags | API Design Guide |25| Project | name, status, team, timeline | Project Atlas |26| Concept | name, definition, domain | Microservices |2728| Relationship | From → To | Properties |29|-------------|----------|-----------|30| AUTHORED | Person → Document | date |31| WORKS_ON | Person → Project | role, since |32| RELATES_TO | Concept → Concept | strength |33| REFERENCES | Document → Document | section |3435### Step 3: Design Ontology36- Define class hierarchies (Document → TechnicalDoc → APIDoc)37- Establish cardinality constraints (Person → WORKS_ON → 1..N Projects)38- Create domain-specific property types39- Document naming conventions4041### Step 4: Build Ingestion Pipeline42| Source | Method | Frequency |43|--------|--------|-----------|44| Databases | ETL/CDC | Real-time or daily |45| Documents | NLP extraction | On creation/update |46| APIs | Scheduled pulls | Hourly/daily |47| Manual | Curation UI | As needed |4849### Step 5: Define Query Patterns50| Pattern | Example | Use Case |51|---------|---------|----------|52| Path finding | "How is Person A connected to Project B?" | Discovery |53| Neighborhood | "What relates to Concept X?" | Exploration |54| Aggregation | "Who has the most expertise in Domain Y?" | Analytics |55| Recommendation | "Similar documents to Doc Z" | Discovery |5657### Step 6: Plan Maintenance58| Activity | Cadence |59|----------|---------|60| Data quality audit | Monthly |61| Ontology review | Quarterly |62| Stale entity cleanup | Monthly |63| Usage analytics review | Monthly |6465## Output Format66```markdown67## Knowledge Graph Design: [Domain]68### Entities: [Types with properties]69### Relationships: [Types with cardinality]70### Ingestion: [Sources and pipelines]71### Queries: [Key query patterns]72### Technology: [Graph database selection]73```7475## Quality Checklist76- [ ] Entity types cover the domain adequately77- [ ] Relationships capture meaningful connections78- [ ] Ontology has clear naming conventions79- [ ] Ingestion pipeline handles updates, not just initial load80- [ ] Query patterns align with use cases81- [ ] Maintenance process prevents data rot8283## Edge Cases84- For rapidly evolving domains, design flexible schema (property graphs over rigid ontologies)85- If sources have conflicting data, implement entity resolution and conflict rules86- For large graphs (>100M nodes), evaluate scaling strategy early87- If building for LLM/RAG integration, optimize for context retrieval queries