add-a-capability
Installation
SKILL.md
Add a capability
Define the shared contract once. Implement its handler where the data and infrastructure live. Do not write separate business logic for each interface.
1. Define the contract
Put cross-process contracts in packages/core/src/contracts.ts and import defineContract from @rat-stack/capability/contract.
- Define the input, output, and expected failure schemas.
- Give the contract a stable name and short description.
- Use
Schema.Structfor the input. - Set honest annotations such as
readOnly,idempotent,destructive, andopenWorld. - Set
needsApproval: truewhen the action needs approval.implementadds theApprovalrequirement andApprovalDeniedfailure; the handler itself declares only the contract's failures.