Writing Contracts
Coming Soon
Detailed guide for writing behavioral contracts is under construction.
Basic Structure
A behavioral contract is a YAML file that documents:
- Metadata - Package name, version range, maintainer
- Functions - Which functions are covered
- Preconditions - Requirements before calling
- Postconditions - What happens after (errors, returns)
- Edge Cases - Known gotchas
Example Template
package: example-package
semver: ">=1.0.0 <2.0.0"
contract_version: "1.0.0"
maintainer: "your-github-username"
last_verified: "2026-02-27"
status: draft
functions:
- name: exampleFunction
import_path: "example-package"
description: "What this function does"
postconditions:
- id: error-case
condition: "When error occurs"
throws: "ErrorType"
required_handling: "How to handle it"
source: "https://package-docs.com"
severity: error
More Coming Soon
We're working on a comprehensive guide. In the meantime:
- See Schema Reference
- Browse existing contracts in the corpus
- Ask questions in GitHub Discussions