一键导入
graph-rag
Use knowledge graphs to connect related information across documents for enhanced retrieval.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use knowledge graphs to connect related information across documents for enhanced retrieval.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use this skill when building, debugging, or improving Retrieval-Augmented Generation systems, including chunking, vector database selection, hybrid search, reranking, multimodal RAG, code documentation RAG, retrieval latency, and production RAG architecture.
Chunk nested documents into parent-child levels so retrieval can move from broad sections to fine-grained passages.
Use semantic boundaries and embedding similarity to chunk text for higher-relevance retrieval.
Route RAG chunking decisions across semantic, hierarchical, sliding-window, contextual-header, and framework-selection strategies.
Use overlapping windows to preserve context across chunk boundaries while controlling retrieval size.
Reduce retrieval latency with caching, batching, and index-level optimization.
| name | graph-rag |
| title | Graph RAG - Knowledge Graph Retrieval |
| description | Use knowledge graphs to connect related information across documents for enhanced retrieval. |
| allowed-tools | ["Read","Grep","Glob","Bash"] |
| category | retrieval-strategies |
| tags | ["graph-rag","knowledge-graph","entity-extraction","community-detection"] |
Graph RAG enhances traditional retrieval by constructing knowledge graphs from documents, identifying communities of related entities, and using these structures to improve retrieval. This approach excels at connecting disparate information and providing holistic understanding across large document collections.
Traditional chunk-based retrieval has limitations:
Use an LLM to identify entities and their relationships from document chunks.
Why: Entity extraction transforms unstructured text into structured knowledge, enabling graph-based retrieval that understands connections between concepts.
Direct the LLM to extract entities (people, places, concepts, etc.) and the relationships between them.
Build a graph from extracted entities and relationships.
Why: A knowledge graph provides a structured representation of how entities connect across the document collection, enabling retrieval that traverses these connections.
Create nodes for entities and edges for relationships, building a graph structure that can be queried and traversed.
Apply community detection algorithms to identify clusters of related entities.
Why: Communities represent thematic groupings in the graph - entities that are closely connected form natural clusters that can be summarized together.
Use community detection algorithms (e.g., Leiden, Louvain) to find clusters of highly connected entities.
Generate summaries for each community to provide context for retrieval.
Why: Community summaries condense related information into manageable pieces, enabling efficient retrieval while preserving thematic connections.
For each community, summarize the relevant documents and entity information into concise overviews.
Query using community summaries for specific, focused answers.
Why: Local retrieval provides precise, contextually relevant answers by matching queries to the most appropriate community summaries.
Match queries to community summaries and retrieve documents from the most relevant communities.
Synthesize information across all communities for comprehensive answers.
Why: Global retrieval is needed for queries that require understanding across multiple communities or the entire corpus.
Generate preliminary answers from each community and synthesize into a comprehensive response.
Combine all components into a cohesive system.
Why: A complete pipeline with both local and global retrieval modes ensures optimal performance for both specific and comprehensive queries.
For implementation patterns, see Microsoft GraphRAG, the GraphRAG documentation, and networkx community detection for implementation details.