Skill Contracts
Skills can declare their expected inputs and produced outputs, creating a clear contract for how they interact with the environment.
Defining Contracts in SKILL.md
Add inputs and outputs sections to the YAML frontmatter:
---name: security-scandescription: Scan for vulnerabilitiesinputs: files: description: List of file paths to scan type: string severity: description: Minimum severity level type: enum options: [low, medium, high] default: mediumoutputs: report: description: Scan report in markdown type: string passed: description: Whether scan passed type: boolean---
Scan the provided files for security issues.Report findings with at least {{severity}} severity.Field Properties
Each input or output field supports:
| Property | Required | Description |
|---|---|---|
description | Yes | What the field represents |
type | Yes | string, number, boolean, enum |
options | Enum only | Valid values for enum type |
default | No | Default value if not provided |
Combining with Parameters
A skill can have params, inputs, and outputs together:
- params - Template variables interpolated at compile time (
{{var}}syntax) - inputs - Runtime data the skill expects to receive
- outputs - Runtime data the skill produces
---name: code-reviewdescription: Review {{language}} codeparams: language: type: string default: typescriptinputs: files: description: Files to review type: stringoutputs: issues: description: List of issues found type: string score: description: Quality score type: number---
Review the provided {{language}} files.Validation
The PS017 validation rule checks contract definitions:
- Field types must be
string,number,boolean, orenum - Enum fields must include an
optionsarray - Name collisions between
paramsandinputsare flagged
See Also
- Local Skills - Managing skills in your project
- Parameterized Skills - Making skills configurable with
{{var}}templates - Shared Resources - Share files across all skills