SkillSpec: Intent-Masked Specification Reasoning for Agent Skill Correctness
Organizations: Beihang University, Beijing 100191, 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.
Figures & tables
| Layer | Workflow Graph Node | Code Graph Node |
| Holistic | The skill-level objective and global constraints, represented by the overview, root, and context units. | The same skill-level objective and global constraints, shared by all definitions in the code graph. |
| Lineage | Upstream workflow units, dependencies, and artifacts along the execution path leading to the target step. | Ancestor definitions along the resolved call path leading to the target definition. |
| Neighbors | The parent stage and sibling operations that establish the local role and coordination constraints of the target step. | The immediate caller and sibling callees that establish the local calling context of the target definition. |
| Self | The target workflow step. For FactSpec, the implementation branch reached through the intent / implementation binding is additionally exposed. | The target definition and its linked workflow unit. The target source is visible in all factual views and masked in the expectation view. |
| Dataset | Type | # Skills | # Files | Skill lines | Code lines | Other lines |
| SkillsTop | Text | 160 | 1,032 | 26,533 | – | 96,169 |
| Script | 160 | 2,873 | 39,624 | 172,402 | 453,030 | |
| SkillsBench | Text | 152 | 280 | 28,518 | – | 25,318 |
| Script | 43 | 303 | 8,330 | 26,002 | 61,339 | |
| Total | 515 | 4,488 | 103,005 | 198,404 | 635,856 |
| Dataset | Type | Skills | Workflow Defects | Code Defects | |||||||
| Total | Defective | Rate | Avg. Defects | Valid. | Conf. Manual | Prec. | Valid. | Conf. Manual | Prec. | ||
| SkillsTop | Text | 160 | 29 | 18.1% | 1.4 | 103 | 41 | 39.8% | – | – | – |
| Script | 160 | 111 | 69.4% | 4.2 | 262 | 141 | 53.8% | 482 | 320 | 66.4% | |
| SkillsBench | Text | 152 | 72 | 47.4% | 2.0 | 221 | 143 | 64.7% | – | – | – |
| Script | 43 | 27 | 62.8% | 4.4 | 39 | 21 | 53.8% | 139 | 97 | 69.8% | |
| Overall | 515 | 239 | 46.4% | 3.2 | 625 | 346 | 55.4% | 621 | 417 | 67.1% | |
| Category | Workflow Defects | Code Defects | ||
| Num. | Prop. | Num. | Prop. | |
| Requirement Error | 149 | 43.1% | 7 | 1.7% |
| Constraint Omitted | 46 | 13.3% | 28 | 6.7% |
| Semantic Conflict | 61 | 17.6% | 0 | 0.0% |
| Implementation Deviation | 90 | 26.0% | 382 | 91.6% |
| Total | 346 | – | 417 | – |
| Node Type | Distribution | Eligible | Defect Nodes | ||||
| Num. | Prop. | Num. | Cand. | Valid. | Conf. | Rate | |
| Workflow graph | |||||||
| root | 515 | 4.5% | – | – | – | – | – |
| stage | 2,110 | 18.4% | – | – | – | – | – |
| context | 2,261 | 19.7% | – | – | – | – | – |
| plain | 3,351 | 29.1% | 2633 | 246 | 142 | 64 | 1.9% |
| Model | Dataset | Skills | Workflow Defects | Code Defects | ||||||
| Candidate | Validated | Rate | Candidate | Validated | Rate | Candidate | Validated | Rate | ||
| GPT-5.6-Sol | SkillsTop-T | 76 | 50 | 65.8% | 183 | 103 | 56.3% | – | – | – |
| SkillsTop-S | 138 | 127 | 92.0% | 409 | 262 | 64.1% | 532 | 482 | 90.6% | |
| SkillsBench-T | 105 | 89 | 84.8% | 334 | 221 | 66.2% | – | – | – | |
| SkillsBench-S | 38 | 36 | 94.7% | 55 | 39 | 70.9% | 152 | 139 | 91.4% | |
| Total | 357 | 302 | 84.6% | 981 | 625 | 63.7% | 684 | 621 | 90.8% | |
| Method | Type | Candidates | Sandbox Validated | Manually Confirmed |
| Vanilla | Workflow | 102 | 67 (65.7%) | 29 (28.4%) |
| Code | 179 | 149 (83.2%) | 101 (56.4%) | |
| SkillSpec | Workflow | 55 | 39 (70.9%) | 21 (38.2%) |
| Code | 152 | 139 (91.4%) | 97 (63.8%) |
| Views | SkillsBench-T | SkillsBench-S | Overall |
| Intent-view configurations: Confirmed/Candidate (Rate) | |||
| Self | 127/330 (38.5%) | 107/216 ( 49.5% ) | 234/546 ( 42.9% ) |
| Lineage | 122 /303 (40.3%) | 109/201 (54.2%) | 231/504 (45.8%) |
| Neighbors | 127/338 ( 37.6% ) | 109/208 (52.4%) | 236/546 (43.2%) |
| Holistic | 123/316 (38.9%) | 105 /201 (52.2%) | 228 /517 (44.1%) |
| Multi-View | 143 /334 ( 42.8% ) | 118 /207 ( 57.0% ) | 261 /541 ( 48.2% ) |
| Stage | Cost/skill | Proportion | Unit | Cost/unit |
| Graph Construction | 0.404$ | 15.6% | Skill | 0.404$ |
| Specification Reasoning | 1.915$ | 74.1% | Node | 0.137$ |
| Sandbox Validation | 0.266$ | 10.3% | Candidate | 0.082$ |
| Total | 2.585$ | - | - | - |
| Category | Workflow FPs | Code FPs | ||
| Num. | Prop. | Num. | Prop. | |
| Unsupported Claim | 3 | 1.5% | 7 | 4.7% |
| Over-inference | 135 | 68.5% | 31 | 20.8% |
| Unreachable Trigger | 8 | 4.1% | 74 | 49.7% |
| External Compensation | 39 | 19.8% | 3 | 2.0% |
| Benign Difference | 12 | 6.1% | 34 | 22.8% |
AI Agent Auditing
AI agent auditing examines agents’ actions, tool use, evidence, and outcomes to assess safety, compliance, reliability, and accountability.
See all 269 papers