LLM agents increasingly rely on reusable skills (e.g., SKILL markdown files) to execute complex tasks, yet these artifacts lack portability: agent frameworks are highly sensitive to prompt formatting, leading to a large performance variation for the same skill. Nevertheless, most skills are authored once as format-agnostic Markdown, necessitating costly per-framework rewrites and also leaving security largely unaddressed, with widespread vulnerabilities in practice. To address this, we present SkCC, a compiler for LLM agents that introduces classical compilation design into agent skill development. SkCC centers on SkIR, a strongly-typed intermediate representation that decouples skill semantics from framework-specific formatting, thus enabling portable deployment across agent frameworks. Atop of this IR, a static Optimizer enforces security constraints, blocking vulnerabilities before deployment. Implemented as a four-phase pipeline, SkCC effectively reduces adaptation complexity from $O(m \times n)$ to $O(m + n)$ across $m$ skills and $n$ frameworks. Experiments on SkillsBench demonstrate that SkCC delivers consistent and substantial gains over original counterparts, with pass rate increases from 21.1% to 33.3% on Claude Code and from 35.1% to 48.7% on Kimi CLI. Further, the design achieves sub-10ms compilation latency, 94.8% proactive security trigger rate, and 10-46% runtime token savings across frameworks.
翻译:LLM智能体日益依赖可复用技能(如SKILL标记文件)来执行复杂任务,但这些制品缺乏可移植性:智能体框架对提示格式高度敏感,导致同一技能在不同框架下的性能波动显著。然而,大多数技能仅经一次性编写以格式无关的Markdown形式存储,这不仅需要针对每个框架进行成本高昂的重写,更因实践中普遍存在的安全漏洞而留下严重安全隐患。为此,我们提出SkCC——一种为LLM智能体设计的编译器,将经典编译设计思想引入智能体技能开发。SkCC以强类型中间表示SkIR为核心,将技能语义与框架特定格式解耦,从而实现在不同智能体框架间的可移植部署。基于该中间表示,静态优化器在部署前强制执行安全约束,阻断潜在漏洞。SkCC采用四阶段流水线实现,将跨m个技能和n个框架的适配复杂度从O(m×n)降至O(m+n)。在SkillsBench上的实验表明,SkCC相比原始方法带来持续且显著的性能提升:Claude Code的通过率从21.1%提升至33.3%,Kimi CLI从35.1%提升至48.7%。此外,该设计实现了低于10毫秒的编译延迟、94.8%的主动安全触发率以及跨框架10-46%的运行时代词节省。