# I/O Protocol

Skills that materially participate in artifact handoff declare an I/O contract. This enables dependency checking and workflow automation without forcing pure methodology skills to duplicate orchestration metadata.

## Contract Format

When a skill needs an I/O contract, use this section format:

```yaml
io_contract:
  requires:           # Input artifacts that must exist before invocation
    - artifact: "requirements.md"
      path: "{work-dir}/requirements.md"
  produces:           # Output artifacts created by this skill
    - artifact: "architecture/api-contract.md"
      path: "{work-dir}/architecture/api-contract.md"
  feeds_into:         # Downstream skills that consume this skill's output
    - task-decompose
  updates_manifest:   # Which manifest fields this skill writes
    - artifacts.architecture
```

`{work-dir}` resolves to `.forge/work/{type}/{name}/`.

## Pre-Invocation Check

Before invoking any skill with an I/O contract:
1. Verify each required artifact exists at the expected path
2. If missing: invoke the producing skill first, or ask the user

## Post-Completion Check

After a skill with an I/O contract completes:
1. Verify all `produces` artifacts were created
2. Verify manifest was updated
3. If missing: report the gap — do not silently proceed
