Query Enhancer Skill
Optimize search queries for better RAG retrieval results using NLP heuristics.
Usage
/query-enhancer [action] "<query>"
Actions
| Action | Flag | Description |
|---|---|---|
| Rewrite | --rewrite |
Generate multiple query variants with synonyms and context |
| Multi-Query | --multi |
Expand one question into 3-5 diverse search queries |
| HyDE | --hyde |
Generate a hypothetical answer passage for embedding |
| Decompose | --decompose |
Break complex question into atomic sub-queries |
| Expand | --expand |
Add related terms, synonyms, and context keywords |
| Analyze | --analyze |
Classify intent, extract entities, determine answer type |
How It Works
- Rewrite: Applies synonym substitution, rephrasing, and contextual expansion to produce 3-4 variant queries that cover different retrieval angles
- Multi-Query: Generates 3-5 semantically diverse queries targeting different facets of the original question
- HyDE: Creates a hypothetical document passage that would answer the query, useful for embedding-based retrieval where the answer embedding is closer to relevant documents
- Decompose: Splits compound questions into independent sub-queries that can be searched separately and results merged
- Expand: Enriches the query with related terms from a built-in synonym map and detected domain context
- Analyze: Detects query type (who/what/when/where/why/how), extracts named entities and quoted terms, and classifies expected answer format