EMNLP · 2026

Skill-as-Pseudocode: Refactoring Skill Libraries to Pseudocode for LLM Agents

Xinze Li, Yuhang Zang, Yixin Cao, Aixin Sun

Key takeaway

Skill-as-Pseudocode improves agent use of procedural libraries by pairing typed contracts with concrete action templates; contracts alone do not deliver the same benefit. arXiv abstract · v2

Abstract

Markdown skill libraries for LLM agents ship as free-form prose, forcing the agent to re-derive both the input schema and the concrete invocation syntax on every retrieval. This produces a "confused → re-retrieve → still confused" loop: the agent issues a partially-correct action, receives uninformative feedback, and re-retrieves the same prose. We propose Skill-as-Pseudocode (SaP), an automatic conversion of markdown skill libraries into typed pseudocode with deterministic quality control. From each cluster of similar procedural passages, SaP extracts a typed contract and filters it through a four-check deterministic verifier (coverage, binding, replacement, risk). Promoted contracts are inlined into a rewritten skill skeleton alongside restored action templates, giving the agent two complementary signals: a typed signature for what a skill does and a concrete template for how to invoke it. On the ALFWorld unseen split (134 games, gpt-4o-mini, three seeds), SaP wins 82/402 paired games versus 47/402 for the Graph-of-Skills (GoS) baseline (pooled McNemar p = 8.2 × 10⁻⁵), at -22.8 ± 6.4% input tokens and -14.5 ± 4.1% LLM calls per game. A bundle-component ablation attributes the gain to the pairing of typed contracts with concrete action templates: the contract alone falls below the prose baseline.

Author abstract · arXiv abstract · v2

Publication

Findings of Empirical Methods in Natural Language Processing (Findings of EMNLP), 2026

Paper and resources

Research topics

Skill-as-Pseudocode · LLM agents · Agent skill libraries · Typed contracts · Pseudocode · Action templates · ALFWorld · Token efficiency · Procedural knowledge

Research problem and approach

Free-form skill descriptions force agents to repeatedly infer input schemas and invocation syntax. SaP converts procedural passages into typed pseudocode and restores executable action templates in the rewritten library. arXiv abstract · v2

Main contributions

  • Extracts typed contracts from clusters of similar procedures and verifies coverage, binding, replacement and risk. arXiv abstract · v2
  • Uses component ablations to separate the effects of contracts and action templates. arXiv abstract · v2

Method comparison

ApproachKey difference
Free-form prose skillsLeaves agents to infer input contracts and concrete invocation syntax from procedural descriptions.
Skill-as-PseudocodePairs verified typed contracts with restored action templates; the study finds contracts alone insufficient.

arXiv abstract · v2

Selected results

  • On 134 unseen ALFWorld games with three seeds, GPT-4o-mini and a 30-step limit, SaP succeeds in 82/402 runs (20.4%) versus 47/402 (11.7%) for GoS. Mean input tokens per game decrease from 247.8k to 191.4k and calls from 39.7 to 33.9. Table 1 · ALFWorld, 402 paired runs · arXiv v2
  • In the separate single-seed ablation on 134 games, the full SaP bundle yields 30 successes, compared with 25 for templates alone, 18 for length-matched prose, 16 for raw GoS, and 13 for contracts alone. This supports the combined representation rather than attributing all gains to shorter text. Table 4 · skill-bundle ablation · arXiv v2

Cite this paper

Xinze Li, Yuhang Zang, Yixin Cao, Aixin Sun. Skill-as-Pseudocode: Refactoring Skill Libraries to Pseudocode for LLM Agents. arXiv preprint arXiv:2605.27955, 2026.

@article{arxiv260527955,
  title     = {{Skill-as-Pseudocode: Refactoring Skill Libraries to Pseudocode for LLM Agents}},
  author    = {Xinze Li and Yuhang Zang and Yixin Cao and Aixin Sun},
  journal   = {arXiv preprint arXiv:2605.27955},
  year      = {2026},
  url       = {https://arxiv.org/abs/2605.27955}
}