SkillSpec: Intent-Masked Specification Reasoning for Agent Skill Correctness

Yizhuo Zhang; Bo Kang; Yi Yang; Zhiyu Duan; Zhouteng Ye; Shunkun Yang

Beihang University, Beijing, China

Abstract

Autonomous agent systems increasingly depend on reusable skill abstractions for consolidating experiential knowledge and domain expertise. These artifacts typically bundle free-form instructions with heterogeneous resources. However, ensuring their correctness remains challenging. Their failure modes transcend conventional code defects to subtle semantic inconsistencies such as intent conflicts, which manifest as silent failures masked by the underlying model. Moreover, skill correctness must be grounded in intended task boundaries and generalizability.

We propose SkillSpec, a Hoare-style framework that formulates skill correctness as a specification reasoning problem. It transforms a heterogeneous skill repository into a unified graph representation that aligns descriptions, instructions and code artifacts. For each node, SkillSpec derives an ExpectSpec from the surrounding declared intent, and infers FactSpecs from encoded behavior under partially disclosed intent. An intent mask regulates access to holistic, lineage, neighborhood, and local views to balance the bias introduced by excessive context against unsupported inference caused by insufficient context. SkillSpec jointly reasons over these views to flag candidate defects, and automatically validates them in an isolated sandbox.

On 515 real-world skills from SkillsBench and widely downloaded repositories, SkillSpec identified 763 manually confirmed defects across 239 skills, achieving 61.2% precision. The node-level analysis across multiple model families shows that specification reasoning is consistently reliable for code nodes, whereas plain-text nodes remain a major bottleneck. Most defects arise at the boundaries between declared intent and implementation, demonstrating that explicit specifications provide a practical foundation for skill quality assurance in real-world agent ecosystems.

Skills analyzed
515
Confirmed defects
763
Skills with defects
239/ 515
Reports confirmed
61.2%

Overview

SkillSpec pipeline: unified graph construction aligns skill workflows and code; intent-masked reasoning compares expected and factual specifications under four views; sandbox validation checks candidate defects.
Figure 1. Overview of SkillSpec.

SkillSpec aligns instructions and code in a unified graph, compares expected and factual specifications under complementary intent views, and validates candidate defects in an isolated sandbox.

Multi-View Intent Masking

Workflow target · FactSpec · Self view

Target step + its reachable code.

Dashed arrows show containment; solid arrows show workflow dependencies or code calls. The cross-graph arrow marks invocation.

Workflow target · FactSpec · Self view Target: Ref_code. Layers: Self. Instruction visible: Ref_code. Code body visible: process(), helper(). Interface visible; body hidden: none. Other nodes are masked and shown only for orientation. Dashed arrows show containment; solid arrows show workflow dependencies or code calls. The cross-graph arrow marks invocation. Skill WorkflowCode Graph invokes Root: Masked Root Context: Masked Context Stage A: Masked Stage A Stage B: Masked Stage B Plain: Masked Plain Inline_code: Masked Inline_code Inline_code: Masked Inline_code Ref_code: Instruction visible Ref_code Check input: Masked Check input Review: Masked Review Consume: Masked Consume main(): Masked main() transform(): Masked transform() load(): Masked load() process(): Code body visible process() validate(): Masked validate() read(): Masked read() parse(): Masked parse() helper(): Code body visible helper() report(): Masked report() tokenize(): Masked tokenize()
Target Visible Masked

Semantics in Skills

Semantic structure of the skill-creator skill: a sentence similarity heatmap, alignment between workflow instructions and script code across SKILL.md, and the skill repository structure.
Figure 2. Semantic structure and similarity alignment between SKILL.md text and scripts in skill-creator.

Dataset

Our evaluation corpus contains 515 real-world skill repositories from two sources. SkillsBench provides manually curated skills for diverse agent tasks. SkillsTop contains widely downloaded skills from skills.sh, selected as the top 160 repositories in each of the text and script subsets by cumulative downloads.

Composition of the evaluation corpus
DatasetTypeSkillsFilesSkill linesCode linesOther lines
SkillsTop Text1601,03226,53396,169
Script1602,87339,624172,402453,030
SkillsBench Text15228028,51825,318
Script433038,33026,00261,339
Total5154,488103,005198,404635,856

Text and Script denote repositories without and with standalone scripts, respectively. Skill, Code, and Other lines count lines in SKILL.md, code files, and other resources. A dash indicates that code lines are not applicable. Repositories were deduplicated and frozen at the revisions available on July 14, 2026.

Citation

BibTeX
@misc{zhang2026skillspec,
  title  = {SkillSpec: Intent-Masked Specification Reasoning for Agent Skill Correctness},
  author = {Yizhuo Zhang and Bo Kang and Yi Yang and Zhiyu Duan and Zhouteng Ye and Shunkun Yang},
  year   = {2026},
  note   = {Manuscript},
  url    = {https://github.com/IainZhang/SkillSpec}
}