retrieval-search-orchestration
Designs retrieval strategies for querying knowledge graphs in RAG systems, covering pattern selection (global-first, local-first, U-shaped hybrid), query decomposition for multi-hop reasoning, ranking and constraint configuration, and provenance tracking for citation. Use when designing retrieval pipelines, orchestrating search over knowledge graphs, or when user mentions retrieval strategy, search orchestration, query decomposition, multi-hop reasoning, provenance tracking, or citation in GraphRAG.
What this skill does
## Table of Contents
- [Workflow](#workflow)
- [Step Descriptions](#step-descriptions)
- [Retrieval Pattern Selection Guide](#retrieval-pattern-selection-guide)
- [Query Decomposition Patterns](#query-decomposition-patterns)
- [Output Template](#output-template)
# Retrieval & Search Orchestration
## Workflow
Copy this checklist and work through each step:
- [ ] 1. Analyze query types and requirements
- [ ] 2. Select retrieval pattern
- [ ] 3. Design query decomposition strategy
- [ ] 4. Configure ranking and constraints
- [ ] 5. Design provenance tracking
- [ ] 6. Define fallback strategies
- [ ] 7. Produce retrieval strategy specification
## Step Descriptions
### Step 1: Analyze Query Types and Requirements
Classify the queries your system must handle. Common categories include:
- **Factoid lookups**: single-entity, single-hop (e.g., "What is the capital of France?")
- **Exploratory/thematic**: broad questions requiring aggregation across many entities (e.g., "What are the main themes in this corpus?")
- **Multi-hop reasoning**: questions requiring traversal of multiple relationships (e.g., "Which drugs treat diseases caused by gene X?")
- **Temporal queries**: questions bounded by time ranges or requiring sequence understanding
- **Constrained queries**: questions with type or attribute filters (e.g., "List all clinical trials after 2020 for drug Y")
Identify the distribution of these query types in your use case to guide pattern selection.
### Step 2: Select Retrieval Pattern
Use the Retrieval Pattern Selection Guide below to choose the right approach for your query distribution. See `resources/methodology.md` for detailed implementation guidance on each pattern.
### Step 3: Design Query Decomposition Strategy
For complex queries, break them into sub-queries that can be independently resolved and then aggregated. Approaches include LLM-as-controller decomposition, self-ask chains, and ReAct-style interleaved reasoning and retrieval. See the Query Decomposition Patterns section below and `resources/methodology.md` for details.
### Step 4: Configure Ranking and Constraints
Define how retrieved results are scored, ranked, and filtered:
- Embedding similarity thresholds
- Graph distance penalties
- Type-based pre-filters or post-filters
- Confidence score minimums
- Temporal decay functions for time-sensitive data
### Step 5: Design Provenance Tracking
Ensure every piece of retrieved information carries metadata about its origin. This includes source document IDs, extraction timestamps, confidence scores, and evidence chain construction. See `resources/provenance-patterns.md` for annotation approaches, confidence scoring, and LLM integration patterns.
### Step 6: Define Fallback Strategies
Design what happens when primary retrieval fails or returns insufficient results:
- Iterative deepening (expand hop count)
- Query relaxation (remove constraints progressively)
- Parallel exploration (try multiple patterns simultaneously)
- Graceful degradation (return partial results with confidence indicators)
### Step 7: Produce Retrieval Strategy Specification
Compile the full specification using the Output Template below.
---
## Retrieval Pattern Selection Guide
| Pattern | Best For | Mechanism | Trade-offs | Section Ref |
|---|---|---|---|---|
| **Global-First** | Broad thematic queries, corpus-level summaries | Community detection, top-down traversal of summarized indexes | High-level coverage; may miss specific details | 3.1 |
| **Local-First** | Entity-centric lookups, neighborhood exploration | Seed entity linking, 1-2 hop neighborhood expansion with embedding gates | High precision for known entities; limited scope | 3.2 |
| **U-Shaped Hybrid** | Complex queries needing both breadth and depth | Coarse-to-fine bidirectional search, top-down then bottom-up refinement | Best coverage; higher latency and complexity | 3.3 |
| **Query Decomposition** | Multi-hop reasoning, composite questions | LLM breaks query into sub-queries, sequential retrieval, aggregation | Handles complex questions; depends on decomposition quality | 3.4 |
| **Temporal** | Time-bounded or sequence-dependent queries | Time-slice filtering, episodic windowing, time-decay ranking | Captures temporal dynamics; needs temporal metadata | 3.5 |
| **Constraint-Guided** | Type-filtered or rule-bounded queries | Pre-filter + vector search, symbolic query then neural re-rank | Reduces search space; requires well-typed schema | 3.6 |
**Selection heuristic**: Start with the dominant query type in your system. If queries are mixed, consider U-Shaped Hybrid as a default with fallback to specialized patterns.
---
## Query Decomposition Patterns
### LLM-as-Controller
The LLM receives the original query and generates a plan of sub-queries:
```
Original: "Which drugs treat diseases linked to mutations in BRCA1?"
Sub-query 1: "What diseases are linked to mutations in BRCA1?"
Sub-query 2: "What drugs treat [diseases from sub-query 1]?"
Aggregation: Combine results, deduplicate, rank by evidence strength
```
### Self-Ask Chain
The model iteratively asks itself follow-up questions, retrieving after each:
```
Q: "What is the relationship between company X and technology Y?"
Follow-up 1: "What products does company X produce?" -> retrieve
Follow-up 2: "Which of those products use technology Y?" -> retrieve
Follow-up 3: "What partnerships exist between X and Y providers?" -> retrieve
Synthesize: Combine all retrieved evidence into final answer
```
### ReAct Pattern
Interleave reasoning and retrieval actions:
```
Thought: I need to find the connection between entity A and entity C
Action: Search KG for paths between A and C (max 3 hops)
Observation: Found path A -> B -> C via relationship R1 and R2
Thought: I should verify this path with supporting evidence
Action: Retrieve source documents for edges A-B and B-C
Observation: Edge A-B supported by [doc1, doc2], edge B-C supported by [doc3]
Answer: A connects to C through B, supported by 3 source documents
```
### Tool-Augmented Retrieval
Generate formal queries (Cypher, SPARQL) for structured graph traversal:
```
LLM generates: MATCH (d:Drug)-[:TREATS]->(dis:Disease)<-[:CAUSES]-(g:Gene {name: 'BRCA1'})
RETURN d.name, dis.name, g.name
Execute against graph database
Post-process results with LLM for natural language answer
```
---
## Output Template
```markdown
# Retrieval Strategy Specification
## System Context
- **Domain**: [e.g., biomedical, legal, financial]
- **Knowledge Graph Type**: [e.g., property graph, RDF, hybrid]
- **Primary Query Types**: [list dominant query categories]
- **Scale**: [approximate node/edge counts, query volume]
## Retrieval Pattern
- **Primary Pattern**: [selected pattern from guide]
- **Rationale**: [why this pattern fits the query distribution]
- **Secondary/Fallback Pattern**: [if applicable]
## Query Decomposition
- **Strategy**: [LLM-as-controller / self-ask / ReAct / tool-augmented / none]
- **Max Sub-queries**: [limit per original query]
- **Aggregation Method**: [union / intersection / ranked merge / LLM synthesis]
## Ranking & Constraints
- **Similarity Threshold**: [minimum embedding similarity score]
- **Max Hop Distance**: [maximum graph traversal depth]
- **Type Filters**: [entity/relationship type constraints]
- **Temporal Constraints**: [time windows, decay functions]
- **Confidence Minimum**: [minimum source confidence for inclusion]
## Provenance Design
- **Annotation Method**: [metadata fields / evidence nodes / named graphs / reification]
- **Confidence Scoring**: [source reliability tiers, aggregation rules]
- **Citation Format**: [inline / post-hoc / both]
- **Conflict Resolution**: [timestamp priority / source authority / LLM adjudication]
## Fallback Strategy
- **Primary Fallback**: [iterative deepening / query relaxation / parallel exploration]
- **Max Retry Depth**: [number of fallback attempts]
- **Degradation Policy**: [partial results with confRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.