Typed contracts + call templates: 82 vs. 47 ALFWorld wins, −23% tokens per game
Notes on Skill-as-Pseudocode: Refactoring Skill Libraries to Pseudocode for LLM Agents (arXiv:2605.27955) — Xinze Li, Yuhang Zang, Yixin Cao, Aixin Sun · May 2026
Note published · written by SkillFed’s research pipeline from the paper above · how these notes are made
AI-assisted notes · reviewed by SkillFed Frontier & otherSkill-as-Pseudocode (SaP) rewrites markdown skill libraries into typed pseudocode, so agents stop re-deriving schemas and call syntax from prose on every retrieval. The pipeline clusters similar procedural passages across a library and extracts a typed contract for each cluster. Before promotion, each contract has to clear a four-check deterministic verifier — coverage, binding, replacement, risk. Verified contracts get inlined into a rewritten skill file alongside restored concrete action templates, so one retrieval now hands the agent both a typed signature for what a skill does and syntax it can invoke directly.
On the 134-game ALFWorld unseen split with gpt-4o-mini, pooled across three seeds, SaP wins 82 of 402 paired games against 47 for the Graph-of-Skills baseline (pooled McNemar test, p = 8.2×10⁻⁵) — and does it while cutting input tokens 22.8% and LLM calls 14.5% per game. The mechanism shows up directly in action quality: the agent's next environment action after a retrieval succeeds 29.3% of the time under SaP versus 20.5% under GoS, widening to a 1.57x gap on explicit skill-lookup events. That gain depends on one design choice: an ablation that promotes contracts to standalone top-level retrieval results, instead of nesting them under their parent skill, drops reward by roughly 27%.
Key numbers
| ALFWorld paired wins (SaP vs. GoS) | 82/402 vs. 47/402 |
| Significance (pooled McNemar) | p = 8.2×10⁻⁵ |
| Input tokens per game | −22.8% ± 6.4% |
| LLM calls per game | −14.5% ± 4.1% |
| Reward drop if retrieval hierarchy is flattened | −27% (22.4%→16.4%, seed 42) |
Skills related to this research
Related notes
- Best skill-generation pipeline clears just 14% of code-repo tasks, 25% of document tasks →
- Forced to search a 34k-skill library instead of being handed the right one, agents' pass rate falls from 55.4% to 38.4% -- a hair above the 35.4% no-skill floor →
- Diagnose, don't rewrite: three revision rounds take a skill from 36% to 62% success →
- Cut Skill Bodies 39%, Task Success Rises 2.8% →
- Curated Skills Lift Success Rates 16.2 Points — Self-Generated Ones Cost You 1.3 →
- LLM-Written Agent Skills Add Zero Pass-Rate Gain — Self-Diagnosis Closes Up to 67% of the Gap to Human Authors →
- Route skill treatment by task difficulty, not skill category: +13.2 points OOD success →
- The validation gate turns a 40% agent into an 89% one — skill-writing without it changes nothing →
- Dumping every skill into context scores worse than giving the agent none — SkillsInjector recovers it to 58.7% →
References
- Li, Zang, Cao & Sun, "Skill-as-Pseudocode: Refactoring Skill Libraries to Pseudocode for LLM Agents," arXiv:2605.27955 (2026).
- "Graph-of-Skills: Dependency-Aware Structural Retrieval for Massive Agent Skills," arXiv:2604.05333 (2026).
- Shridhar et al., "ALFWorld: Aligning Text and Embodied Environments for Interactive Learning," ICLR (2021).