Skill2Query: Exploiting Skill Structure to Generate Pseudo-Queries for Agent Skill Retrieval

Lihui Ding, Zihan Guo, Bingwei Lu, Chenyu Zhou, Yuanjian Zhou, Weinan Zhang, Jianghao Lin, Dongdong GearXiv 2026

TL;DR

Skill2Query is a novel framework that improves LLM agent skill retrieval by parsing technical skill documents into structured Skill Knowledge Graphs (SKGs). By decoupling pseudo-query generation into a three-stage pipeline—style mimicking, template generation, and parameter filling—it bridges the gap between colloquial user requests and rigid developer documentation. This approach yields significant retrieval performance gains and directly boosts downstream agent task success rates.

What Problem Does This Paper Address?

For AI agents to effectively execute complex tasks, they must accurately retrieve and invoke specific "skills" (reusable tools or APIs) from large-scale repositories containing thousands of candidates. However, skill retrieval suffers from an asymmetric matching problem: users describe goals using short, colloquial, and often underspecified queries, whereas skill documentation is written by developers using technical jargon, strict parameter schemas, and execution constraints.

Existing pseudo-query generation methods (like doc2query or InPars) try to alleviate this by generating synthetic queries from flat text documentation. Unfortunately, treating documentation as unstructured text leads to two major issues:

  1. The Capability-Grounding Gap: Generated queries are topically relevant to the skill as a whole but fail to map to a specific, distinct capability within that skill.
  2. The Parameter-Consistency Gap: Generated queries contain parameters or values that violate the skill's actual executable interface or constraints.

Methods

To exploit the internal structure of skill documents, the authors introduce Skill2Query, which processes documentation through a structured, three-stage progressive pipeline:

Figure 1: Overview of the Skill2Query framework.
  1. Skill Knowledge Graph (SKG) Construction: The framework first parses a SKILL.md file into a structured graph consisting of four node types: Skill, Capability, Parameter, and Example, connected by explicit relational edges.
Figure 2: The node and edge types defined in the SKG. Solid arrows start from Skill nodes, and dashed arrows start from Example nodes.
  1. Three-Stage Progressive Generation:
  2. L1: Style Mimicker: Extracts syntactic patterns and domain-specific vocabulary from the documentation's official usage examples to match the user's natural register.
  3. L2: Query Template Generator: Generates natural language query templates with parameter placeholders (e.g., How many ways can I seat {n} people...), ensuring all distinct capabilities are functionally covered.
  4. L3: Param Filler: Instantiates the placeholders with valid concrete values based on a strict priority order (examples $\rightarrow$ enum $\rightarrow$ default $\rightarrow$ type fallback) and runs rule-based static validation to ensure parameter consistency.

The generated pseudo-queries can be deployed in three ways: offline index augmentation, online query expansion, and generating high-quality training data for retriever fine-tuning.

Datasets

The framework was evaluated using a massive candidate pool of 26,262 skills derived from SRA-Bench. Testing spanned four diverse downstream application benchmarks:

  • TheoremQA: A theorem-driven question-answering dataset.
  • LogicBench: Focused on evaluating logical reasoning capabilities.
  • ToolQA: Designed for question answering using external tools.
  • CHAMP: A competition-level mathematical reasoning dataset.

Key Insights and Ideas

  • Combating "Information-Source Confusion": Standard LLM prompting mixes style, structure, and parameter constraints into a single prompt, which degrades generation quality. Decoupling these aspects into separate pipeline stages allows the LLM to focus on one dimension at a time, drastically increasing parameter validity.
  • Diversity vs. Alignment: Ablation studies revealed that removing the SKG actually increased surface-level lexical diversity (Distinct-3 score), but tanked retrieval performance. This shows that for tool retrieval, strict semantic alignment and constraint satisfaction are far more important than creative linguistic variation.
  • Perspectival Bridging: The core bottleneck in skill retrieval isn't just semantic distance; it's a difference in perspective. Developers document what a tool provides, while users ask for what they want to accomplish. The SKG acts as the shared reference frame to translate between these two perspectives.

Key Results

Skill2Query was evaluated against several baseline generation methods (Zero-shot, Few-shot, and SkillFlow-style flat text generation) and consistently demonstrated superior performance:

  • Generation Quality: Skill2Query achieved an execution pass rate (Exec-Pass) of 42.85%, outperforming the best flat-text baseline by over 20 percentage points, proving its superior parameter consistency.
  • Retrieval Performance: Across sparse (BM25), dense (BGE), and two-stage (SkillRouter) retrieval setups, Skill2Query delivered an average Recall@1 gain of 6.70 percentage points. The gains were particularly massive on ToolQA, where it raised BM25 Recall@1 from 5.52% to 32.03%.
Figure 4: Performance gains of Skill2Query across datasets and retrieval metrics.
  • Downstream Agent Success: When integrated into end-to-end agent workflows across multiple LLM backends (GPT-4o-mini, DeepSeek-V4-Flash, Qwen3.6-Plus), the improved retrieval translated directly into higher task success rates. For instance, it boosted DeepSeek's task success rate from 73.76% to 82.33% (+8.57 pp).

Limitations and Future Work

The primary limitation of Skill2Query is its dependency on documentation quality. If a developer's original SKILL.md file lacks clear parameter declarations or usage examples, the parsing quality of the SKG degrades, causing the framework to fall back to near-few-shot baseline performance.

For future work, the authors plan to explore user- and context-aware generation mechanisms (incorporating chat history), multi-skill joint retrieval, and cross-platform skill transfer.

Summary updated

BibTeX
@misc{ding2026skill,
  author = {Lihui Ding and Zihan Guo and Bingwei Lu and Chenyu Zhou and Yuanjian Zhou and Weinan Zhang and Jianghao Lin and Dongdong Ge},
  title = {{Skill2Query: Exploiting Skill Structure to Generate Pseudo-Queries for Agent Skill Retrieval}},
  year = {2026},
  eprint = {2608.16071},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.16071},
}
Figure